English · Español
Phase 31 — Quizzes¶
🇪🇸 Espejo legible de
data/quizzes/phase-31-tools-mcp.yaml.
Source of truth: data/quizzes/phase-31-tools-mcp.yaml.
q-31-01 — MCP transport¶
MCP is built on which underlying protocol convention, and what is the default transport for local servers?
- GraphQL over HTTP
- JSON-RPC 2.0 over stdio (with HTTP+SSE and WebSocket as alternates)
- Protocol Buffers over gRPC
- REST over HTTP/2
Answer
**Choice 2.** MCP uses JSON-RPC 2.0 framing. Default transport is stdio (one JSON object per line on stdin/stdout); HTTP+SSE and WebSocket are alternates for non-local servers.q-31-02 — JSON-RPC error codes¶
A tool call with missing required arguments should return which JSON-RPC error code, by convention?
- -32700 (Parse error)
- -32601 (Method not found)
- -32602 (Invalid params)
- -32603 (Internal error)
Answer
**Choice 3 (-32602).** It is the standard code for invalid params. A tool that raises `KeyError` deep inside and falls through to a generic handler ends up returning `-32603` instead — the wrong code, making agents retry instead of give up.q-31-03 — What the MCP handshake guarantees¶
What does the MCP initialize handshake establish before the client can call tools/call?
- The protocol version both sides agree on.
- The set of capabilities (tools, resources, prompts) the server exposes.
- An auth token for the rest of the session.
- Server and client name + version metadata.
Answer
**Choices 1, 2, 4.** Auth is orthogonal: for stdio it relies on process trust; for HTTP transports MCP delegates to OAuth or custom headers.q-31-04 — Minimum LOC for a spec-compliant MCP server¶
Roughly how many lines of stdlib Python (excluding tests) does a spec-compliant MCP server exposing one tool require? (per theory 05-mcp-wire-and-100-line-server.md)
- ≈ 20 lines
- ≈ 100 lines
- ≈ 1 000 lines
- ≈ 10 000 lines (requires a heavy SDK)
Answer
**Choice 2 (~100 lines).** Handshake, dispatch table, tool registration, and standard error handling — all in stdlib, no SDK needed.q-31-05 — Defense-in-depth in tool-call validation¶
Where should JSON-Schema validation of tool-call arguments happen for defense-in-depth? Choose all that apply.
- At the model decoder (via a JSON-Schema mask, Phase 30)
- At the agent's tool-call parser (before sending to MCP)
- At the MCP server's
_handle(before dispatch to the tool function) - Inside the tool function itself (asserting invariants)