Skip to content

fix(tools): advertise json and any params without an object type, and name the invalid mcp argument - #9261

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/json-param-schemas
Oct 21, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/json-param-schemas

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • json and any tool params are no longer advertised as type: "object". About 994 params were affected, many of them arrays: cbinsights_list_business_relationships.orgIds is described as "e.g. [129410, 1034157]" yet typed as an object. The model saw a contradiction, and validators that honor the type rejected correct calls (Pi local dev's pi-ai did). These params now carry no type, which allows any JSON value; the description stays.
  • MCP argument errors now name what is wrong, e.g. "Invalid MCP operation arguments: must have required property 'query'; /limit must be integer" (up to 3 Ajv errors, extra keys named), instead of only "Invalid MCP operation arguments". Agents can now repair a call instead of retrying blind.
  • McpClient.getNegotiatedVersion() returns the transport's negotiated protocol version. It returned the server's Implementation object, so logs and the test-connection response always showed undefined.

Type of Change

  • Bug fix

Testing

  • params.test.ts: a json/any param accepts both an array and an object under Ajv, for both the LLM and copilot schema surfaces. The legacy snapshot expectation changes deliberately.
  • execute-tool.test.ts: names each invalid argument (fails before the fix), and accepts valid arguments.
  • Every consumer of buildParameterSchema was checked: OpenAI tools are sent non-strict, Anthropic, Bedrock and Gemini pass untyped properties through (MCP tools already do), and the worker treats input_schema as opaque.
  • The 6 touched test files (89 tests) pass, and bun run type-check passes. CI runs the rest.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 21, 2026 12:01am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR lets json and any tool parameters accept any JSON value and makes MCP argument errors more useful.

  • json and any tool values can be arrays or objects.
  • MCP argument errors name the first problem in a tool call.
  • MCP connection details show the protocol version the server agreed to.

Changes since the previous review stop collecting every validation error and update the tests to expect one named failure. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "fix(mcp): report the first invalid argum..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/mcp/tool-schema.ts Outdated
…error

allErrors made Ajv collect every failure on untrusted input before the message kept
three; validation stops at the first failure again and the message names it.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 72eef16 into staging Oct 21, 2026
99 of 101 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/json-param-schemas branch October 21, 2026 01:56

This branch was previously deployed

1 inactive deployment
Preview — 0ed54080 Deployed Oct 21, 2026 by vercel[bot]
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.

1 participant