Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 2.01 KB

L04.md

File metadata and controls

45 lines (33 loc) · 2.01 KB
id course-mcp-tools-l04
type course
title The input_required round-trip
summary A tool can ask the client a question mid-call — return the requests, finish on the retry carrying answers.
lang en-US
content_version 1
status reviewed
reviewed_on 2026-09-12
hints
title body
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`.
title body
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.
title body
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.

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.