Skip to content

resource

External Tools with MCP: Solutions Guide

Read the planned learning contract for external tools with MCP in Chapter 13. Review prerequisites and proposed tasks; completed notebooks and solutions are not available yet.

Planned construction brief. The complete lesson, runnable notebooks and checkpoint are not available yet.

PLANNED — construction brief; no completed notebook or solution is published for this chapter.

This slot belongs to the single nineteen-chapter edition. Read the detailed chapter scope in the textbook's Chapter 13. The existing course material for later chapters remains available using its supplied reference runtime; completing it does not demonstrate construction of this missing foundation.

The planned exercises are two independent ninety-minute units. Unit A builds and connects the component from its first principles. Unit B introduces a failure, requires a repair, and tests a changed case. Both will introduce every new library and concept where used, include predictions and progressive hints, and retain the learner's implementation and evidence.

The solutions volume will explain each design decision, show the failed approach and repair, and include independently calculated expectations. The educator materials will include local student and worked copies, preparation instructions, misconception prompts, timing observations and an assessment rubric. These are requirements, not claims of delivery.

Planned learning contract: MCP protocol construction

Starting knowledge and new concepts: The agent/tool loop, durable work and recovery chapters. Introduce client/server, JSON-RPC messages, request IDs, newline framing, protocol negotiation, capabilities, subprocess pipes and timeouts.

Unit A construction: Build a stdio client and a tiny tool server, initialize the connection, discover a read-only tool, validate arguments and invoke it through the existing dispatcher.

MinutesWork
0–10Predict a request and response exchange
10–30Read and write one framed JSON-RPC message
30–60Construct initialization and tool discovery
60–80Connect one validated tool call to the dispatcher
80–90Retain messages and explain capability versus permission

Unit B diagnosis and transfer: Send a mismatched response ID, malformed JSON, a timeout and an unauthorized advertised tool. Repair protocol handling while keeping authority in the dispatcher.

MinutesWork
0–15Retrieve framing and request-correlation rules
15–35Reproduce malformed and mismatched responses
35–60Repair bounded error handling and timeout cleanup
60–80Reject an advertised but unauthorized tool
80–90Explain why MCP does not provide OS containment

Independent acceptance examples: The matching request receives its own result. An unsolicited or mismatched ID cannot satisfy it. A tool advertised by the server does not become authorized by discovery. A timeout leaves an explicit failure and the child process is reaped.

The worked chapter must show the first failing implementation, the specific observation that invalidates it, the repair and a new independently calculated case. It must explain each new library call before relying on it. No answer implementation is supplied yet.

Back to this asset

Keep building with Prof Rod

Found this material through a colleague, classroom or shared download? Get the complete book at profrod.ai/book and join the Prof Rod learner community. Bring one result, one question or one failure you learned from. Share this resource with another learner and keep its source links with it so they can find the full course and future updates.

SOURCE PROVENANCE

Derived from github.com/profrodai/sovereign-agent/blob/5b825f3a58461bce8aba1173acf0b6d175c44b64/book/solutions/ch13/profrod-sovereign-agent-ch13-mcp-tools-solutions-guide.md