Skip to content

feat: support progress_callback propagation in ClientSession (issue #1248) #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nkaushal99
Copy link

@nkaushal99 nkaushal99 commented Aug 7, 2025

closes #1248

Motivation and Context

This change introduces support for injecting a default progress_handler into ClientSession. It solves the issue where downstream libraries (e.g., LangChain's MCP adapter) access the raw client.session and make tool calls that bypass the top-level fastmcp.Client’s progress_handler, leading to missing progress reports. With this enhancement, consistent progress reporting is ensured whether tools are called through the high-level client or the lower-level session.

How Has This Been Tested?

This feature has been tested within an async environment using:

  • Direct calls to ClientSession.call_tool(...) to ensure the default handler is triggered.
  • Calls with explicitly provided progress_callback to ensure override behavior works correctly.
  • Integration with langchain_mcp_adapters to confirm downstream compatibility and improved reporting.

Breaking Changes

No breaking changes. This enhancement is backward-compatible. Existing users who do not pass a progress_handler will see no change in behavior. Users who want consistent progress reporting can optionally provide a handler to ClientSession.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

This feature enables clean integration with ecosystem libraries like LangChain without requiring redundant progress callback plumbing at every call site.

@nkaushal99 nkaushal99 requested a review from a team as a code owner August 7, 2025 23:46
@nkaushal99 nkaushal99 requested a review from dsp-ant August 7, 2025 23:46
@nkaushal99
Copy link
Author

link to issue #1248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: support progress_callback propagation in ClientSession
1 participant