Skip to content

fix: preserve downstream MCP tool error status - #153

Merged
gaojude merged 1 commit into
mainfrom
codex/fix-runtime-error-status
Sep 9, 2026
Merged

fix: preserve downstream MCP tool error status#153
gaojude merged 1 commit into
mainfrom
codex/fix-runtime-error-status

Conversation

@gaojude

@gaojude gaojude commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

A downstream Next.js tool result with isError: true is currently wrapped in success: true, and the outer MCP result has no error flag. Clients can treat a failed runtime operation as successful.

Let nextjs_call return an MCP CallToolResult and preserve explicit downstream tool errors on the outer response. Request failures also set isError; healthy calls retain the existing JSON payload. The registration handler passes structured results through and continues wrapping string-returning tools. Adds a patch changeset.

Validation:

  • Regression tests for downstream errors and request failures failed against the original implementation.
  • pnpm build, pnpm typecheck, and the complete pnpm exec vitest run: 36 tests passed.
  • Compared a real Next.js 16.3.4 compile_route failure directly with the stdio proxy: both report isError: true, and the proxy reports success: false.
  • Verified healthy project metadata and connection-refused responses through the same MCP interface.

This preserves explicit MCP error semantics; it does not infer failure by parsing arbitrary text content returned by downstream tools.

Local validation used macOS arm64, Node.js 24.19.0, and pnpm 9.15.9. The uploaded GitHub-signed commit has the same Git tree as the tested checkout.

@gaojude
gaojude merged commit 6bd996f into main Sep 9, 2026
5 checks passed
@gaojude
gaojude deleted the codex/fix-runtime-error-status branch September 9, 2026 17:01
@github-actions github-actions Bot mentioned this pull request Sep 9, 2026
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.

2 participants