Ask the user in the middle of a call

읽는 데 약 65분분 걸린다, 9절에 6개 예제이(가) 있음.

2026.11.14판 예제 통과 2026년 11월 19 70개 예제 중 70개 통과 변경 사항

AI로 번역함. 영어 원문을 사람이 검증함. 우리가 책을 만드는 방식

영어판 2026.11.14판을 번역한 것이다. 원문 읽기

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

By the end of this chapter you can make the shop's refund tool stop in the middle of a call, ask the person at the host to confirm a refund, and carry on with the answer, using Model Context Protocol elicitation inside a Multi Round-Trip Request on a server that keeps no call open while it waits. This chapter's claims are true of revision 2026-07-28 of the specification and of mcp 2.3.0, the Python SDK.

At the shop, where refunds come in as tickets for the support team's host, the refund policy requires a support lead to confirm any refund above €150.00 before it's issued. The shop's API enforces that limit by holding such a refund with the status needs_confirmation. In Design tools a model can use, the issue_refund tool passes that hold back to the model and stops there, so a refund the model was right to make waits until someone finds it in the back office.

The person who could confirm the refund is already at the host, reading the conversation. The tool needs a way to put one question to that person in the middle of the call and carry on with the answer. The Model Context Protocol (MCP) has a name for that, elicitation: a structured question that a server sends and the client shows the user. At the pinned revision, the question travels inside a Multi Round-Trip Request, a pattern in which one call can end with a question instead of a result. The server answers the call with an input request instead of a result, and the client calls again with the answer.

Each server example in this chapter runs itself, as the earlier chapters' examples do. Run with no arguments, the file starts a client, and that client launches the same file with --serve over stdio. The shop's API runs on loopback beside them.

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

See why a stateless server can't wait for an answer

마지막으로 변경된 판: 2026.11.14판

Before the pinned revision, a server that needed the user's input sent its own request to the client, elicitation/create, and waited for the reply while the tool call stayed open. The pinned revision removed that pattern. The specification says servers MUST send their requests to the client, elicitation/create among them, through the Multi Round-Trip Request pattern. It calls the old pattern a breaking change that is no longer supported (Multi Round-Trip Requests). Elicitation is one of the requests this chapter uses, and it isn't deprecated. The other two, sampling/createMessage and roots/list, are deprecated, and Replace sampling, roots and logging gives their replacements: a direct call to a model provider's API, and tool parameters, resource URIs or server configuration (deprecated features).

The reason is statelessness. At the pinned revision there's no handshake and no session, and each request carries its own version and capabilities in _meta (Carry the version and capabilities on every request). A request that waits on a reply from the client ties one server process to one open connection for as long as a person takes to answer. The specification's aim is a server that can ask for input without a shared storage layer across server instances or stateful load balancing (Multi Round-Trip Requests). The proposal behind the change, SEP-2322, says that Streamable HTTP then depends less on long-lived streams, which cause problems in many environments (SEP-2322).

The Python SDK still offers the old call. ctx.elicit() sends elicitation/create as a request from the server, and on a connection at the pinned revision it fails with NoBackChannelError, an Invalid Request error, because the protocol forbids server-initiated requests there (mcp/shared/transport_context.py, mcp/shared/exceptions.py).

The first attempt at a confirmation is written that way. Its server takes chapter 3's tools from a shared module, lib.confirmations, which holds what this chapter's servers have in common: those tools, the key that protects round-trip state, and a record of answers already used. Its issue_refund calls chapter 3's version, which posts the refund to the shop's API. If the API holds the refund, the tool calls ctx.elicit() and waits. The client has an elicitation callback that plays a scripted user, who would release the refund if asked. The client quotes order O-2289, whose whole refund is above the limit, and calls issue_refund.

refund-needs-confirmation.py Python 3.12.15 · cryptography 50.0.2 · httpx2 2.16.2 · jsonschema 4.26.0 · mcp 2.3.0 · mcp-types 2.3.0 · pydantic 2.14.3 · starlette 1.10.0 · uvicorn 0.54.0 통과
"""The 2025 way to confirm a refund, which fails at revision 2026-07-28: issue_refund calls ctx.elicit() and waits,but the protocol gives the server no channel back to the client. The printed error code and the count of questionsthe user saw show the failure, before anyone is asked."""import asyncioimport sysfrom mcp import Client, MCPErrorfrom mcp.server.mcpserver import Contextfrom mcp.types import ElicitResultfrom pydantic import BaseModelfrom lib import confirmations, loopback, shop_api, shop_toolsserver, held = confirmations.shop_server()     # chapter 3's other tools; held is chapter 3's issue_refundasked = []                                     # every question that reached the userclass Release(BaseModel):    release: bool@server.tool(title="Issue a refund", description=shop_tools.DESCRIPTIONS["issue_refund"], annotations=held.annotations)async def issue_refund(quote_id: confirmations.QuoteId, ctx: Context) -> shop_tools.Refund:    refund = held.fn(quote_id)    if refund.status == "needs_confirmation":   # ask, and hold the call open until the answer comes back        answer = await ctx.elicit(f"Refund {refund.amount} on order {refund.order_id}?", Release)        if answer.action == "accept" and answer.data.release:            return confirmations.release(refund)    return refundasync def say_yes(context, params) -> ElicitResult:   # a scripted user, who would release the refund    asked.append(params.message)    return ElicitResult(action="accept", content={"release": True})async def main() -> None:    with loopback.serve(shop_api.create_app()) as base_url:        async with Client(confirmations.launch(__file__, base_url), elicitation_callback=say_yes) as client:   # starts this file with --serve            print("protocol revision:", client.protocol_version)            quote = (await client.call_tool("quote_refund", {"order_id": "O-2289"})).structured_content            try:                await client.call_tool("issue_refund", {"quote_id": quote["quote_id"]})            except MCPError as error:                print("error code:", error.error.code)                print("error message:", error.error.message)            print("questions the user saw:", len(asked))server.run() if "--serve" in sys.argv else asyncio.run(main())   # the client runs this file with --serve; run directly, it starts the client
출력python refund-needs-confirmation.py
protocol revision: 2026-07-28
error code: -32600
error message: Cannot send 'elicitation/create': this transport context has no back-channel for server-initiated requests.
questions the user saw: 0

The call failed with JSON-RPC error -32600, Invalid Request, and the message "Cannot send 'elicitation/create': this transport context has no back-channel for server-initiated requests." The scripted user was asked 0 questions. Nobody saw the refund. Because the failure is a protocol error, not a tool result, the model never saw it either (Report failures as tool results). The refund stays held in the shop's API, as it did in chapter 3.

The tool's own logic isn't what failed. It asked the protocol for something the pinned revision doesn't have, a channel from server to client in the middle of a call. Any code that waits inside a tool call for an answer runs into the same wall, whatever SDK it uses.

Working rule: Never wait inside a tool call for something only the client can give you. On a connection at the pinned revision, treat every call to ctx.elicit() or ctx.elicit_url() as a bug, and return an input request instead, as the next section does. Keep the old call only on a server that must also answer 2025-era clients, and only behind a check of ctx.protocol_version (Serve old and new clients through the window).

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

Return an input request instead of a result

마지막으로 변경된 판: 2026.11.11판

The call that failed in the previous section needed a channel the protocol doesn't have. A Multi Round-Trip Request turns the question around. Instead of a result, the server returns an InputRequiredResult, whose resultType is "input_required", and the call ends there. Two fields carry the rest. inputRequests maps keys the server chooses to the requests it needs answered, and requestState is an opaque string the client must send back. The server MUST include at least one of the two (Multi Round-Trip Requests; schema, InputRequiredResult).

Three rules limit what a server may ask, and when. Only tools/call, prompts/get and resources/read may answer with an input request, and servers MUST NOT send one on any other request. A server MUST NOT include an elicitation/create request unless the client declared the elicitation capability (Multi Round-Trip Requests). And because every result at the pinned revision carries resultType, a client treats a missing one, which an older server sends, as "complete", and treats any other unrecognized value as invalid (overview).

issue_refund still calls chapter 3's version first, so the shop's API decides, with the policy's limit, whether a refund needs confirming, and the server never repeats the limit. Within one server process, chapter 3's tool returns the same refund for the same quote_id every time, which makes calling it on every round safe. Across processes, that doesn't hold, as What goes wrong in production explains under "Records that only one process sees." When the API holds the refund, the tool checks that the client declared form-mode elicitation, then builds the input request by hand: one ElicitRequest under the key confirm, whose form is one required yes-or-no field, release, and whose message names the amount and the order. Its requestState is the refund's ID. When the retry arrives, the tool checks that the state names the refund it found, and it uses the state as the key of its record of answers.

The server passes request_state_security= to MCPServer, with the policy that confirmations.state_security() builds, so that several replicas can later share one key. In these examples that policy is the SDK's default, a key made when the process starts. A client declares elicitation by passing a callback, and calls the tool through client.session.call_tool(..., allow_input_required=True), which hands back the input request instead of answering it.

refund-asks-to-confirm.py Python 3.12.15 · cryptography 50.0.2 · httpx2 2.16.2 · jsonschema 4.26.0 · mcp 2.3.0 · mcp-types 2.3.0 · pydantic 2.14.3 · starlette 1.10.0 · uvicorn 0.54.0 통과
"""issue_refund answers a held refund with an input request instead of a result, which asks a person to confirm it.The prose's points rest on the result type line, the one input request under confirm with its message, and theassert, which fails the run if the SDK doesn't seal the request state."""import asyncioimport sysfrom mcp import Clientfrom mcp.server.mcpserver import Contextfrom mcp.server.mcpserver.exceptions import ToolErrorfrom mcp.types import ElicitRequest, ElicitRequestFormParams, InputRequiredResultfrom lib import confirmations, loopback, shop_api, shop_toolsserver, held = confirmations.shop_server()     # chapter 3's other tools; held is chapter 3's issue_refundanswered = confirmations.OnceOnly()            # the round-trip states already answered, so a replayed answer fails@server.tool(title="Issue a refund", description=shop_tools.DESCRIPTIONS["issue_refund"], annotations=held.annotations)def issue_refund(quote_id: confirmations.QuoteId, ctx: Context) -> shop_tools.Refund | InputRequiredResult:    refund = held.fn(quote_id)                 # the same quote_id always gives the same refund    if refund.status != "needs_confirmation":        return refund    answer = (ctx.input_responses or {}).get("confirm")   # the answer comes back under the key the tool asked with    if answer is None or ctx.request_state != refund.refund_id:   # first round, or a question never asked        confirmations.require_elicitation(ctx, "form")     # ask only what the client declared it can show        ask = ElicitRequestFormParams(requested_schema=confirmations.RELEASE_FORM, message=f"Refund {refund.amount} on "                                      f"order {refund.order_id}? It is above the policy limit, so a lead must confirm it.")        return InputRequiredResult(input_requests={"confirm": ElicitRequest(params=ask)},                                   request_state=refund.refund_id)   # the refund's ID rides in the state the SDK seals    if answer.action != "accept" or not (answer.content or {}).get("release"):        raise ToolError(f"Nobody confirmed refund {refund.refund_id}, so the shop's API still holds it.")    if not answered.claim(ctx.request_state):              # sealing can't stop a replay; this record does        raise ToolError(f"Refund {refund.refund_id} was already confirmed. Don't send the same answer again.")    return confirmations.release(refund)async def main() -> None:    with loopback.serve(shop_api.create_app()) as base_url:        async with Client(confirmations.launch(__file__, base_url),   # starts this file with --serve over stdio                          elicitation_callback=confirmations.say_yes) as client:      # declares elicitation            quote = (await client.call_tool("quote_refund", {"order_id": "O-2289"})).structured_content            result = await client.session.call_tool("issue_refund", {"quote_id": quote["quote_id"]},                                                     allow_input_required=True)   # return the input request, not an answer to it            print("result type:", result.result_type)            for key, request in result.input_requests.items():                print(f"input request {key}:", request.method, request.params.mode)                print("message:", request.params.message)            # the SDK's sealed-token prefix: a request state that starts with it was sealed on its way out            assert result.request_state.startswith("v1.")server.run() if "--serve" in sys.argv else asyncio.run(main())   # the client runs this file with --serve; run directly, it starts the client
출력python refund-asks-to-confirm.py
result type: input_required
input request confirm: elicitation/create form
message: Refund 180.00 on order O-2289? It is above the policy limit, so a lead must confirm it.

The call came back with result type input_required, and its one input request is elicitation/create form. The message reads "Refund 180.00 on order O-2289? It is above the policy limit, so a lead must confirm it." That is the question the host's user would see.

The question goes to whoever sits at the host, so the answer is only as trustworthy as the host. An accept doesn't show that a support lead answered, or that a person did at all, since this chapter's scripted callbacks answer by code. Servers MUST also bind elicitation requests to the client and user identity, the specification adds (elicitation). Over stdio, as here, the user is the host's local user, who launched the server, and the server has no other identity to bind to, so the shop trusts the host to put the question to a lead. Over HTTP, the server binds the question to the authenticated caller, and the SDK's seal already includes the OAuth caller, so another user's retry fails. A server that needs a lead also checks for refunds:write, the scope only support leads hold, which already gates issue_refund (Scope tools by what the token allows; Draw the trust boundaries).

The requestState the client received isn't the refund ID the tool returned. The example asserts that the string starts with the SDK's v1. token prefix, so the SDK sealed it on its way out. MCPServer encrypts every outgoing requestState with AES-256-GCM and verifies each one that comes back. The seal binds it to the method, the tool's name, a digest of the arguments, the server's name and, when OAuth is in use, the caller (mcp/server/request_state.py). The tool itself reads and writes plaintext, while the client receives a token it can neither read nor change. The specification says clients MUST NOT inspect, parse, modify or make assumptions about requestState (Multi Round-Trip Requests), and the seal makes that hold whatever a client intends.

After this answer, nothing waits on the server. No call stays open, and no connection is held for the lead. The shop's API still holds the refund, as it did before the tool asked, and if no one ever answers, it stays held. For a step that pays money out, that is the safe default.

Between the rounds, the server keeps two records, both in its own memory. The retry finds the refund through chapter 3's quote store, not through the state, and checks the answer against the record of answered states that Keep round-trip state tamper-proof explains. A retry that reaches another process finds neither record, and Run replicas without sticky sessions moves both into storage every replica shares.

Working rule: When a tool can't finish without the user, return an InputRequiredResult with one input request per question and a requestState that says what the retry must finish. Check the client's declared capabilities before you ask. Put in the state only what the tool needs to carry on, and let the SDK seal it. Make every side effect before the question either idempotent or harmless when no one answers, because the client may never call again.

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

Resume the call with the answer

마지막으로 변경된 판: 2026.11.11판

The input request in the previous section ended the first call, so the client finishes the work by sending the same request again. The retry repeats the method, the tool and the arguments, adds inputResponses keyed like the input requests, and echoes the requestState back exactly. The specification says the JSON-RPC id MUST be different on the retry, because the two calls are independent requests, and that a requestState MUST NOT be used for any other request the client sends (Multi Round-Trip Requests). The server may then finish, or answer with another input request.

The second round is where a lead's yes becomes a refund. The tool from the previous section reads the answer under confirm in ctx.input_responses, gets the refund again from chapter 3's tool, and checks that ctx.request_state holds that refund's ID. Only an accept with release set makes it ask the shop's API to release the held refund, POST /refunds/{refund_id}/confirm, and return the refund. Anything else leaves the refund held.

The loop runs twice, once by hand and once through the SDK. The file launches the server through lib.wire, the book's relay that records every JSON-RPC message, and plays the lead with a scripted answer. For order O-2289 it drives the loop by hand: one call, then one retry carrying the answer and the state. For order O-1145 it calls Client.call_tool, with an elicitation callback that prints the question and answers yes.

refund-confirmed-round-trip.py Python 3.12.15 · cryptography 50.0.2 · httpx2 2.16.2 · jsonschema 4.26.0 · mcp 2.3.0 · mcp-types 2.3.0 · pydantic 2.14.3 · starlette 1.10.0 · uvicorn 0.54.0 통과
"""Finish the refund that refund-asks-to-confirm asks about, by retrying with the answer and the echoed requestState:first by hand, so both requests show on the wire, then with Client.call_tool, which runs the loop itself. The pointrests on the trace lines, which show two requests each time, with different IDs, and only the retry sending the answer."""import asyncioimport pathlibfrom mcp import Clientfrom mcp.types import ElicitResultfrom lib import confirmations, loopback, shop_api, wireLOG = pathlib.Path("refund-confirmed-round-trip.jsonl")             # every line the relay copiesYES = ElicitResult(action="accept", content={"release": True})    # the scripted user's answerasync def say_yes(context, params) -> ElicitResult:    print("user was asked:", params.message)    return YESasync def main() -> None:    LOG.unlink(missing_ok=True)    with loopback.serve(shop_api.create_app()) as base_url:        server = wire.relay(confirmations.launch("refund-asks-to-confirm.py", base_url), log=str(LOG))   # the relay copies each message to LOG        async with Client(server, elicitation_callback=say_yes) as client:            quote = (await client.call_tool("quote_refund", {"order_id": "O-2289"})).structured_content            arguments = {"quote_id": quote["quote_id"]}            first = await client.session.call_tool("issue_refund", arguments, allow_input_required=True)   # the input request, not a result            # the retry repeats the arguments, adds the answer under the request's key, and echoes the state back            done = await client.session.call_tool("issue_refund", arguments, input_responses={"confirm": YES},                                                  request_state=first.request_state, allow_input_required=True)            print("by hand:", done.structured_content["refund_id"], done.structured_content["status"])            quote = (await client.call_tool("quote_refund", {"order_id": "O-1145"})).structured_content            done = await client.call_tool("issue_refund", {"quote_id": quote["quote_id"]})            print("by Client.call_tool:", done.structured_content["refund_id"], done.structured_content["status"])    calls, results = [], {}                     # the issue_refund requests, in order, and each one's resultType    for direction, message in wire.read_trace(str(LOG)):        if message.get("method") == "tools/call" and message["params"]["name"] == "issue_refund":            calls.append(message)        elif direction == "in" and "result" in message:   # a server's response, matched to its request by JSON-RPC id            results[message["id"]] = message["result"]["resultType"]    for label, message in zip(["by hand, call", "by hand, retry", "Client.call_tool, call", "Client.call_tool, retry"],                              calls):        sent = " and ".join(key for key in ("inputResponses", "requestState") if key in message["params"])        print(f"{label}: id {message['id']}, sends {sent or 'arguments only'}, gets {results[message['id']]}")    LOG.unlink()asyncio.run(main())
출력python refund-confirmed-round-trip.py
by hand: R-0111 requested
user was asked: Refund 343.49 on order O-1145? It is above the policy limit, so a lead must confirm it.
by Client.call_tool: R-0112 requested
by hand, call: id 4, sends arguments only, gets input_required
by hand, retry: id 5, sends inputResponses and requestState, gets complete
Client.call_tool, call: id 7, sends arguments only, gets input_required
Client.call_tool, retry: id 8, sends inputResponses and requestState, gets complete

Driving the loop by hand works, and the trace shows the two requests behind it. The refund for order O-2289 came back as R-0111 requested, where requested is the status of a released refund, no longer held. The first call was id 4, sends arguments only, gets input_required, and the retry was id 5, sends inputResponses and requestState, gets complete. The two JSON-RPC IDs differ, and only the retry carries the answer and the state.

Client.call_tool hid the same loop. Its callback was asked "Refund 343.49 on order O-1145? It is above the policy limit, so a lead must confirm it." and answered yes, the call returned R-0112 requested, and the caller saw one call and one result. The wire still carried two requests: id 7, sends arguments only, gets input_required, then id 8, sends inputResponses and requestState, gets complete. The SDK's client sends each input request to the matching callback, retries with the answers and the state, and stops after input_required_max_rounds, 10 by default, raising InputRequiredRoundsExceededError (mcp/client/_input_required.py). A round that carries only a requestState, with no questions, is also legal. The schema's example of one is titled load shedding (schema). For such a round the SDK's client waits 50 milliseconds before retrying, doubling the wait each time up to 250 milliseconds.

A retry repeats the original request, so it isn't a fresh tool call. In the SDK, the digest of the arguments sits inside the sealed state, so a retry that changes them fails, as Keep round-trip state tamper-proof shows. A client that wants different arguments makes another call and gets another question.

Working rule: Use Client.call_tool with an elicitation callback in a host, and let the SDK run the rounds. Drive the loop yourself with client.session.call_tool(..., allow_input_required=True) only when the host must keep the state across a restart or show each round, and then repeat the arguments exactly. On the server, read the answer and the state together. When your server always sends a state, treat an answer that arrives without it, or with a state for another record, as a question never asked.

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

Ask for structured input with elicitation

마지막으로 변경된 판: 2026.11.14판

The confirmation in the previous section asks one yes-or-no question, and elicitation can ask for more. It has two modes (elicitation). In form mode, the server sends a message and a schema, the client renders a form, and the answer returns through the client. In URL mode, the server sends the user to a web page, not a form (the next subsection).

A form's schema is a flat object with primitive properties only: strings, including the formats email, uri, date and date-time; numbers and integers; booleans; and single- or multiple-choice enums. Any of these can carry a default. The user answers accept with the content, decline for an explicit no, or cancel for a dismissed form. Servers MUST handle both refusals. The client MUST show which server is asking, offer decline and cancel, and let the user review a form before it's sent (elicitation; Answer input requests for the user).

The SDK offers a shorter route. A tool parameter declared as Annotated[T, Resolve(fn)] is filled by running fn. When fn returns Elicit(message, Model), the SDK renders the pydantic model as the form, checks the client's capability, returns the input request, and fills it in on the retry. Annotate the parameter as ElicitationResult[Model] and the tool receives all three outcomes to branch on. A plain Model turns decline and cancel into a tool error (mcp/server/mcpserver/resolve.py).

Only the person who opens a returned parcel knows whether the item inside arrived damaged or wrong, and whether it can go back on sale. The policy's reason also decides whether shipping is refunded. The tool record_return asks with a resolver, for the line of KG-1043 on order O-1145. The form has three fields: reason, one of the refund policy's five reasons; restock, a boolean; and an optional free-text note of at most 200 characters. A scripted user accepts, declines, then cancels, and a client without a callback calls last.

elicit-a-refund-reason.py Python 3.12.15 · mcp 2.3.0 · pydantic 2.14.3 통과
"""record_return asks the person who opened a returned parcel what they found, through a form that a resolver buildsand sends. The point rests on the three answer lines, accept, decline and cancel, and on the error a client withoutan elicitation callback gets, which names a missing capability rather than a tool failure."""import asynciofrom typing import Annotated, Literalfrom mcp import Client, MCPErrorfrom mcp.server.mcpserver import AcceptedElicitation, Elicit, ElicitationResult, MCPServer, Resolvefrom mcp.types import ElicitResultfrom pydantic import BaseModel, Fieldserver = MCPServer("shop-returns", version="0.5.0")Reason = Literal["damaged in transit", "wrong item sent", "missing part", "arrived late", "changed mind"]   # the refund policy's five reasonsclass Inspection(BaseModel):          # the form: a flat object with primitive fields only    reason: Reason = Field(description="The refund policy's reason that fits what you found")    restock: bool = Field(description="The item can go back on sale")    note: str | None = Field(default=None, max_length=200, description="Anything the refund should say")   # a default makes the field optional on the formdef ask(order_id: str, sku: str) -> Elicit[Inspection]:    return Elicit(f"You opened the return of {sku} from order {order_id}. What did you find?", Inspection)@server.tool(description="Record what a returned item was like when its parcel was opened. The user fills in a form.")def record_return(order_id: str, sku: str, found: Annotated[ElicitationResult[Inspection], Resolve(ask)]) -> str:   # the SDK runs ask(), sends the form as an input request, and fills found in on the retry    if isinstance(found, AcceptedElicitation):        return f"Recorded: {found.data.reason}, restock {found.data.restock}."    return ("The user declined: don't record this return, and don't ask again." if found.action == "decline"            else "The user closed the form without answering: ask again later.")SCRIPT = [ElicitResult(action="accept", content={"reason": "damaged in transit", "restock": False}),          ElicitResult(action="decline"), ElicitResult(action="cancel")]       # the scripted user's three answersforms = []                                                                     # each form the user was shownasync def scripted_user(context, params) -> ElicitResult:    forms.append(params.requested_schema)    return SCRIPT.pop(0)async def main() -> None:    arguments = {"order_id": "O-1145", "sku": "KG-1043"}    async with Client(server, elicitation_callback=scripted_user) as client:        for action in ("accept", "decline", "cancel"):            print(f"{action}:", (await client.call_tool("record_return", arguments)).content[0].text)    print("form fields:", ", ".join(forms[0]["properties"]))    print("required:", ", ".join(forms[0]["required"]))    async with Client(server) as client:            # no elicitation_callback, so no elicitation capability        try:            await client.call_tool("record_return", arguments)        except MCPError as error:            print("client without elicitation:", error.error.code)asyncio.run(main())
출력python elicit-a-refund-reason.py
accept: Recorded: damaged in transit, restock False.
decline: The user declined: don't record this return, and don't ask again.
cancel: The user closed the form without answering: ask again later.
form fields: reason, restock, note
required: reason, restock
client without elicitation: -32021

The pydantic model gives note a default, so it's the only optional field. The client received the fields reason, restock, note, and only reason, restock are required.

Each string tells the model what to do next. Accept gave "Recorded: damaged in transit, restock False." Decline gave "The user declined: don't record this return, and don't ask again." Cancel gave "The user closed the form without answering: ask again later." A decline stands, and a cancel leaves the question open.

A client without a callback declares no elicitation capability, so the SDK refuses its call with JSON-RPC error -32021, Missing Required Client Capability, before the tool runs (mcp/server/mcpserver/resolve.py). The shop's issue_refund makes the same check by hand.

Working rule: Use form mode for answers only the person at the host can give, and keep each form to the few fields the tool acts on, with enums wherever the answer is one of a known set. Declare forms with a resolver and a pydantic model, and take ElicitationResult when decline and cancel should lead different ways. Build the input request by hand only when you need to control the state yourself.

민감한 단계는 URL로 보내기

마지막으로 변경된 판: 2026.11.11판

폼의 응답은 클라이언트를 거치며, 모델의 눈앞을 지나갈 수도 있다. 서버는 비밀번호, API 키, 액세스 토큰, 결제 자격 증명에 폼 모드를 사용해서는 안 되며(MUST NOT), 이런 정보에는 URL 모드를 사용해야 한다(MUST) (elicitation). URL 모드는 메시지와 URL을 보낸다. 클라이언트는 URL이나 그 메타데이터를 미리 가져와서는 안 되고(MUST NOT), 사용자의 명시적인 동의 없이 URL을 열어서는 안 되며(MUST NOT), 전체 URL을 보여 주어야 한다(MUST). 페이지는 클라이언트와 모델 모두 내용을 볼 수 없는 방식으로 열린다. 서버는 개인 데이터와 자격 증명을 URL에 담지 않고, 그 자체로 사용자를 로그인시키는 URL을 보내지 않으며, 흐름을 완료하는 사용자가 흐름을 시작한 사용자와 같은 사람인지 반드시 확인해야 한다(MUST).

URL 모드는 클라이언트가 MCP 서버에 대한 인가를 받는 방법이 아니다. 그에 대해서는 리소스에서 인가 서버 찾기에서 다룬다. URL 모드는 서드파티 서비스나 결제처럼 서버 자체의 필요를 위한 것이다. URL 모드에서 accept는 사용자가 상호작용에 동의했다는 뜻일 뿐, 상호작용이 끝났다는 뜻이 아니다(elicitation). 고정된 리비전에서는 elicitationId 필드와 notifications/elicitation/complete 알림이 제거되었다. 재시도에 걸쳐 흐름을 대응시켜야 하는 서버에 대해 변경 기록이 권하는 방법은 자체 식별자를 requestState에 인코딩하는 것이다(changelog).

환불 지급은 보류 해제(release) 이후에 이루어진다. pay_refund는 상태가 requested인, 해제된(released) 환불을 주문의 카드로 되돌려 지급하며, 공급자는 담당자 본인의 계정으로 공급자의 페이지에서 로그인한 경우에만 지급한다. 이 도구는 흐름을 위한 무작위 ID를 만들어 requestState에 넣고, 담당자를 https://pay.fernhill.example/connect/ 뒤에 그 ID를 붙인 주소로 보낸다. 이 도메인은 해석되지 않는 예약 도메인이다. 메모리 안의 집합이 공급자의 완료된 흐름 기록을 대신하며, 예제는 세 번째 호출 전에 이 흐름을 그 집합에 추가한다.

elicit-by-url.py Python 3.12.15 · cryptography 50.0.2 · httpx2 2.16.2 · jsonschema 4.26.0 · mcp 2.3.0 · mcp-types 2.3.0 · pydantic 2.14.3 · starlette 1.10.0 · uvicorn 0.54.0 통과
"""pay_refund sends the support lead to the payment provider's page to connect an account, through URL mode, so thesign-in stays out of the client. The point rests on the after-accept line, which still asks, and the after-sign-inline, which completes only once the provider has recorded the flow as finished."""import asyncioimport secretsfrom mcp import Clientfrom mcp.server.mcpserver import Context, MCPServerfrom mcp.types import ElicitRequest, ElicitRequestURLParams, ElicitResult, InputRequiredResultfrom lib import confirmationsserver = MCPServer("shop-payments", version="0.5.0")finished: set[str] = set()     # flows the payment provider reports finished; it would tell the server, not the client@server.tool(description="Pay out a released refund through the shop's payment provider, by its refund_id.")def pay_refund(refund_id: str, ctx: Context) -> str | InputRequiredResult:    flow = ctx.request_state or secrets.token_urlsafe(16)    # the server's own ID for this flow, carried in requestState; 16 random bytes, so it can't be guessed    if flow in finished:        return f"Paid {refund_id} through the payment provider"    answer = (ctx.input_responses or {}).get("connect")    if answer is not None and answer.action != "accept":        return f"Not paid: the user didn't connect a payment account. {refund_id} stays released, unpaid."    confirmations.require_elicitation(ctx, "url")    ask = ElicitRequestURLParams(url=f"https://pay.fernhill.example/connect/{flow}",                                 message="To pay refunds, connect your payment provider account on its own page.")    return InputRequiredResult(input_requests={"connect": ElicitRequest(params=ask)}, request_state=flow)async def main() -> None:    async with Client(server, elicitation_callback=confirmations.say_yes) as client:   # declares form and url        def call(state=None, answers=None):            return client.session.call_tool("pay_refund", {"refund_id": "R-0111"}, input_responses=answers,                                            request_state=state, allow_input_required=True)        first = await call()        request = first.input_requests["connect"].params        print("first call:", first.result_type, request.mode)        print("url:", request.url.rsplit("/", 1)[0] + "/…")   # cut before the last slash, so the flow's ID isn't printed        accepted = {"connect": ElicitResult(action="accept")}     # the scripted user agrees to open the page        second = await call(first.request_state, accepted)        print("after accept:", second.result_type, second.input_requests["connect"].params.mode)        finished.add(request.url.rsplit("/", 1)[1])               # the flow's ID is what follows the last slash; the provider records it when the lead signs in        third = await call(second.request_state, accepted)        print("after sign-in:", third.result_type, third.content[0].text)asyncio.run(main())
출력python elicit-by-url.py
first call: input_required url
url: https://pay.fernhill.example/connect/…
after accept: input_required url
after sign-in: complete Paid R-0111 through the payment provider

첫 번째 호출은 input_required url를 반환했으며, URL은 https://pay.fernhill.example/connect/…였다. 이 URL은 무작위 ID 앞에서 잘려 있다. 스크립트로 정해 둔 사용자가 수락한 뒤에도 재시도는 여전히 input_required url를 반환했다. 수락은 담당자가 페이지를 여는 데 동의했다는 뜻일 뿐이기 때문이다. 공급자가 로그인을 기록한 뒤의 다음 재시도에서는 complete Paid R-0111 through the payment provider가 나왔다.

예제는 로그인하는 사람이 요청받은 사람과 같은지 확인하는 검사를 생략한다. 그 검사에는 PKCE로 토큰 받기에서 얻는 호출자의 신원이 필요하다.

작업 규칙: 비밀인 것과 사람을 다른 서비스에 로그인시키는 것은 모두 폼이 아니라 URL 모드로 보낸다. 흐름 자체의 ID를 requestState에 넣고, accept는 "사용자가 페이지로 갔다"는 뜻으로 취급하며, 흐름이 끝났는지는 재시도할 때마다 서버 자체의 기록으로 판단한다. 흐름을 마치는 사람이 흐름을 시작한 사람과 같은지 확인한다.

왕복 상태를 변조할 수 없게 유지하기

마지막으로 변경된 판: 2026.11.11판

답변으로 호출 재개하기에서 확정된 환불은 클라이언트가 받은 requestState를 그대로 돌려준다는 전제에 기대고 있었는데, 클라이언트가 정직해야 할 의무는 없다. 명세는 requestState를 공격자가 제어하는 입력으로 취급하며, 서버도 그렇게 취급해야 한다(MUST). 상태가 권한 부여, 리소스 접근 또는 비즈니스 로직에 영향을 준다면, 서버는 그 무결성을 보호해야 하며(예: HMAC 또는 AEAD) 검사를 통과하지 못한 상태는 거부해야 한다(MUST). 재전송을 줄이기 위해 서버는 또한 상태를 인증된 사용자에 묶고, 짧은 만료 시간을 두고, 상태가 만들어진 요청에 연결하는 것이 좋다(SHOULD). 그렇다고 이 중 어느 것도 상태를 일회용으로 만들지는 않는다. 상태를 최대 한 번만 사용해야 하는 서버는 그 불변식을 서버 쪽에서 강제해야 한다(MUST) (Multi Round-Trip Requests).

SDK의 봉인(seal)은 첫 번째 부분을 처리하며, 클라이언트에게는 가능한 한 적은 정보만 알려 준다. 토큰이 변경되었든, 만료되었든, 다른 요청이나 호출자의 것이든, 알 수 없는 키를 사용하든, 클라이언트는 동일한 JSON-RPC 오류인 -32602, "Invalid or expired requestState"를 받는다. 실제 이유는 서버의 로그(mcp/server/request_state.py)에만 남으므로, 클라이언트는 실패한 시도에서 아무것도 알아내지 못한다. 그러나 봉인은 이미 받아들인 토큰의 기록을 남기지 않으므로, 두 번째 부분은 서버의 몫이다.

재전송된 확정은 돈이 두 번 나간다는 뜻이므로, 도구는 이를 거부해야 한다. 이번에는 클라이언트가 답변으로 호출 재개하기의 재시도를 세 가지 방식으로 잘못 보낸 다음, 올바르게 한 번 보내고, 다시 올바르게 한 번 더 보낸다.

  1. 봉인된 requestState의 문자 하나를 바꾸어 보낸다.
  2. 스크립트된 리드의 '예'는 있지만 상태는 없이 보낸다. 서버가 보낸 적 없는 질문에 답하는 것과 같다.
  3. 올바른 상태에 다른 견적의 quote_id를 붙여 보낸다.
  4. 정직한 재시도로 보낸다.
  5. 같은 정직한 재시도를 두 번째로 보낸다.
tampered-round-trip-state.py Python 3.12.15 · cryptography 50.0.2 · httpx2 2.16.2 · jsonschema 4.26.0 · mcp 2.3.0 · mcp-types 2.3.0 · pydantic 2.14.3 · starlette 1.10.0 · uvicorn 0.54.0 통과
"""Send issue_refund's retry wrongly, then rightly, then again: a changed requestState, an answer with no state, and astate with other arguments; then an honest retry, and its replay. The seal refuses the changed and the mismatched state,the tool asks again for the answer with no state, and its own once-only record refuses the replay."""import asynciofrom mcp import Client, MCPErrorfrom mcp.types import ElicitResultfrom lib import confirmations, loopback, shop_apiYES = ElicitResult(action="accept", content={"release": True})     # the scripted user's answerasync def retry(client: Client, label: str, quote_id: str, state: str | None) -> None:    try:        result = await client.session.call_tool("issue_refund", {"quote_id": quote_id}, input_responses={"confirm": YES},                                                request_state=state, allow_input_required=True)    except MCPError as error:        print(f"{label}:", error.error.code, error.error.message)        return    if result.result_type == "input_required":        print(f"{label}: input_required, the server asks again")    elif result.is_error:        print(f"{label}: tool error,", result.content[0].text)    else:        print(f"{label}: refund", result.structured_content["refund_id"], result.structured_content["status"])async def main() -> None:    with loopback.serve(shop_api.create_app()) as base_url:        async with Client(confirmations.launch("refund-asks-to-confirm.py", base_url),                          elicitation_callback=confirmations.say_yes) as client:            quotes = [(await client.call_tool("quote_refund", {"order_id": order})).structured_content["quote_id"]                      for order in ("O-2289", "O-1145")]            first = await client.session.call_tool("issue_refund", {"quote_id": quotes[0]}, allow_input_required=True)            state = first.request_state            # swaps the character at index 20 for another, so the seal no longer matches the token            changed = state[:20] + ("A" if state[20] != "A" else "B") + state[21:]            await retry(client, "one character changed", quotes[0], changed)            await retry(client, "answer without state", quotes[0], None)            await retry(client, "state with other arguments", quotes[1], state)            await retry(client, "honest retry", quotes[0], state)            await retry(client, "same retry again", quotes[0], state)asyncio.run(main())
출력python tampered-round-trip-state.py
one character changed: -32602 Invalid or expired requestState
answer without state: input_required, the server asks again
state with other arguments: -32602 Invalid or expired requestState
honest retry: refund R-0111 requested
same retry again: tool error, Error executing tool issue_refund: Refund R-0111 was already confirmed. Don't send the same answer again.

변경된 토큰은 -32602 Invalid or expired requestState로 돌아왔고, 바꿔치기한 인자도 같은 방식으로 돌아왔다. -32602 Invalid or expired requestState. SDK는 각각 다른 이유를 로그에 남기는데, 문자가 바뀐 경우에는 seal, 다른 인자의 경우에는 request binding이며, 클라이언트는 둘 다 받지 못한다(mcp/server/request_state.py). 상태가 없는 답변은 input_required, the server asks again를 받았다. 도구는 자신이 묻지 않은 질문에 대한 답을 답이 없는 것으로 취급하며, 명세는 답이 빠진 서버가 오류를 반환하기보다 다시 질문하는 것이 좋다고 말한다(SHOULD) (Multi Round-Trip Requests).

정직한 재시도는 환불을 처리했다. refund R-0111 requested. 같은 재시도를 다시 보내면 아무것도 바뀌지 않았으므로 봉인은 통과했다. 대신 서버 자체의 응답된 상태 기록이 이를 거부했고, 도구 오류 "tool error, Error executing tool issue_refund: Refund R-0111 was already confirmed. Don't send the same answer again."가 반환되었다. 이 기록은 confirmations.OnceOnly으로, 서버 메모리에서 잠금 아래 보관되는 상태의 집합이며, 도구는 상점의 API에 무엇이든 처리하도록 요청하기 전에 이를 확인한다. 그 뒤에서 API는 같은 환불을 두 번째로 처리하라는 요청에 409로 답하므로, 기록을 잃어버린 서버조차 두 번 지급할 수 없다.

작업 규칙: 모든 requestState를 SDK가 봉인하도록 하고, 돈, 접근 권한 또는 데이터에 관련된 상태에는 봉인을 절대 끄지 않는다. 상태는 작고 불투명하게 유지한다. 레코드가 아니라 ID를 담는다. 한 번만 일어나야 하는 단계에는 응답된 상태의 기록을 서버에 직접 보관하고, 부수 효과가 일어난 뒤가 아니라 일어나기 전에 확인한다.

이 부분은 아직 번역되지 않았으므로 영어로 표시된다.

Choose elicitation or a tool argument

마지막으로 변경된 판: 2026.11.14판

Each question in this chapter could have been a tool argument instead: confirmed: true on issue_refund (Return an input request instead of a result), or reason on record_return (Ask for structured input with elicitation). A tool argument costs no extra round trip and no user interface, but the model fills it in. Elicitation costs a round trip and a person's attention, and only the host's user is meant to answer it. The question to ask, then, is who can know the value.

This is a rule of thumb, not a measurement. If the model can read the value from the conversation, make it an argument. If only the person at the host can give it, elicit it. If it is a secret, or a sign-in to another service, use URL mode.

What the tool needs In the shop Use
A value in the ticket the order ID a customer wrote a tool argument
A decision the policy gives a person releasing a refund above the limit a form
A fact only the person present has what a returned parcel held a form
A secret or a sign-in the lead's payment provider account URL mode

A confirmed argument on issue_refund would let the model confirm its own refund, a decision the refund policy keeps for a person. The order ID goes the other way. Asking the lead to retype an ID the customer already wrote adds a step and a chance for a typo, and the model can read the ID. When a value could come from either place, take the argument and let the tool check it, as chapter 3's tools check every ID's format.

Elicitation is the server asking the user through the host. It isn't the host's own consent, the step where the host asks the user before a tool with side effects runs, which Ask for consent before side effects builds. The shop's confirmation is the server's own check, and a careful host still asks before it calls issue_refund at all.

Working rule: Make a value a tool argument when the model can know it, and validate it in the tool. Elicit it when only the person can give it, or when the policy says a person must decide, and never accept that kind of value as an argument. Use URL mode for every secret. When you aren't sure, ask who would be at fault if the value were wrong.

운영 환경에서 무엇이 잘못되는가

마지막으로 변경된 판: 2026.11.11판

이 확인 절차는 stdio 서버 하나, 클라이언트 하나, 즉시 답하는 각본 속 책임자 한 명이 있을 때 동작한다. 실제 책임자는 답하는 데 시간이 걸리고, 서버는 재시작되며, 클라이언트도 제각각이다. 그래서 이 패턴은 몇 가지 알아볼 수 있는 방식으로 실패한다.

사라진 키로 봉인한 상태. MCPServer의 기본 키는 프로세스가 시작될 때 만들어지며 메모리에만 존재한다(mcp/server/request_state.py). 질문과 답변 사이에 서버가 재시작되거나 재시도가 다른 복제본에 도달하면, 서버는 상태를 열 수 없고 책임자의 답변은 -32602로 실패한다. 주시해야 할 신호는 배포 이후, 또는 복제본 수에 따라 늘어나는 "Invalid or expired requestState"이다. RequestStateSecurity(keys=[...])를 통해 모든 복제본에 같은 키를 주어야 한다. 결과 대신 입력 요청을 반환하기의 봉인 정책인 confirmations.state_security()는 SHOP_REQUEST_STATE_KEY로 그 키를 만든다. 첫 번째 키가 봉인하고 모든 키가 열 수 있으므로, 답변을 잃지 않고 키를 교체할 수 있다(스티키 세션 없이 복제본 운영하기).

상태의 수명보다 느린 책임자. SDK의 상태는 기본적으로 라운드당 600초 동안 유지된다. 질문을 읽고 전화를 받은 뒤 15분 후에 답하는 책임자는 같은 -32602를 받으며, 서버 로그에는 expired라고 남는다. ttl=를 사람이 합리적으로 걸리는 가장 긴 시간으로 설정하고, 호스트가 그 오류를 새 호출로 바꾸어 다시 묻게 한다.

한 프로세스만 보는 기록. 재시도에는 첫 라운드의 기록 두 가지가 필요한데, 둘 다 한 서버의 메모리에 있다. 하나는 재시도가 환불을 찾는 데 쓰는 3장의 견적 저장소이고, 다른 하나는 왕복 상태를 변조 불가능하게 유지하기에서 다룬, 답변이 끝난 상태의 기록인 confirmations.OnceOnly이다. 복제본이 둘이면 다른 복제본에 도달한 재시도는 "There is no quote"로 실패하고, 그 복제본에 도달한 재전송 답변은 한 번만 허용하는 검사를 통과할 수 있다. 스티키 세션 없이 복제본 운영하기처럼 두 기록을 모두 공유 저장소에 두고, 그 뒤에서 상점 API 자체의 409 응답이 막아 주도록 유지하라.

책임자가 아닌 사람의 답변. 이 도구는 호스트가 보내는 모든 accept에 대해 환불을 해제하며, 호스트는 코드로 답할 수도 있다. stdio에서는 서버가 확인할 수 있는 것이 여기까지다. HTTP에서는 모든 질문을 인증된 호출자에 묶고, 호출자의 토큰이 지원 책임자만 가진 범위인 refunds:write를 갖고 있는지 확인하라(토큰이 허용하는 범위로 도구 제한하기).

질문할 수 없는 클라이언트. 클라이언트에 elicitation 콜백이 없는 호스트는 elicitation 기능을 선언하지 않으며(mcp/client/session.py), 호출은 -32021, Missing Required Client Capability로 실패한다. 리졸버의 검사는 도구보다 먼저 실행되지만, issue_refund처럼 직접 만든 검사는 도구 안에서, 즉 3장의 도구가 환불을 보류한 뒤에 실행된다(confirmations.require_elicitation). 신호는 한 호스트에서만 그 오류가 나고 다른 호스트에서는 나지 않는 것이다. 사람을 상대하는 호스트는 elicitation을 선언하고 질문을 보여 주어야 한다(사용자를 위해 입력 요청에 답하기). 환불을 보류 상태로 두는 것과 같은 안전한 기본값이 있는 도구의 서버는 실패하는 대신 그 기본값을 결과로 반환할 수 있다.

바뀌는 URL 모드 흐름. 명세는 URL 모드를 이후 개정에서 설계가 바뀔 수 있는 기능으로 표시하고 있으며(elicitation), 고정한 개정에서는 이미 그 부분 두 가지가 제거되었다. URL 모드 코드는 한곳에 모아 두고, 개정마다 변경 내역과 대조하라.

끝나지 않는 루프. 사용자가 중단한 URL 모드 흐름은 재시도할 때마다 다시 묻고, SDK의 클라이언트는 10라운드 후에 InputRequiredRoundsExceededError로 멈춘다. 각 흐름의 라운드 수를 requestState에 세고, 몇 라운드 뒤에는 그 단계가 끝나지 않았다는 결과를 반환하라.

같은 서버의 오래된 클라이언트. 2025 핸드셰이크로 연결한 클라이언트에 InputRequiredResult를 반환하면, 클라이언트에는 -32603, "Handler returned an invalid result"로 도달한다. SDK는 결과를 2025의 CallToolResult에 비추어 검사하는데, 이 타입은 content를 요구한다(mcp/server/runner.py, 다중 왕복 요청). 둘을 모두 제공하는 서버는 ctx.protocol_version을 확인하거나, 연결마다 올바른 경로를 고르는 리졸버를 사용한다(mcp/server/mcpserver/resolve.py). 두 방법은 기간 동안 오래된 클라이언트와 새 클라이언트 함께 제공하기에서 다룬다.

아무도 조사하지 않는 거부. 거부된 모든 상태는 클라이언트에 같은 메시지를 주므로, 이유를 알 수 있는 유일한 기록은 로거 mcp.server.request_state 아래의 서버 로그뿐이다. 그 로그를 수집하고, 누군가 토큰을 바꾸었다는 뜻인 seal와 request binding에 대한 경보를, 대개 사람이 느리다는 뜻인 expired와 따로 설정하라.

작업 규칙: 질문하는 서버의 복제본에는 교체할 수 있는 공유 키 하나를 주고, 상태의 수명을 사람이 걸리는 시간에 맞추며, 견적 저장소와 한 번만 허용하는 모든 기록을 공유 저장소로 옮긴 뒤에 운영에 투입하라. 전송 계층에 호출자가 있는 곳에서는 각 질문을 호출자에 묶어라. 그런 다음 -32602는 기록된 이유별로, -32021은 호스트별로 살피고, 호출당 라운드 수도 관찰하라.

이 장에서 내린 결정

마지막으로 변경된 판: 2026.11.11판
  • 어떤 환불에 확인이 필요한지는 쇼핑몰의 API가 결정한다. issue_refund은 3장의 버전을 먼저 호출하고, API가 환불을 보류한 경우에만 확인을 요청한다. 따라서 정책의 한도는 한곳에만 존재한다.
  • 환불은 질문보다 먼저 보류된다. 그래서 아무도 답하지 않은 질문은 3장에서처럼 환불을 보류된 상태로 남긴다.
  • 확인은 직접 만든 입력 요청이다. 키 confirm 아래에 폼 모드 elicitation 하나를 두고, 환불의 ID를 requestState로 담는다. 재시도 시에는 이 값을 찾아낸 환불과 대조한다. 반송 소포 폼은 리졸버를 사용하는데, 여기서는 SDK의 기능 확인과 렌더링이 코드를 줄여 준다.
  • SDK는 모든 requestState를 봉인한다. 키는 배포 환경이 confirmations.state_security() 또는 SHOP_REQUEST_STATE_KEY을 통해 주입할 수 있으며, 그렇지 않으면 프로세스가 살아 있는 동안만 유지되는 키를 사용한다.
  • 답변은 서버에서 한 번만 유효하다. confirmations.OnceOnly를 통해 해제 전에 검사하며, 그 뒤에는 API의 409가 버티고 있다.
  • 서버의 상태가 없는 답변이나 다른 환불의 상태를 담은 답변은 한 번도 하지 않은 질문과 같다. 이때 도구는 다시 묻는다.
  • 서버는 호출을 열어 두지 않지만 기록 두 가지를 보관한다. 3장의 견적 저장소와 한 번만 유효한 답변의 기록이며, 여기서는 둘 다 메모리에 두고 6장에서 복제본 간에 공유한다.
  • stdio에서는 호스트의 사용자가 확인하는 사람이다. HTTP에서는 질문이 인증된 호출자에 묶이며, 지원 담당 책임자만 가진 스코프인 refunds:write가 도구를 제한한다(토큰이 허용하는 범위에 따라 도구 제한하기).
  • 거절과 취소는 서로 다른 결과로 이어진다. 거절은 그대로 확정되고, 취소는 질문을 열어 둔다.
  • 비밀 값과 로그인은 URL 모드를 거친다. 흐름의 ID는 requestState에 담고, accept는 완료된 것으로 간주하지 않는다.
  • API에 엔드포인트 두 개가 추가되었다. POST /refunds/{refund_id}/confirm와 POST /refunds/{refund_id}/cancel이며, 보류된 환불에만 작동하고 그렇지 않으면 409로 응답한다.
  • 모델이 읽을 수 있는 값은 도구 인수로 두고, 사람만 줄 수 있는 값은 elicitation으로 받는다.

이 판의 이 장

2026.11.14판예제 통과 2026년 11월 19이 장에서 6개 예제개 중 6개가 통과한다

영어판 2026.11.14판을 번역한 것이다.

이 절 인용

형식

각 형식은 이 번역이 따르는 영문 원서를 출처로 표기한다.

모든 형식은 이 판을 명시한다. 링크는 현재 판을 열며, 여기서 절의 제목은 본문이 마지막으로 바뀐 시점을 알려 준다. 접근 날짜와 검색 날짜는 이 자료를 여는 날짜다.

이 페이지의 내용

12장 중 5장: Ask the user in the middle of a call

  1. See why a stateless server can't wait for an answer
  2. Return an input request instead of a result
  3. Resume the call with the answer
  4. Ask for structured input with elicitation
  5. 민감한 단계는 URL로 보내기
  6. 왕복 상태를 변조할 수 없게 유지하기
  7. Choose elicitation or a tool argument
  8. 운영 환경에서 무엇이 잘못되는가
  9. 이 장에서 내린 결정

맨 위로 돌아가기전체 장