java.lang.Object
io.modelcontextprotocol.spec.McpSchema
Based on the JSON-RPC 2.0
specification and the Model
Context Protocol Schema.
- Author:
- Christian Tzolov, Luca Chang, Surbhi Bansal, Anurag Pant
-
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 recordAudio provided to or from an LLM.static interfaceBase interface for metadata with name (identifier) and title (display name) properties.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 recordCapabilities a client may support.static interfacestatic final recordA request from the client to the server, to ask for completion options.static final recordThe server's response to a completion/complete request.static interfacestatic final recordA request from the server to sample an LLM via the client.static final recordThe client's response to a sampling/create_message request from the server.static final recordA request from the server to elicit additional information from the user via the client.static final recordThe client's response to an elicitation request.static final recordThe contents of a resource, embedded into a prompt or tool call result.static 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 recordAn image provided to or from an LLM.static final recordDescribes the name and version of an MCP implementation, with an optional title for UI representation.static final recordThis request is sent from the client to the server when it first connects, asking it to begin initialization.static final recordAfter receiving an initialize request from the client, the server sends this response.static interfacestatic final recordA notification which does not expect a response.static final recordA request that expects a response.static final recordA successful (non-error) response to a request.static final recordA JSON Schema object that describes the expected structure of arguments or output.static final recordThe server's response to a prompts/list request from the client.static final recordThe server's response to a resources/list request from the client.static final recordThe server's response to a resources/templates/list request from the client.static 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 recordHints to use for model selection.static final recordThe server's preferences for model selection, requested of the client during sampling.static interfacestatic final recordA request that supports pagination using cursors.static final recordAn opaque token representing the pagination position after the last returned result.static final recordThe Model Context Protocol (MCP) supports optional progress tracking for long-running operations through notification messages.static 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 recordIdentifies a prompt for completion requests.static final recordSent from the client to the server, to read a specific resource URI.static final recordThe server's response to a resources/read request from the client.static interfacestatic final recordA known resource that the server is capable of reading.static interfaceA common interface for resource content, which includes metadata about the resource such as its URI, name, description, MIME type, size, and annotations.static interfaceThe contents of a specific resource or sub-resource.static final recordA known resource that the server is capable of reading.static final recordA reference to a resource or resource template definition for completion requests.static final recordThe Model Context Protocol (MCP) provides a standardized way for servers to send resources update message to clients.static final recordResource templates allow servers to expose parameterized resources using URIstatic interfacestatic enumstatic final recordRepresents a root directory or file that the server can operate on.static final recordDescribes a message issued to or received from an LLM API.static final recordCapabilities that a server may support.static final recordA request from the client to the server, to enable or adjust logging.static final recordSent from the client to request resources/updated notifications from the server whenever a particular resource changes.static final recordText provided to or from an LLM.static final recordText contents of a resource.static final recordRepresents a tool that the server provides.static final recordAdditional properties describing a Tool to clients.static final recordSent from the client to request cancellation of resources/updated notifications from the server. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final StringDeprecated.static 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 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
Deprecated.- See Also:
-
JSONRPC_VERSION
- See Also:
-
FIRST_PAGE
-
METHOD_INITIALIZE
- See Also:
-
METHOD_NOTIFICATION_INITIALIZED
- See Also:
-
METHOD_PING
- See Also:
-
METHOD_NOTIFICATION_PROGRESS
- 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_NOTIFICATION_RESOURCES_UPDATED
- 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_COMPLETION_COMPLETE
- 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_ELICITATION_CREATE
- 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
-