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

The input_required round-trip

Checkpoint l0410 ptsgated by test suiteClaude Code 2.x (protocol: MCP 2026-07-28)

A tool can ask the client a question mid-call — return the requests, finish on the retry carrying answers.

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 input_required round-trip

Objective

A tool can ask the client a question mid-call — return the requests, finish on the retry carrying answers.

The lesson

The 2026-07-28 replacement for server-initiated elicitation: a handler raises InputRequired(requests); the server returns resultType “input_required” with the questions; the client retries the same call with params.inputResponses; the handler finishes. Implement it, then verify like an engineer: both verifier directions, the full suite, and a diff review where every change is forced by a test.

Exercise

  • Hand-trace one round-trip with pen and paper before running anything
  • Write the three-line evidence note: verified / not verified / known limits

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

Both suites — the input_required round-trip: a tool can ask the client a question mid-call and finish on the retry carrying params.inputResponses.

Hint 2 — The exception is the mechanism

Raise InputRequired(requests) inside the handler; handle_request catches it and returns resultType: 'input_required' with the requests. The client retries the same call with answers added.

Hint 3 — No state needed

The server stays stateless — the retry is a fresh tools/call whose params.inputResponses carries the answers. Do not stash the pending question.

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 l04.
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 l04, 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":"l04","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 ↗