Interface McpRequest

All Superinterfaces:
MetaCarrier

public interface McpRequest extends MetaCarrier
Provides information about the current request, including the request ID and the metadata fields.

Tool, Prompt, Resource, and ResourceTemplate methods can accept this interface as a parameter. It will be automatically injected by the framework implementation before the method is invoked.

  • Method Details

    • id

      Object id()
      Gets the request id, either a String or a Number.
      Returns:
      the request id
    • sessionId

      Optional<String> sessionId()
      Gets the session ID, if the request is part of a session
      Returns:
      the session ID, or an empty Optional if the request is not associated with a session
    • protocolVersion

      String protocolVersion()
      Gets the MCP protocol version in use for this request
      Returns:
      the protocol version, e.g. 2025-11-25 or 2025-06-18
    • rawClientCapabilities

      Map<String,Object> rawClientCapabilities()
      Gets the map of capabilities that the client supports
      Returns:
      the raw map of supported capabilities reported by the client
    • clientInfo

      ImplementationInfo clientInfo()
      Gets the description of the client, as sent by the client itself
      Returns:
      the client information