java.lang.Object
io.modelcontextprotocol.spec.McpSchema
Based on the JSON-RPC 2.0
specification and the Model
Context Protocol Schema.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBase for objects that include optional annotations for the client.static final recordOptional annotations for the client.static final recordBinary contents of a resource.static final recordUsed by the client to call a tool provided by the server.static final recordThe server's response to a tools/call request from the client.static final recordClients can implement additional features to enrich connected MCP servers with additional capabilities.static final recordstatic final recordstatic interfacestatic final recordstatic final recordstatic final recordstatic final classStandard error codes used in MCP JSON-RPC responses.static final recordUsed by the client to get a prompt provided by the server.static final recordThe server's response to a prompts/get request from the client.static final recordstatic final recordstatic final recordstatic final recordstatic interfacestatic final recordstatic final recordstatic final recordstatic final recordstatic final recordThe server's response to a prompts/list request from the client.static final recordstatic final recordstatic final recordThe client's response to a roots/list request from the server.static final recordThe server's response to a tools/list request from the client.static enumstatic final recordThe Model Context Protocol (MCP) provides a standardized way for servers to send structured log messages to clients.static final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordA prompt or prompt template that the server offers.static final recordDescribes an argument that a prompt can accept.static final recordDescribes a message returned as part of a prompt.static final recordstatic final recordstatic interfacestatic final recordA known resource that the server is capable of reading.static interfaceThe contents of a specific resource or sub-resource.static final recordResource templates allow servers to expose parameterized resources using URI templates.static enumstatic final recordRepresents a root directory or file that the server can operate on.static final recordstatic final recordstatic final recordstatic final recordSent from the client to request resources/updated notifications from the server whenever a particular resource changes.static final recordstatic final recordText contents of a resource.static final recordRepresents a tool that the server provides.static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic McpSchema.JSONRPCMessagedeserializeJsonRpcMessage(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String jsonText) Deserializes a JSON string into a JSONRPCMessage object.
-
Field Details
-
LATEST_PROTOCOL_VERSION
- See Also:
-
JSONRPC_VERSION
- See Also:
-
METHOD_INITIALIZE
- See Also:
-
METHOD_NOTIFICATION_INITIALIZED
- See Also:
-
METHOD_PING
- See Also:
-
METHOD_TOOLS_LIST
- See Also:
-
METHOD_TOOLS_CALL
- See Also:
-
METHOD_NOTIFICATION_TOOLS_LIST_CHANGED
- See Also:
-
METHOD_RESOURCES_LIST
- See Also:
-
METHOD_RESOURCES_READ
- See Also:
-
METHOD_NOTIFICATION_RESOURCES_LIST_CHANGED
- See Also:
-
METHOD_RESOURCES_TEMPLATES_LIST
- See Also:
-
METHOD_RESOURCES_SUBSCRIBE
- See Also:
-
METHOD_RESOURCES_UNSUBSCRIBE
- See Also:
-
METHOD_PROMPT_LIST
- See Also:
-
METHOD_PROMPT_GET
- See Also:
-
METHOD_NOTIFICATION_PROMPTS_LIST_CHANGED
- See Also:
-
METHOD_LOGGING_SET_LEVEL
- See Also:
-
METHOD_NOTIFICATION_MESSAGE
- See Also:
-
METHOD_ROOTS_LIST
- See Also:
-
METHOD_NOTIFICATION_ROOTS_LIST_CHANGED
- See Also:
-
METHOD_SAMPLING_CREATE_MESSAGE
- See Also:
-
-
Method Details
-
deserializeJsonRpcMessage
public static McpSchema.JSONRPCMessage deserializeJsonRpcMessage(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String jsonText) throws IOException Deserializes a JSON string into a JSONRPCMessage object.- Parameters:
objectMapper- The ObjectMapper instance to use for deserializationjsonText- The JSON string to deserialize- Returns:
- A JSONRPCMessage instance using either the
McpSchema.JSONRPCRequest,McpSchema.JSONRPCNotification, orMcpSchema.JSONRPCResponseclasses. - Throws:
IOException- If there's an error during deserializationIllegalArgumentException- If the JSON structure doesn't match any known message type
-