REQ-MCP-002: Tool results always cross boundaries as a ServerResponse JSON envelope

← Requirements

What it requires

  1. Given a tool returning result text and directives, When the server serialises the response, Then the output parses as JSON with a string result and an array directives whose entries carry a type string from the wire name table.
  2. Error paths (unknown tool, unknown server, permission denied, disconnected external server) use the same envelope with the error text in result.
tier
NOT_RUN

Where it lives

  • src/mcp17

See it on the map

How it is met

implemented byresults (128 tests)build_directivebuild_responsedirective_type_namedisconnected_errordispatchexecuteexecuteexecuteexecuteexecute_toolextract_and_process_directivesextract_directive_arraymake_git_responseparse_tool_result_textroute_external_or_unknownroute_plugin_callserialize_response128 absent128 tests, a summary by result: every test is in the tests table below

Show on the map

Implemented by

Tests (128)

Reached through calls

128 tests: 128 absent

testresultlinked byimplementers exercisedcalls away
Permission denied blocks executionabsentinferred5 of 171
Permission denied blocks external toolsabsentinferred5 of 171
ServerManager routes to external serverabsentinferred5 of 171
Tool routingabsentinferred5 of 171
Unknown server returns errorabsentinferred5 of 171
connect_external_server(spec) forwards env to child processabsentinferred5 of 171
gh#171: an external server can come and go while runs route callsabsentinferred5 of 171
gh#203: followup returns delegation_id and summary from real storageabsentinferred5 of 171
Context anchor auto-injectionabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
Execute dispatches to toolabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
No anchor by defaultabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
ServerResponse JSON envelopeabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
Unknown tool returns errorabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
complete carries suggested_files into the resultabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
complete with coverage_gap=true requires gap_descriptionabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
followup rejects empty query with a typed errorabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
followup rejects non-object args with a typed errorabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
followup reports unavailable without providerabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
followup with malformed (non-JSON) args returns invalid-args errorabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#129: pipeline emits directives for all-valid stagesabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#129: pipeline rejects stage names not in tier_namesabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#162: a requires_context tier refuses a contextless delegationabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#162: delegate carries a structured context listabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#162: resume_delegation accepts a target instead of an idabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
gh#162: resume_delegation still needs one of id or targetabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
outside-root: the SHIPPED default config no longer hands the model absentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
resume_delegation emits delegate+stop directivesabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
resume_delegation rejects missing argsabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_complete_emits_stopabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_delegate_emits_stopabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_diagnose_no_provider_errorabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_one_delegatable_tier_registers_delegateabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_phase_change_emits_directiveabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_pipeline_requires_two_stagesabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_prune_context_emits_directiveabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_single_tier_skips_delegateabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
test_todo_emits_anchor_and_notifyabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
todo update and remove actions mutate the listabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response1
Disconnected server returns structured errorabsentinferred2 of 17: build_response, execute1
Execute sends tools/call and returns resultabsentinferred2 of 17: build_response, execute1
Execute timeout returns errorabsentinferred2 of 17: build_response, execute1
Execute when disconnected returns errorabsentinferred2 of 17: build_response, execute1
Stdio transport connect and executeabsentinferred2 of 17: build_response, execute1
Tool call executes through external MCP stdio transportabsentinferred2 of 17: build_response, execute1
gh#150: a suppressed external call is REPORTED as a failureabsentinferred2 of 17: build_response, execute1
gh#158: a response that answers another request is refusedabsentinferred2 of 17: build_response, execute1
gh#158: concurrent tool calls on one client get distinct idsabsentinferred2 of 17: build_response, execute1
gh#190: a tools/call result flagged isError reaches the engine as a failureabsentinferred2 of 17: build_response, execute1
Dispatch unknown returns errorabsentinferred1 of 17: dispatch1
Dispatch with empty args stringabsentinferred1 of 17: dispatch1
Dispatch with extremely large argsabsentinferred1 of 17: dispatch1
Dispatch with extremely long tool nameabsentinferred1 of 17: dispatch1
Empty tool name dispatch returns errorabsentinferred1 of 17: dispatch1
Malformed JSON args reach toolabsentinferred1 of 17: dispatch1
Register and dispatch toolabsentinferred1 of 17: dispatch1
Tool returning binary data with nullsabsentinferred1 of 17: dispatch1
Tool returning empty resultabsentinferred1 of 17: dispatch1
Unknown tool dispatch returns errorabsentinferred1 of 17: dispatch1
outside-root: an OMITTED allow_outside_root is `optional` and absentinferred5 of 172
outside-root: an explicit `optional` behaves as the defaultabsentinferred5 of 172
outside-root: outside_root_deny beats allow_outside_root: true and absentinferred5 of 172
bash: a background child holding the output pipe does not hang absentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
bash: a background child is not left running after the absentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
bash: a command inside its limit still reports its own exit code absentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
bash: a command that outlives the timeout is killed with its absentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
gh#203: every bundled tool emits only what its outputSchema declaresabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
gh#211: a shell metacharacter in any git argument runs nothingabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
gh#211: option-shaped values are not optionsabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
gh#211: ordinary values still work, taken literallyabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
gh#211: the repository path never reaches a shell eitherabsentinferred4 of 17: directive_type_name, dispatch, execute, serialize_response2
A call that fails identically is refused rather than retried absentinferred5 of 173
Anti-spiral hard block stops dispatch and emits absentinferred5 of 173
Anti-spiral hard block uses derived default when sentinel setabsentinferred5 of 173
Auto approve skips callbackabsentinferred5 of 173
Chained POST_TOOL_CALL hooks: last write winsabsentinferred5 of 173
Circuit breaker at threeabsentinferred5 of 173
Duplicate counter resetsabsentinferred5 of 173
Duplicate detection skipsabsentinferred5 of 173
Error result not cached for dedupabsentinferred5 of 173
Headless mode denies without callbackabsentinferred5 of 173
Max tool calls per turnabsentinferred5 of 173
Multiple tool calls in batchabsentinferred5 of 173
POST_TOOL_CALL fires on duplicate rejection with kindabsentinferred5 of 173
POST_TOOL_CALL fires on schema rejection with kindabsentinferred5 of 173
POST_TOOL_CALL hook transforms duplicate-rejection contentabsentinferred5 of 173
POST_TOOL_CALL hook transforms schema-rejection contentabsentinferred5 of 173
POST_TOOL_CALL hook transforms successful tool result contentabsentinferred5 of 173
POST_TOOL_CALL with *modified_json == NULL leaves content untouchedabsentinferred5 of 173
PRE/POST_TOOL_CALL fire for successful callsabsentinferred5 of 173
PRE_TOOL_CALL cancel short-circuits dispatch and still fires POSTabsentinferred5 of 173
Permission denied returns feedbackabsentinferred5 of 173
Process single tool callabsentinferred5 of 173
Schema validation rejects invalid enum valueabsentinferred5 of 173
Schema validation rejects missing required fieldabsentinferred5 of 173
Tool call history records successful executionsabsentinferred5 of 173
Tool emits directives → ToolExecutor extracts + dispatches themabsentinferred5 of 173
Tool executor processes calls via ServerManagerabsentinferred5 of 173
effective_max_tool_calls_per_turn overrides global limitabsentinferred5 of 173
gh#111: POST_TOOL_CALL hook returning malformed UTF-8 is absentinferred5 of 173
gh#143: an argument-free call serialises as an object absentinferred5 of 173
gh#143: an argument-free call to a no-required-fields tool absentinferred5 of 173
gh#143: dispatch converts a throwing tool into a tool errorabsentinferred5 of 173
gh#168: a rewritten payload carrying bad UTF-8 is sanitized, absentinferred5 of 173
gh#168: the rewrite is visible to the dup cache and POST hookabsentinferred5 of 173
gh#190: a structured JSON error counts as a failure everywhereabsentinferred5 of 173
gh#211: a tier that declares an EMPTY allowlist may call nothingabsentinferred5 of 173
gh#83: allowlisted tool dispatches normallyabsentinferred5 of 173
gh#83: empty locked_tier bypasses enforcementabsentinferred5 of 173
gh#83: no map wired = pass-through (pre-v2.5.2 behavior)absentinferred5 of 173
gh#83: off-allowlist tool is rejected_unauthorized at dispatchabsentinferred5 of 173
gh#83: tier with no allowlist entry is unrestrictedabsentinferred5 of 173
mcp.bash.timeout_seconds reaches the dispatched bash serverabsentinferred5 of 173
process_single_call completes with locked_tier setabsentinferred5 of 173
v2.14.0: schema validation enforces declared minimum and maximumabsentinferred5 of 173
v2.14.6: a headless host still dispatches engine directivesabsentinferred5 of 173
gh#158: a delegated child's read satisfies its parent's write — absentinferred5 of 174
gh#158: a session's tool call never resolves inside another absentinferred5 of 174
gh#158: repeated sandbox swaps race nothing a concurrent absentinferred5 of 174
gh#158: two sessions reading and writing through ONE filesystem absentinferred5 of 174
gh#158: two sessions writing todos through ONE entropic server absentinferred5 of 174
gh#168: a PRE_TOOL_CALL hook's modified args reach the toolabsentinferred5 of 174
gh#168: a malformed modification is refused, not half-appliedabsentinferred5 of 174
gh#168: a modification that renames the tool is refusedabsentinferred5 of 174
gh#168: a non-zero return still cancels, modification or notabsentinferred5 of 174
gh#158: clearing the default conversation releases the default absentinferred5 of 175
gh#158: each session's todo list is its ownabsentinferred5 of 175
gh#158: ending a session's conversation releases its read absentinferred5 of 175
gh#158: read-before-write is judged per session — another absentinferred5 of 175