Give your agent tools with MCP (Python) · Challenge 02 · 中文版

The JSON-RPC dispatch contract

Checkpoint l0210 ptsself-reported — code from verify.pyClaude Code 2.x (protocol: MCP 2026-07-28)

Valid requests echo their id; invalid ones get -32600; unknown or removed methods get -32601.

Doing this with your agent? One sentence starts the whole course:

Read https://flypython.com/skills/flypython/SKILL.md and start the FlyPython course `mcp-server-in-python`.

The JSON-RPC dispatch contract

Objective

Valid requests echo their id; invalid ones get -32600; unknown or removed methods get -32601.

The lesson

The dispatch rules are small and testable: check jsonrpc and method, preserve id, and answer errors with the right codes. Run the failing dispatch tests first; make them pass in the smallest steps. Use 01-tools-list.json and 04-removed-initialize.json as your fixtures while the agent works.

Exercise

  • Ask the agent why initialize must return -32601 with a message naming the 2026-07-28 removal
  • Reject any diff that touches tests/ or solution/

Checkpoint

The lesson’s commands run, and you can answer these in your own words (the agent asks; you answer — that is the gate):

  1. Which command did this lesson run, and what did it decide?
  2. What failed at the start, and why — in your own words?
  3. Before trusting a similar change next time, what would you check first?

Expected evidence

The command transcript and your answers.

Hints

Stuck? Open one at a time.

Hint 1 — What this checkpoint tests

The dispatch contract: valid requests echo their id, malformed ones get -32600, unknown or removed methods get -32601.

Hint 2 — Version gate

A request carrying _meta.protocolVersion other than 2026-07-28 gets -32600 — requests self-describe their version instead of negotiating it.

Hint 3 — When you are done

You can fill the truth table from memory: good request, bad jsonrpc, unknown method, removed method, wrong version.

Submit

Done? Record it.

The 8-character code verify.py progress printed for this checkpoint — from the browser, or straight from your agent.

Youbrowser

Submit the claim code

Your agentauto-submit

Let the agent solve and submit

Hand it this checkpoint (copy button on hover) — it solves, verifies, and submits on its own:

Work on the FlyPython challenge "Give your agent tools with MCP (Python)" (course id course-mcp-tools), checkpoint l02.
Machine-readable brief: https://flypython.com/api/challenges/mcp-server-in-python
Open the course folder and read TASK.md first — it is the contract.
Rules: smallest change, no new dependencies, never edit tests/ or solution/.
Check with python verify.py until its gates pass, then report each claim code to me.
Target: solve only checkpoint l02, and submit it as soon as it passes.

With a token from your agent page (env FLYPYTHON_TOKEN), it records the result directly:

curl -X POST https://flypython.com/api/claims \
  -H "Authorization: Bearer $FLYPYTHON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"claims":[{"course":"mcp-server-in-python","checkpoint":"l02","code":"<8-char code>"}]}'

Or install the full FlyPython agent skill once and skip the paste.

Files

The starter and verifier

Solving runs on your machine — your agent fetches the course files itself via /api/challenges/mcp-server-in-python/files; you download nothing by hand. Prefer reading the source? Browse the folder on GitHub ↗