Interface HumanConfirmer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface HumanConfirmer
How the server asks the person at the MCP client to approve one action. This is the only seam the Safe Mutation Broker's human check goes through (ServerContext.confirmWithHuman(String)), so replacing the delivery mechanism is a change to one implementation of this interface.

Protocol revisions

The default, elicitation(), sends a server-to-client elicitation/create form request and blocks the tool call until the answer arrives. That is how every protocol revision the bundled MCP Java SDK (2.1.0) negotiates works: 2024-11-05, 2025-03-26, 2025-06-18 and 2025-11-25 (form elicitation exists from 2025-06-18; an older client simply declares no elicitation and the broker fails closed).

Revision 2026-07-28 is stateless and replaces elicitation/create with multi-round-trip requests: the tool call returns an InputRequiredResult carrying the form and a sealed requestState, and the client retries the same tools/call with inputResponses. No GA release of the Java SDK implements it (2.1.0 is the latest GA on 2026-11-12; 2.2.0-M2 carries an experimental io.modelcontextprotocol.modern server). When a GA SDK does, the swap is:

  1. an implementation of this interface that, on the first call, returns a "pending" outcome carrying the form, and on the retry reads the answer from inputResponses;
  2. in fabric_confirm_change, the token is consumed on the retry that carries the answer (not on the first round trip), and the compiled-request hash is sealed into requestState so the retry is bound to the same request;
  3. the server is built on the SDK's stateless server for clients that negotiate 2026-07-28, keeping this blocking implementation for older clients.
  • Method Details

    • confirm

      HumanConfirmation confirm(ServerContext context, String message, CancellationSignal cancellation)
      Asks for approval of one action.
      Parameters:
      context - the server context of the current call (bound exchange, timeouts)
      message - the prompt: what will be executed and what each answer does
      cancellation - the current call's signal; a cancel abandons the prompt
      Returns:
      what the client reported; never null. Only HumanConfirmation.Status.ACCEPTED is an approval.
    • elicitation

      static HumanConfirmer elicitation()
      Returns:
      the default confirmer: an MCP form elicitation (elicitation/create) over the exchange bound to the current call, bounded by ServerContext.elicitTimeoutMillis()