Skip to content

fix(scripts): pass MCP callTool timeouts as request options - #2387

Merged
baron merged 1 commit into
morluto:mainfrom
AurelioB:fix/mcp-calltool-timeout
Oct 13, 2026
Merged

baron merged 1 commit into
morluto:mainfrom
AurelioB:fix/mcp-calltool-timeout

Conversation

@AurelioB

@AurelioB AurelioB commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

@modelcontextprotocol/client is pinned to 2.3.1, which declares callTool(params, options). Three verifiers still use the v1 shape callTool(params, undefined, { timeout }). The SDK drops the third argument, so those calls run under its 60 s default (DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4) instead of the timeout they request:

Script Line Timeout requested
scripts/verify-real-ghidra-mips.mjs 172 180 s
scripts/verify-real-ghidra-mips.mjs 182 60 s
scripts/verify-real-ghidra-mips.mjs 417 180 s
scripts/verify-real-ghidra-mips-relocatable.mjs 127 180 s
scripts/verify/javascript/recovery.mjs 44 150 s

They pass today because their fixtures are small. On a slow or cold host, any call over 60 s fails even though the script asked for more. That's how I ran into it: a Ghidra analysis of a firmware libc takes about 71 s.

Fix

Pass the options as the second argument. No other call site in scripts/, src/ or tests/ uses the SDK Client with three arguments; the remaining three-argument callTool calls belong to REA's own provider clients, whose signature is (operation, params, options).

Verification

  • Runtime demonstration (throwaway script against scripts/rea.mjs mcp, binary_session):

    Timeout position Result
    { timeout: 1 } third the call completes
    { timeout: 1 } second SdkError: Request timed out
  • Affected verifiers on this branch, all exit 0:

    • npm run verify:javascript:recovery, with the official Wakaru 1.14.0 binary (SHA-256 checked) and esbuild 0.25.10 / webpack 5.101.3 installed as in CI.
    • npm run verify:ghidra:mips (Ghidra 12.1.4).
    • npm run verify:ghidra:mips-relocatable (Ghidra 12.1.4).
  • Formatting and lint: oxfmt --check and oxlint on the changed files.

No persistent regression test: the affected calls are inline closures inside .mjs verifier scripts, outside type checking. A behavioral test would need those wrappers exported and driven against a deliberately slow MCP server, which is a refactor beyond this fix. The runtime comparison above exercises the SDK behavior directly.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@modelcontextprotocol/client 2.3.1 declares callTool(params, options).
Three verifiers still used the v1 shape callTool(params, undefined,
{ timeout }), so the third argument was dropped and those calls ran
under the SDK's 60 s default instead of the 150-180 s they request.
Pass the options second.
@AurelioB
AurelioB force-pushed the fix/mcp-calltool-timeout branch from 6c8a43a to 926ba76 Compare October 12, 2026 22:01

@baron baron 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.

Source verdict: APPROVE for 926ba7647d4e96cb24a1f0db02cc560838054e8b.

Five verifier calls now pass timeout options to the pinned SDK 2.3.1 owning callTool(params, options) boundary. They do not increase production timeouts or add another wrapper. The remaining three-argument calls belong to REA provider clients with a distinct signature, not the SDK; they are not mechanically rewritten.

Pinned validation: syntax checks on all three scripts, typecheck/lint, and an actual delayed in-memory SDK witness showing third-position timeout is ignored while second-position timeout rejects. Current-head hosted real JavaScript recovery and required Static/Test coverage/CI checks are green. Current-main object integration is clean.

Real Ghidra verification is author-reported, not independently rerun or claimed attested here. This narrow SDK options-placement correction changes no Ghidra producer/engine semantics. No provider installation, GUI operation or caller target execution was performed.

@baron baron added the bug Something isn't working label Oct 12, 2026
@matbrgz

matbrgz commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Review & Verification Summary

Verdict: LGTM (Approved) 🚀

1. Root Cause & Solution

  • In @modelcontextprotocol/client v2.3.1, client.callTool(params, options) takes request options as its second parameter.
  • The three-argument form client.callTool(params, undefined, { timeout }) inadvertently dropped the options object, causing slow or complex Ghidra MIPS / JavaScript recovery verifier steps to fall back to the default 60-second SDK timeout and fail intermittently on cold runs.
  • Collapsing to the 2-argument signature (params, options) correctly restores caller timeout overrides.

2. Verification

  • Diff is clean, focused, and accurately fixes all three affected verifier scripts (verify-real-ghidra-mips-relocatable.mjs, verify-real-ghidra-mips.mjs, verify/javascript/recovery.mjs).

@baron
baron merged commit c462a4e into morluto:main Oct 13, 2026
34 checks passed
@morluto morluto added the area: build Build, CI, packaging, and publishing label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants