Skip to content

fix(runtime): preserve MCP tool inputSchema from SDK fields - #1101

Closed
AchuthReddy-16 wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
AchuthReddy-16:fix/mcp-list-tools-input-schema
Closed

fix(runtime): preserve MCP tool inputSchema from SDK fields#1101
AchuthReddy-16 wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
AchuthReddy-16:fix/mcp-list-tools-input-schema

Conversation

@AchuthReddy-16

@AchuthReddy-16 AchuthReddy-16 commented Aug 9, 2026

Copy link
Copy Markdown

Summary

McpIntegration.list_tools() always returned an empty inputSchema for MCP tools even when the server provided a schema.

The MCP SDK exposes the field as input_schema in Python, while inputSchema is the JSON alias. The existing code only checked inputSchema, so the lookup missed the actual SDK field and fell back to {}.

This change reads input_schema first while preserving inputSchema as a fallback for compatible stubs. The fake MCP tool used in tests was also updated to match the real SDK shape, and a regression test verifies that list_tools() preserves the schema.

Fixes #1073

Test plan

Ran:

PYTHONPATH=src python3 -m unittest discover -s test -p 'test_mcp_base.py' -v

The new test_list_tools_keeps_input_schema case passed along with the existing MCP tool-call coverage.

Note

Fix McpIntegration tool discovery to preserve input_schema from MCP SDK

The MCP SDK's Tool type uses the snake_case attribute input_schema, but the cache population code in mcp_base.py only read inputSchema, causing schemas to be silently dropped to {}. The fix reads input_schema first, falling back to inputSchema, then an empty dict, and stores the result under inputSchema in the internal cache.

Macroscope summarized 5d88631.

@sethkarten

Copy link
Copy Markdown
Contributor

Thank you for the report and proposed work. This root cause is now covered by maintainer-owned stacked PR #1164, authored independently from upstream/main.

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.

@sethkarten sethkarten closed this Aug 10, 2026
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.

McpIntegration.list_tools() always returns an empty inputSchema (camelCase getattr vs snake_case SDK field)

2 participants