Repository navigation
fix(langchain): load MCP tool metadata on the invocation session - #41749
Closed
John Kennedy (jkennedyvz) wants to merge 3 commits into
Closed
John Kennedy (jkennedyvz) wants to merge 3 commits into
John Kennedy (jkennedyvz) wants to merge 3 commits into
Conversation
Merging this PR will not alter performance1 note
Comparing Footnotes
|
John Kennedy (jkennedyvz)
marked this pull request as ready for review
November 7, 2026 23:51
Co-authored-by: Robin <open-swe@users.noreply.github.com>
The SDK already lists after a call on an unlisted session, so listing before the first call moves that request rather than adding one; held sessions no longer re-list on every call. Co-authored-by: Robin <open-swe@users.noreply.github.com>
robin-agent
Bot
force-pushed
the
jkennedyvz/langchain/mcp-param-headers
branch
from
November 17, 2026 00:07
ff5b823 to
aaf8b8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detached MCP tools reconnect after discovery, but the MCP SDK only mirrors
x-mcp-headerarguments after listing tools on that session. Load the serving client’s listing withcache_mode="use"before either invocation path so cached metadata is reabsorbed andMcp-Param-*headers reach the server.Each session lists once, before its first call to a tool it has not listed yet. This adds no
tools/listrequests: the SDK already lists after any successful call on an unlisted session to load output schemas, so this moves that request ahead of the call. Long-held sessions do not list again on later calls.The HTTP regression uses the SDK server’s real argument-header validation, covers direct/group clients and ordinary/interrupt-driven calls.
Compatible with #41736: the listing belongs immediately inside its serving-member connection; this PR leaves that independent connection-routing change untouched.
Local checks found an existing failure in
test_separate_adapters_keep_their_own_protocol_era(the original client is disconnected because the adapter clones it); it also fails with this fix removed.Release note
MCP tools invoked after discovery reconnect with the metadata required to send argument headers.
Implemented with AI assistance.
References
Made by Robin · view thread · openai:gpt-6.1-sol (medium)