fix(mcp): preserve project tool model output and error status
Merged
RU
2mo ago+58+58+01234567890123456789-3-3-0123456789
- Render string outputs through a project's
toModelOutput, matching how its tool presents results to an AI SDK model. - Preserve
error-textanderror-jsonas MCP results withisError: true, with the rendered text or JSON intact. - Cover both behaviors through a built stdio server and a real MCP client. Update MCP docs, the consumer skill, and the package changeset.
Verified
Ran it locally: yes
- Started the built
e2e mcpCLI on the real Chromium testbed, opened a session, invoked custom project tools, and closed it through the MCP SDK client. Node 24.18.0 and pnpm 12.3.4.
| Tool | main | this branch |
|---|---|---|
| String formatter | raw string | formatted: raw string |
| Rendered text error | Text, no isError | Same text, isError: true |
| Rendered JSON error | JSON text, no isError | Same JSON text, isError: true |
formatted_string {"content":[{"type":"text","text":"formatted: raw string"}]}
failure_text {"content":[{"type":"text","text":"not available"}],"isError":true}
failure_json {"content":[{"type":"text","text":"{\n \"reason\": \"not available\"\n}"}],"isError":true}
- Both new unit regressions and the live server regression fail against main. The branch's focused MCP tests pass 27/27; the full core unit suite passes 2452 tests with 1 skipped. All package builds, core typecheck, lint, and docs validation/broken links pass.
- Fresh-context review found no important or critical findings.
pnpm checkstops at dead-code findings under the filtered dependency install; excluded Expo dependencies also block root-wide typecheck. - Full deterministic web benchmark passes, 41 files and 91 tests, using this branch's built packages against the unchanged production Next app served by the web verification worktree. Hosted Actions require maintainer approval for this fork.