Skip to content

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?

  1. GraphQL over HTTP
  2. JSON-RPC 2.0 over stdio (with HTTP+SSE and WebSocket as alternates)
  3. Protocol Buffers over gRPC
  4. 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?

  1. -32700 (Parse error)
  2. -32601 (Method not found)
  3. -32602 (Invalid params)
  4. -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?

  1. The protocol version both sides agree on.
  2. The set of capabilities (tools, resources, prompts) the server exposes.
  3. An auth token for the rest of the session.
  4. 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)

  1. ≈ 20 lines
  2. ≈ 100 lines
  3. ≈ 1 000 lines
  4. ≈ 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.

  1. At the model decoder (via a JSON-Schema mask, Phase 30)
  2. At the agent's tool-call parser (before sending to MCP)
  3. At the MCP server's _handle (before dispatch to the tool function)
  4. Inside the tool function itself (asserting invariants)
Answer **All four.** Each layer catches a different failure mode. Skipping any one pushes the failure to a layer with less context to diagnose it (e.g., missing schema validation in the server turns invalid-params into an internal error, as the Phase 31 `/break` exercise shows).