--- id: review-001-mcp-tool-fidelity name: MCP tool-gateway runtime fidelity (PRJ-07, PRJ-08, PRJ-09, PRJ-10, PRJ-13) status: pending depends_on: [review-001-schema-internal-visibility] scope: narrow risk: low impact: component level: implementation tags: [adapters, review-001, mcp] --- ## Description Review 001 MCP projection findings in `src/adapters/to_mcp.rs` (the schema-ACL half of the MCP story is review-001-schema-internal-visibility; this task covers the rest of the tool surface): - **PRJ-07**: the `search` tool advertises an optional substring `query` filter but `call_tool` drops `arguments` entirely (`:382`) — an LLM passing `{"query": "fs"}` gets the full unfiltered listing (context waste/overflow in big registries). Honor the filter. - **PRJ-08**: `search` excludes only `Sub`, not `Pub` (`:268-274`), contradicting ADR-068 ("excludes both"). A discovered Pub op can never be invoked via the `call` tool — the advertised discovery surface is a lie for the whole Pub class. (The `"subscription"`/`"Sub"` match arms are dead — `op_type_str` only emits lowercase.) - **PRJ-09**: batch item shape `{"isError", "output"|"error"}` contradicts the tool description ("each shaped like a `call` result") — fix the description or the shape. - **PRJ-10**: `structuredContent` passes output through verbatim, so string/array/null outputs produce non-object `structuredContent` (strict MCP clients may reject; batch returns a top-level array). Wrap or document. - **PRJ-13**: hand-rolled argument errors omit `retryable` (required by the OpenAPI error schemas, always present on `CallError`), and a non-string `operation` reports the misleading "missing required field". Build argument errors in the `CallError` wire shape. ## Acceptance Criteria - [ ] `search` respects a `query` argument (test); `Pub` ops excluded from results (test) - [ ] Batch item doc matches the emitted shape (or shape changed to match — one way or the other, tested) - [ ] Non-object outputs wrapped into objects or documented as an exception; batch shape consistent - [ ] MCP argument errors carry `retryable` and truthful messages - [ ] `cargo test --all-features` passes ## References - docs/reviews/001-initial-implementation-review.md (Part F, PRJ-07..PRJ-10, PRJ-13) - docs/architecture/decisions/041-mcp-tool-gateway-pattern.md - docs/architecture/decisions/068-gateway-publish-endpoint.md ## Notes > Agent fills during implementation. Depends on the visibility task > because both rework the `schema` tool in `to_mcp.rs`. ## Summary > Filled on completion.