Skip to content

Client: option to return the MRTR InputRequiredResult instead of resolving it in-process #1985

Open

Description

@rockfordlhotka

Summary

Please add an opt-in client API that returns an MRTR InputRequiredResult (the
inputRequests and the opaque requestState) to the caller, instead of always resolving it
through McpClientHandlers inside McpClient. Re-issuing the call with the answers already works
through CallToolRequestParams.InputResponses / RequestState. Capturing the state is the only
missing piece.

Use case

We run an agent that brokers MCP tool calls for a person. When a server elicits during a
tools/call, the agent doesn't answer in-process. It hands the question back to its own
conversation (often to the user), and the answer can take minutes or hours.

Under MRTR this costs the server nothing: it returns input_required and keeps no state. But
the client does keep state. Today the only way to wait is to keep CallToolAsync suspended
inside ElicitationHandler until the answer arrives. If the client process restarts in the
meantime (a deploy, a crash, a pod reschedule), the in-flight CallToolAsync and the server's
requestState with it are gone. The call has to be redone from scratch, and the user may get
asked again.

If the client could get requestState back, it could keep it durably next to the pending
question. After a restart, it could resume the call by re-issuing it with inputResponses and
that requestState. That is how MRTR is designed to work: the continuation lives with the
client, not the server.

Current behaviour

In McpClientImpl.SendRequestAsync (2.2.0, 2.3.0 and main):

  • After _sessionHandler.SendRequestAsync, a result with resultType: "input_required" is
    deserialized to InputRequiredResult.
  • Its inputRequests go to ResolveInputRequestsAsync, which calls the
    Elicitation/Sampling/Roots handlers.
  • The request is cloned with inputResponses + requestState and retried, up to 10 times.
  • A requestState-only result is retried automatically.

All public entry points share this path. We probed each against a real 2.2.0 server:

  • CallToolAsync(name, args)
  • CallToolAsync(CallToolRequestParams)
  • McpSession.SendRequestAsync(JsonRpcRequest)

Every one called ElicitationHandler and returned the resumed result, never the
InputRequiredResult.

The handlers can't help either: they get the request params but not the requestState, so even
a handler that wanted to save the continuation and give up can't see it.

Possible shapes

Any of these would work for us. You'll know which fits the SDK best.

  1. Per-request opt-out: e.g. RequestOptions.ResolveInputRequests = false, or an option on
    McpClientOptions. A tools/call that comes back input_required then returns or throws it
    to the caller, for example as an InputRequiredException carrying the InputRequiredResult.
    That exception type already exists for servers.
  2. A typed overload: e.g. CallToolWithInputRequestsAsync(...) returning
    ResultOrAlternate<CallToolResult, InputRequiredResult>, a type the Protocol namespace
    already has.
  3. Smallest change: expose requestState (and the round's other inputRequests keys) to the
    handlers through a context object, so a handler can save the continuation before it waits.
    This doesn't remove the suspended call, but it makes a resume after restart possible.

With (1) or (2), the caller resumes with what's there today:

var resumed = await client.CallToolAsync(new CallToolRequestParams
{
    Name = toolName,
    Arguments = originalArguments,
    InputResponses = answers,       // keyed like inputRequests
    RequestState = savedRequestState,
}, ct);

Workarounds we looked at

  • Wrap the client ITransport and read input_required responses before the session handler
    does. This works in principle, but McpClientImpl checks the concrete transport type
    (_transport is SseClientSessionTransport for the initialize fallback, and
    is StreamableHttpClientSessionTransport), so a wrapper changes behaviour. It also means
    matching request ids by hand, so we'd rather not depend on it.
  • Bypass McpClient for tools/call. This would lose discovery, auth, per-request _meta
    and header handling.

Environment

  • ModelContextProtocol 2.2.0 (checked again against 2.3.0 and main)
  • Protocol revision 2026-07-28, Streamable HTTP, stateless server

Related, but not the same request: #1902 (server-side handler for InputRequiredResult), and
#1635 / #1814 (MRTR with task-backed tools).

Activity

  1. added this to the 2.x milestone on Nov 11, 2026
  2. self-assigned this
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions