fix(runtime): preserve MCP tool inputSchema from SDK snake_case fields - #1084
Closed
sdshah09 wants to merge 1 commit into
Closed
fix(runtime): preserve MCP tool inputSchema from SDK snake_case fields#1084sdshah09 wants to merge 1 commit into
sdshah09 wants to merge 1 commit into
Conversation
getattr used camelCase wire aliases, so list_tools always returned empty inputSchema. Prefer snake_case with camelCase fallback for result parsing too. fixes PrimeIntellect-ai#1073 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Thank you for the report and proposed work. This root cause is now covered by maintainer-owned stacked PR #1164, authored independently from We did not inspect or reuse this PR's diff, branch, commits, implementation code, or tests; its public description/comments were used only as a bug report. To keep one review surface, this PR is superseded by #1164 and is being closed. The complete review stack is #1158–#1165. It is being left unmerged for human review after CI and review-bot findings are cleared. |
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.
Summary
McpIntegration.list_tools()always returning emptyinputSchemaby reading the MCP SDK's snake_caseinput_schemaattribute (camelCase is only the wire alias).is_error/structured_contentin_parse_result.Fixes #1073
Test plan
cd prime-agent-runtime && PYTHONPATH=src uv run python -m unittest discover -s test -p 'test_mcp_base.py' -v_sdk_fieldreturns the schema from a realmcp.types.ToolNote
Fix MCP tool
inputSchemapopulation by reading SDK snake_caseinput_schemafieldThe MCP Python SDK exposes fields like
input_schema,is_error, andstructured_contentas snake_case attributes, but the code was reading camelCase names (inputSchema,isError,structuredContent), causing tool schemas and structured results to be empty or ignored._sdk_field()helper in mcp_base.py that prefers the snake_case attribute and falls back to the camelCase alias, so both naming conventions are handled.list_tools()to use_sdk_field(t, "input_schema", "inputSchema")so tool entries include the correct schema._parse_result()to readis_errorandstructured_contentvia the same helper.Macroscope summarized 33320d9.