Repository navigation
fix(tool_mcp_client): stop reasoning-model agents dropping zero-argument MCP tools - #1491
Conversation
📝 WalkthroughWalkthroughThis PR normalizes empty MCP tool schemas with a synthesized placeholder, removes that placeholder before dispatch, fixes the ChangesZero-argument tool normalization and dispatch fix
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@nodes/src/nodes/tool_mcp_client/mcp_sse_client.py`:
- Around line 167-168: Add end-to-end zero-argument tool coverage for the SSE
and streamable HTTP clients: the current synthesis of rr_no_args in
McpSseClient.list_tools() is untested, and McpStreamableHttpClient.list_tools()
should be covered the same way. Update or add tests alongside
TestStubIntegration in test_zero_arg_tools.py to exercise both clients, verify
they normalize a missing/non-dict inputSchema through
normalize_tool_input_schema, and assert the returned tool exposes rr_no_args
consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 974abaa5-9569-4179-9864-b8126d5c8040
📒 Files selected for processing (10)
nodes/src/nodes/tool_mcp_client/IGlobal.pynodes/src/nodes/tool_mcp_client/IInstance.pynodes/src/nodes/tool_mcp_client/README.mdnodes/src/nodes/tool_mcp_client/mcp_schema.pynodes/src/nodes/tool_mcp_client/mcp_sse_client.pynodes/src/nodes/tool_mcp_client/mcp_stdio_client.pynodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.pynodes/test/tool_mcp_client/stub_mcp_server.pynodes/test/tool_mcp_client/test_mcp_agent_catalog.pynodes/test/tool_mcp_client/test_zero_arg_tools.py
…ing-model agents
Empty MCP tool input schemas ({'type':'object'} with no properties) are
silently dropped from the tool catalog by strict reasoning models (e.g.
qwen3.6-27b on Groq), surfacing as "Tool <x> not found". Forgiving models
(llama-3.3-70b) tolerate them.
- Normalize empty/degenerate schemas in all three transports' list_tools()
to carry one optional placeholder arg (rr_no_args) via a shared
mcp_schema.normalize_tool_input_schema helper.
- Strip rr_no_args in _tool_invoke_dynamic before the real tools/call so the
MCP server never receives it.
- Emit inputSchema (was input_schema) from list_namespaced_tools so
agent_langchain/agent_crewai/agent_deepagent read real MCP schemas; the
host does not normalize descriptor key casing.
- Add a stub stdio MCP server plus unit, integration and agent-catalog tests,
and a README note.
Fixes #1404
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
74f864a to
7643275
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@nodes/src/nodes/tool_mcp_client/IInstance.py`:
- Line 40: The current argument sanitizing in strip_synthesized_args is removing
any rr_no_args field from every dict input, which can strip legitimate tool
arguments before dispatch. Update the logic in strip_synthesized_args and its
caller path in IInstance to only remove rr_no_args when the tool schema does not
actually define that property, and preserve the value when it is part of the
declared schema.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6f248421-aac0-4d16-8560-ffae1472058d
📒 Files selected for processing (10)
nodes/src/nodes/tool_mcp_client/IGlobal.pynodes/src/nodes/tool_mcp_client/IInstance.pynodes/src/nodes/tool_mcp_client/README.mdnodes/src/nodes/tool_mcp_client/mcp_schema.pynodes/src/nodes/tool_mcp_client/mcp_sse_client.pynodes/src/nodes/tool_mcp_client/mcp_stdio_client.pynodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.pynodes/test/tool_mcp_client/stub_mcp_server.pynodes/test/tool_mcp_client/test_mcp_agent_catalog.pynodes/test/tool_mcp_client/test_zero_arg_tools.py
joshuadarron
left a comment
There was a problem hiding this comment.
Review
Verdict: Approve. Correct fix at the right layer, both bugs verified against the actual descriptor contract, solid test coverage including a real subprocess MCP round-trip.
Verified against the code (not just the diff)
- The snake→camel fix is a real bug fix, not a rename: the engine's
ToolDescriptorcontract is camelCase —rocketlib/filters.py:743emits'inputSchema'for static tool nodes, and every agent consumer readstd.get('inputSchema')(crewai_base.py:402, deepagent.py:228, langchain, planner).list_namespaced_toolsemittinginput_schemameant agents fell back to the generic input model for every MCP tool. No reader of the old snake key on the MCP descriptor path exists — the otherinput_schemagrep hits (ai/common/utils/agent_tools.py,filters.pydecorator meta) are separate contracts, unaffected. - Strip path is complete:
_tool_invoke_dynamicis the single dynamic dispatch intoIGlobal.call_tool; stripping there covers all agent invocations. Applied after the_FRAMEWORK_KEYSfilter, correct ordering. - Normalization is conservative: schemas with real
propertiespass through by identity; extra keys (title,description) preserved; all three transports call the same shared helper. - Tests earn their keep: the stub server echoes back
received_arguments, sotest_synthesized_arg_never_reaches_serverproves the round-trip claim rather than asserting on internals; the catalog test drives the realplanner._build_all_tool_descriptionspath named in #1404, and the pre-fix hazard is documented as a test.
Non-blocking observations
strip_synthesized_argsruns unconditionally on every dynamic invoke, so a real MCP tool argument literally namedrr_no_argswould be silently dropped even for tools with genuine schemas. Therr_prefix makes this vanishingly unlikely and it's documented — fine as-is; a schema-aware strip (only when the cached tool schema was synthesized) is possible if it ever bites.- SSE / streamable-HTTP transports get the one-line normalization but only stdio has an end-to-end test. Acceptable: the helper is pure and unit-covered, and the transport change is identical in all three.
CI: builds, ruff, gitleaks, CodeRabbit all green.
🤖 Generated with Claude Code
asclearuc
left a comment
There was a problem hiding this comment.
Thanks for this, @kgarg2468 — genuinely clean fix. The diagnosis is spot-on, normalizing at the MCP source is the right placement, and the optional-placeholder-then-strip design is exactly right. The docstrings and README are excellent.
Requesting one change before merge: please add a test for the input_schema → inputSchema fix in list_namespaced_tools (IGlobal.py:231). This is the more impactful of the two fixes — it unblocks agent_langchain/agent_crewai/agent_deepagent, which read the camelCase key — but nothing currently exercises list_namespaced_tools. The catalog test hardcodes inputSchema and the stub test stays at the transport level, so reverting line 231 would keep CI green. A small test asserting list_namespaced_tools() emits inputSchema (with the real schema) would close the gap.
The normalize/strip helpers themselves are well covered — this is the one path that isn't.
Minor: the PR summary says the catalog test drives "the real agent_langchain and agent_rocketride", but it only drives agent_rocketride (the test's own docstring notes agent_langchain isn't re-exercised). Worth correcting the description.
🤖 Internal: Discord sync markerAuto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@nodes/test/tool_mcp_client/test_zero_arg_tools.py`:
- Around line 60-62: Consolidate the imports in test_zero_arg_tools.py so
McpStdioClient and McpToolDef are loaded through the same module path rather
than mixing direct mcp_stdio_client and tool_mcp_client.mcp_stdio_client
imports. Update the affected import statements while preserving the existing
IGlobal import and symbol usage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4d29e5f3-f93b-4520-9953-f0e9b06128e4
📒 Files selected for processing (1)
nodes/test/tool_mcp_client/test_zero_arg_tools.py
|
Addressed the human and CodeRabbit change requests:
Local verification: 31 focused tests + 286 node contract tests passed; Ruff is clean. I will request re-review after the new CI and CodeRabbit run finish. |
…ing-model agents (rocketride-org#1491) Empty MCP tool input schemas ({'type':'object'} with no properties) are silently dropped from the tool catalog by strict reasoning models (e.g. qwen3.6-27b on Groq), surfacing as "Tool <x> not found". Forgiving models (llama-3.3-70b) tolerate them. - Normalize empty/degenerate schemas in all three transports' list_tools() to carry one optional placeholder arg (rr_no_args) via a shared mcp_schema.normalize_tool_input_schema helper. - Strip rr_no_args in _tool_invoke_dynamic before the real tools/call so the MCP server never receives it. - Emit inputSchema (was input_schema) from list_namespaced_tools so agent_langchain/agent_crewai/agent_deepagent read real MCP schemas; the host does not normalize descriptor key casing. - Add a stub stdio MCP server plus unit, integration and agent-catalog tests, and a README note. Fixes rocketride-org#1404 Co-authored-by: Krish Garg <krishgarg@Krishs-MacBook-Pro.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
rr_no_argsplaceholder. Strict reasoning models otherwise drop zero-argument tools from their catalog._tool_invoke_dynamicstrips it only for those tools, so a server tool that genuinely declares an argument namedrr_no_argskeeps its value.inputSchema(camel case), which is the key consumed by agent implementations, and add transport, invocation, and realagent_rocketridecatalog regression tests.Type
fix
Testing
Tests added or updated
Tested locally
Full
./builder testsuite (covered by CI)./dist/server/engine -m pytest nodes/test/tool_mcp_client -q-> 31 passed./builder nodes:test-contracts-> 286 passedRuff checks on all changed Python files -> clean
The catalog test executes the real
agent_rocketrideon-demand catalog builder. Theagent_langchainpath reads the same correctedinputSchemadescriptor key but is not constructed in this test because its dynamically loaded Pydantic models are environment-sensitive.A live run against the reported Groq reasoning model was not possible without credentials; the tests instead verify the exact schema catalog and MCP call arguments.
Checklist
input_schemakey had no working agent consumer)Linked Issue
Fixes #1404
Summary by CodeRabbit
New Features
Bug Fixes
inputSchemahandling is now consistent across MCP clients (including correct casing in exposed tool metadata).rr_no_args).Documentation
Tests