Interface McpHandlerContinuation

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

One-shot continuation supplied to an McpHandlerInterceptor.

The continuation is synchronous and bound to the thread invoking the interceptor. It must be invoked, if at all, before the interceptor returns and must not be retained or passed to another thread. The first invocation enters the remaining validation and handler chain. A second or later invocation fails synchronously without re-entering downstream code.

If the downstream handler throws an McpJsonRpcException, proceed() throws that same exception instance. The interceptor may inspect it and rethrow it unchanged to preserve its intentional client-visible error, or recover by returning a method-compatible result that traverses normal result validation. A new exception, including one carrying the same McpJsonRpcError, a wrapper, or an exception from a previous invocation fails closed as an unexpected interception failure.

Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    Invokes the next stage exactly once.
  • Method Details

    • proceed

      Invokes the next stage exactly once.
      Returns:
      recognized, non-null, method-compatible handler result
      Throws:
      IllegalStateException - if this continuation was already invoked, retained beyond its interceptor call, or invoked from another thread
      McpJsonRpcException - the exact intentional error exception thrown by the downstream handler
      Exception - if downstream validation or application handling fails