Skip to content

fix(web): carry MCP tool error problems in _meta, as Protean does - #26

Merged
htcom-code merged 1 commit into
mainfrom
fix/mcp-tool-error-problem-meta
Oct 30, 2026
Merged

htcom-code merged 1 commit into
mainfrom
fix/mcp-tool-error-problem-meta

Conversation

@htcom-code

Copy link
Copy Markdown
Owner

Summary

Protean PR htcom-code/protean#91 (issue #90) moved a stable-code MCP tool error's RFC 9457 problem from structuredContent to the result _meta["org.htcom.protean/problem"]. Protrus now does the same.

  • mcp_tool_problem writes the problem under MCP_PROBLEM_META_KEY and carries no structuredContent on error results. The [CODE] detail text, successful results, and JSON-RPC error.data are unchanged.
  • Why: a declared outputSchema describes the success payload, and the spec requires structuredContent to conform to it. Clients that validate error results too (TypeScript SDK 1.x) replaced the actual error with a schema-violation error.
  • Tests that read a problem now read it from _meta. A new test, coded_tool_errors_carry_their_problem_in_meta, mirrors Java's McpOutputSchemaConformanceTest.error_results_never_carry_a_nonconforming_structured_content (every tool with an outputSchema on its error path, at least 10 tools, including scope_list, get_module, module_versions) and McpHttpControllerTest.coded_tool_error_over_http_carries_its_problem_in_meta.
  • Design 17 §4 and design 30 record the key.
  • list_runtimes scope was already nullable, so Java Per-module isolation mode (isolation.mode, isolation_mode) on the worker host #89 needs no change here.

Verification

  • cargo test -p protrus-web: 75 passed.
  • cargo test --workspace: 310 passed, 0 failed on the second run. The first run stopped at one failing test binary that passed on the rerun; this looks like the known host e2e flake tracked on the task.
  • cargo clippy -p protrus-web --tests: no new warnings (the ControlCommandResult size warning is pre-existing).

Protean PR #91 moved a stable-code tool error's RFC 9457 problem from
structuredContent to the result _meta under "org.htcom.protean/problem"
(McpToolResult.PROBLEM_META_KEY). A declared outputSchema describes the
success payload and the spec requires structuredContent to conform to
it; clients that validate error results too, such as the TypeScript
SDK 1.x, replaced the actual error with a schema-violation error.

mcp_tool_problem now writes the problem under MCP_PROBLEM_META_KEY and
no structuredContent. The [CODE] text, successful results, and
JSON-RPC error.data are unchanged. A new test probes every tool that
declares an outputSchema on its error path, as Java's conformance test
does, and checks scope_list's STATE_CONFLICT over HTTP.

docs(design): record the problem's place in tool error results

Design 17 §4 and design 30 name the _meta key.

Tags: #mcp #parity
Co-Authored-By: htjulia <htjulia1@gmail.com>
@htcom-code
htcom-code merged commit 55ee8d4 into main Oct 30, 2026
@htcom-code
htcom-code deleted the fix/mcp-tool-error-problem-meta branch October 30, 2026 06:08
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