Repository navigation
fix(server): MCP tools report readable argument errors and typed model selection - #112
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 984c6fa5ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| options: Schema.optional( | ||
| OrchestratorMcpTargetOptions.annotate({ | ||
| description: "Options from `orchestrator_capabilities`, such as {effort:'max'}.", | ||
| }), | ||
| ), |
There was a problem hiding this comment.
Add an eval case for model-selection argument recovery
This fixes a model-behavior bug by changing the advertised tool schema and validation feedback, but adds no corresponding mcp-tool-use eval case. The new unit tests establish the schema shape and decoding behavior, not whether an agent avoids malformed options or recovers after receiving the readable error—the reported failure this change addresses. Add a case reproducing that failure and compare its behavior before and after the fix, as required by the root AGENTS.md Evals guidance.
AGENTS.md reference: AGENTS.md:L148-L148
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Skipping an evals/mcp-tool-use case here: two commits are upstream backports (pingdotgg/t3code#35729 and #29149), and the untyped-schema failure was reproduced on Gemini via Cursor, which the mcp-tool-use harness does not cover.
Applies upstream pingdotgg#35729. Cursor reduces the JSON-RPC invalid-params error to "Tool execution error", so invalid tool arguments now come back as an isError tool result carrying the validation message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…itted (pingdotgg#29149) Co-authored-by: Julius Marminge <[email protected]>
…ction
t3_thread_launch and t3_thread_configure took ModelSelection, which decodes
from untyped fields, so MCP clients saw instanceId, model and options as
`{}` and had to guess their shape. They now take OrchestratorMcpModelSelection,
which advertises real types (options matches delegate_task's target.options)
and decodes to the same ModelSelection, legacy `provider` included.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…id-argument spans Separates MCP's typed modelSelection advertisement from ModelSelection's compatibility decoder so legacy inputs (such as null entries inside an options object or a non-string provider beside instanceId) still normalize, while advertising that either instanceId or provider is required alongside model. Moves withReadableInvalidArguments outside withToolSpans and withToolAnalytics so invalid arguments fail tool spans and record an invalid_arguments errorCode in analytics without logging arguments.
b6ca34d to
1ff6778
Compare
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
When calling
t3_thread_launchort3_thread_configure, MCP advertisedmodelSelectionfields (instanceId,provider,model,options) as untyped{}objects becauseModelSelectiondecodes from untyped fields. Models like Gemini on Cursor guessed shapes such asoptions: [null], and because MCP returnedInvalidParamsas a JSON-RPC error, Cursor collapsed the failure into an opaque"Tool execution error"with no hint on how to recover.Change
withReadableInvalidArguments(apps/server/src/mcp/McpHttpServer.ts, backport ofpingdotgg/t3code#35729) so invalid tool arguments return anisError: truetool result containing the validation message.options: nullas omitted inModelSelection(packages/contracts/src/modelSelection.ts, backport ofpingdotgg/t3code#29149).OrchestratorMcpModelSelection(packages/contracts/src/orchestratorMcp.ts) and wired it intot3_thread_launchandt3_thread_configureso MCP advertises real field types andoptionsshapes while decoding to the sameModelSelection(legacyproviderincluded), and updatedagentContextBudget.json.Verification
vp run check:changedpassed under Node 26 across all affected packages and tests, including new unit tests inMcpHttpServer.test.ts,advertisedJsonSchema.test.ts,core.test.ts, andmodelSelection.test.ts.mcp-tool-useeval.Implemented with Claude Opus 5.5 (Claude Code); reviewed and opened with Gemini 4 Neon (Antigravity).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.