Package org.forgerock.openig.mcp
Class McpContext
java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.openig.mcp.McpContext
- All Implemented Interfaces:
Context
A context holding MCP request and response information. Note that:
- an MCP client can send an MCP response to the server in response to a request from the MCP server sent as a Server Sent Event (SSE).
- An MCP server can only acknowledge the Client's request, without request's body.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMCP request types.static enumMCP response types. -
Field Summary
Fields inherited from class org.forgerock.services.context.AbstractContext
data -
Constructor Summary
ConstructorsConstructorDescriptionMcpContext(Context parent) Create aMcpContext.McpContext(Context parent, JsonRpcPayload clientPayload, JsonRpcPayload serverPayload, String protocolVersion, String sessionId) Create aMcpContext. -
Method Summary
Modifier and TypeMethodDescriptionReturns the MCP Client message type.Returns the JSON-RPC message received from the MCP client.Returns the MCP version being used.Returns the MCP Server message type.Returns the JSON-RPC message received from the MCP server, if any.Returns the MCP sessionId, if set.Methods inherited from class org.forgerock.services.context.AbstractContext
as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
-
Constructor Details
-
McpContext
Create aMcpContext.- Parameters:
parent- the parentContext.
-
McpContext
public McpContext(Context parent, JsonRpcPayload clientPayload, JsonRpcPayload serverPayload, String protocolVersion, String sessionId) Create aMcpContext.- Parameters:
parent- the parentContext.clientPayload- the JSON-RPC message received from the MCP Client.serverPayload- the JSON-RPC message received from the MCP Server.protocolVersion- the MCP protocol versionsessionId- the MCP sessionId
-
-
Method Details
-
clientMessageType
Returns the MCP Client message type.- Returns:
- the MCP Client message type
-
serverMessageType
Returns the MCP Server message type.- Returns:
- the MCP Server message type
-
clientPayload
Returns the JSON-RPC message received from the MCP client.- Returns:
- the JSON-RPC message received from the MCP client
-
protocolVersion
Returns the MCP version being used.- Returns:
- the MCP version being used
-
sessionId
Returns the MCP sessionId, if set.- Returns:
- the MCP sessionId, if set
-
serverPayload
Returns the JSON-RPC message received from the MCP server, if any.- Returns:
- the JSON-RPC message received from the MCP server, if any
-