fix(mcp): keep tool schemas available across SDK field names - #918
Open
breedx wants to merge 2 commits into
Open
fix(mcp): keep tool schemas available across SDK field names#918breedx wants to merge 2 commits into
breedx wants to merge 2 commits into
Conversation
Contributor
Author
|
The focused fix remains independently testable, but full CI is red on an existing completion assertion: a quoted Details:
No failing checks or warnings were suppressed. The full CI run also reports deprecation/resource/coroutine warnings beyond the locally reproduced stream warnings; I am not claiming that all of those have independent base controls. No merge-ready or all-green CI claim is made. Once the separate completion correction lands, these unchanged fixes can be requalified on the updated base. |
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.
MCP tools can lose schema-based argument conversion when a tool definition exposes
input_schemainstead ofinputSchema. Support both field names so tool calls keep their expected argument types without requiring an SDK upgrade.Problem
Live schema lookup and cached introspection currently read only the camelCase field. Snake-case-only definitions lose their schema, and definitions with a deprecated camelCase alias still access that alias even when the preferred field exists.
Change
inputSchemaonly wheninput_schemais absent orNone.The accessor does not change connector entry, tool execution policy, or lifecycle behavior. It does not depend on the open MCP capability refactor (#834); that refactor also touches
managed_server.pyand should retain the shared accessor.Validation
Tested on Linux / Python 3.13.13 using the unchanged upstream lock, based on
1d25d696. The installed MCP SDK is 1.27.1; its realToolobjects verify legacy compatibility. Modern-field shapes use explicit test doubles, including a deprecated alias that raises if touched.Nonefallback, conflicting fields, empty schemas, absent schemas and real SDKToolinstances. Expectations are explicit rather than calculated using the production fallback algorithm.python -m pytest -q -o addopts= tests/mcp/test_schema_field_compatibility.py tests/mcp/test_managed_server.py tests/mcp/test_tool_arg_coercion.py: 106 passed.python -m pytest -q -o addopts= tests/mcp: 483 passed, 6 skipped, no warnings.git diff --checkpass for the changed files.Tests ran with disposable HOME/XDG directories, no inherited credentials, and socket connect/DNS/bind blocked. All six skips explicitly cover search functionality that is not implemented; none hides a schema regression.
Compatibility and limits
No dependency, package-version or public configuration changes. No live connector or installed SDK-v2 qualification is claimed; this patch tests the two field contracts and the currently pinned SDK.