Skip to content

fix(tool_mcp_client): stop reasoning-model agents dropping zero-argument MCP tools - #1491

Merged
krishhgg merged 3 commits into
developfrom
fix/RR-1404-zero-arg-mcp-tools
Jul 21, 2026
Merged

krishhgg merged 3 commits into
developfrom
fix/RR-1404-zero-arg-mcp-tools

Conversation

@krishhgg

@krishhgg krishhgg commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize empty MCP tool input schemas across STDIO, SSE, and streamable HTTP by adding one optional rr_no_args placeholder. Strict reasoning models otherwise drop zero-argument tools from their catalog.
  • Record whether each cached tool actually received that synthesized placeholder. _tool_invoke_dynamic strips it only for those tools, so a server tool that genuinely declares an argument named rr_no_args keeps its value.
  • Emit the schema as inputSchema (camel case), which is the key consumed by agent implementations, and add transport, invocation, and real agent_rocketride catalog regression tests.

Type

fix

Testing

  • Tests added or updated

  • Tested locally

  • Full ./builder test suite (covered by CI)

  • ./dist/server/engine -m pytest nodes/test/tool_mcp_client -q -> 31 passed

  • ./builder nodes:test-contracts -> 286 passed

  • Ruff checks on all changed Python files -> clean

The catalog test executes the real agent_rocketride on-demand catalog builder. The agent_langchain path reads the same corrected inputSchema descriptor 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

  • Commit messages follow conventional commits
  • No secrets or credentials included
  • Wiki updated (not applicable)
  • Breaking changes documented (none; the old input_schema key had no working agent consumer)

Linked Issue

Fixes #1404

Summary by CodeRabbit

  • New Features

    • Zero-argument MCP tools are now normalized in tool catalogs with a safe placeholder input field, improving agent discovery.
  • Bug Fixes

    • inputSchema handling is now consistent across MCP clients (including correct casing in exposed tool metadata).
    • Placeholder arguments are automatically removed before tool invocation, so servers receive only real arguments (while preserving genuine rr_no_args).
  • Documentation

    • Added guidance describing the placeholder behavior for zero-argument tools.
  • Tests

    • Added contract and integration tests (with a stub MCP server) covering catalog normalization and end-to-end invocation.

@github-actions github-actions Bot added docs Documentation module:nodes Python pipeline nodes labels Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR normalizes empty MCP tool schemas with a synthesized placeholder, removes that placeholder before dispatch, fixes the inputSchema descriptor key, and adds transport, catalog, unit, integration, and stub-server coverage.

Changes

Zero-argument tool normalization and dispatch fix

Layer / File(s) Summary
Schema normalization and stripping utilities
nodes/src/nodes/tool_mcp_client/mcp_schema.py, nodes/src/nodes/tool_mcp_client/README.md
Adds NOOP_ARG_NAME, schema normalization and argument-stripping helpers, plus documentation for zero-argument tools.
Client transport wiring and key fix
nodes/src/nodes/tool_mcp_client/mcp_*.py, nodes/src/nodes/tool_mcp_client/IGlobal.py, nodes/src/nodes/tool_mcp_client/IInstance.py
Normalizes schemas across MCP transports, changes input_schema to inputSchema, and strips synthesized arguments before dynamic invocation.
Stub server and test coverage
nodes/test/tool_mcp_client/*
Adds a JSON-RPC stdio stub and tests for normalization, catalog serialization, descriptor naming, argument stripping, and end-to-end calls.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: module:ai

Suggested reviewers: jmaionchi, stepmikhaylov, rod-christensen

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main fix for zero-argument MCP tool handling in tool_mcp_client and is concise and specific.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/RR-1404-zero-arg-mcp-tools

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 89f6129 and 74f864a.

📒 Files selected for processing (10)
  • nodes/src/nodes/tool_mcp_client/IGlobal.py
  • nodes/src/nodes/tool_mcp_client/IInstance.py
  • nodes/src/nodes/tool_mcp_client/README.md
  • nodes/src/nodes/tool_mcp_client/mcp_schema.py
  • nodes/src/nodes/tool_mcp_client/mcp_sse_client.py
  • nodes/src/nodes/tool_mcp_client/mcp_stdio_client.py
  • nodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.py
  • nodes/test/tool_mcp_client/stub_mcp_server.py
  • nodes/test/tool_mcp_client/test_mcp_agent_catalog.py
  • nodes/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>
@krishhgg
krishhgg force-pushed the fix/RR-1404-zero-arg-mcp-tools branch from 74f864a to 7643275 Compare July 7, 2026 19:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 74f864a and 7643275.

📒 Files selected for processing (10)
  • nodes/src/nodes/tool_mcp_client/IGlobal.py
  • nodes/src/nodes/tool_mcp_client/IInstance.py
  • nodes/src/nodes/tool_mcp_client/README.md
  • nodes/src/nodes/tool_mcp_client/mcp_schema.py
  • nodes/src/nodes/tool_mcp_client/mcp_sse_client.py
  • nodes/src/nodes/tool_mcp_client/mcp_stdio_client.py
  • nodes/src/nodes/tool_mcp_client/mcp_streamable_http_client.py
  • nodes/test/tool_mcp_client/stub_mcp_server.py
  • nodes/test/tool_mcp_client/test_mcp_agent_catalog.py
  • nodes/test/tool_mcp_client/test_zero_arg_tools.py

@krishhgg
krishhgg enabled auto-merge (squash) July 9, 2026 00:27
joshuadarron
joshuadarron previously approved these changes Jul 9, 2026

@joshuadarron joshuadarron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ToolDescriptor contract is camelCase — rocketlib/filters.py:743 emits 'inputSchema' for static tool nodes, and every agent consumer reads td.get('inputSchema') (crewai_base.py:402, deepagent.py:228, langchain, planner). list_namespaced_tools emitting input_schema meant 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 other input_schema grep hits (ai/common/utils/agent_tools.py, filters.py decorator meta) are separate contracts, unaffected.
  • Strip path is complete: _tool_invoke_dynamic is the single dynamic dispatch into IGlobal.call_tool; stripping there covers all agent invocations. Applied after the _FRAMEWORK_KEYS filter, correct ordering.
  • Normalization is conservative: schemas with real properties pass 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, so test_synthesized_arg_never_reaches_server proves the round-trip claim rather than asserting on internals; the catalog test drives the real planner._build_all_tool_descriptions path named in #1404, and the pre-fix hazard is documented as a test.

Non-blocking observations

  • strip_synthesized_args runs unconditionally on every dynamic invoke, so a real MCP tool argument literally named rr_no_args would be silently dropped even for tools with genuine schemas. The rr_ 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 asclearuc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7643275 and af0f04d.

📒 Files selected for processing (1)
  • nodes/test/tool_mcp_client/test_zero_arg_tools.py

@krishhgg

Copy link
Copy Markdown
Collaborator Author

Addressed the human and CodeRabbit change requests:

  • af0f04d7 adds a regression test proving list_namespaced_tools() emits the real schema under inputSchema.
  • c3279527 records whether rr_no_args was synthesized and strips it only in that case; a genuinely declared argument with the same name is preserved and tested.
  • The mixed import paths are consolidated, both CodeRabbit threads are answered/resolved, and the PR description now accurately says the catalog test executes agent_rocketride only.

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.

@krishhgg
krishhgg requested a review from asclearuc July 19, 2026 23:26
@krishhgg
krishhgg merged commit c293de3 into develop Jul 21, 2026
28 of 29 checks passed
@krishhgg
krishhgg deleted the fix/RR-1404-zero-arg-mcp-tools branch July 21, 2026 20:02
AviNormie pushed a commit to AviNormie/rocketride-server that referenced this pull request Nov 9, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reasoning-model agents silently drop zero-argument MCP tools

3 participants