Class DefaultMcpModernSyncRequestContext
java.lang.Object
org.springframework.ai.mcp.annotation.context.DefaultMcpModernSyncRequestContext
- All Implemented Interfaces:
McpModernRequestContext,McpModernSyncRequestContext
public final class DefaultMcpModernSyncRequestContext
extends Object
implements McpModernSyncRequestContext
Default
McpModernSyncRequestContext built from the SDK request context and the
MRTR fields of the request.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()io.modelcontextprotocol.modern.McpSchema.ClientCapabilitiesThe client capabilities declared for this request.@Nullable io.modelcontextprotocol.modern.McpSchema.ImplementationThe client info declared for this request, if any.io.modelcontextprotocol.modern.server.McpRequestContextcontext()The SDK request context.<T> @Nullable TinputResponse(String key, Class<T> type) The client's response for one input request, converted to the given type.The raw input responses of a retried call, keyed as the server requested them.booleanisRetry()Whether this call is a retry carrying input responses or request state.@Nullable ObjectThe progress token, ornullif the client did not request progress.The protocol version the client declared for this request.The request_metamap.@Nullable StringThe request state the server attached to its input-required result, if any.io.modelcontextprotocol.common.McpTransportContextThe transport context (headers, connection info, ...).
-
Method Details
-
builder
-
context
public io.modelcontextprotocol.modern.server.McpRequestContext context()Description copied from interface:McpModernRequestContextThe SDK request context.- Specified by:
contextin interfaceMcpModernRequestContext
-
protocolVersion
Description copied from interface:McpModernRequestContextThe protocol version the client declared for this request.- Specified by:
protocolVersionin interfaceMcpModernRequestContext
-
clientCapabilities
public io.modelcontextprotocol.modern.McpSchema.ClientCapabilities clientCapabilities()Description copied from interface:McpModernRequestContextThe client capabilities declared for this request.- Specified by:
clientCapabilitiesin interfaceMcpModernRequestContext
-
clientInfo
public @Nullable io.modelcontextprotocol.modern.McpSchema.Implementation clientInfo()Description copied from interface:McpModernRequestContextThe client info declared for this request, if any.- Specified by:
clientInfoin interfaceMcpModernRequestContext
-
requestMeta
Description copied from interface:McpModernRequestContextThe request_metamap.- Specified by:
requestMetain interfaceMcpModernRequestContext
-
transportContext
public io.modelcontextprotocol.common.McpTransportContext transportContext()Description copied from interface:McpModernRequestContextThe transport context (headers, connection info, ...).- Specified by:
transportContextin interfaceMcpModernRequestContext
-
progressToken
Description copied from interface:McpModernRequestContextThe progress token, ornullif the client did not request progress.- Specified by:
progressTokenin interfaceMcpModernRequestContext
-
isRetry
public boolean isRetry()Description copied from interface:McpModernRequestContextWhether this call is a retry carrying input responses or request state.- Specified by:
isRetryin interfaceMcpModernRequestContext
-
inputResponses
Description copied from interface:McpModernRequestContextThe raw input responses of a retried call, keyed as the server requested them.- Specified by:
inputResponsesin interfaceMcpModernRequestContext
-
requestState
Description copied from interface:McpModernRequestContextThe request state the server attached to its input-required result, if any.- Specified by:
requestStatein interfaceMcpModernRequestContext
-
inputResponse
Description copied from interface:McpModernRequestContextThe client's response for one input request, converted to the given type.- Specified by:
inputResponsein interfaceMcpModernRequestContext- Type Parameters:
T- the response type- Parameters:
key- the server-assigned key used in the input-required resulttype- the type to convert the response to- Returns:
- the response, or
nullif the client did not answer this request
-