Package-level declarations
Types
Optional annotations for the client.
Audio provided to or from an LLM.
DSL builder for constructing AudioContent instances.
Base parameters for notifications that only contain metadata.
Default RequestParams implementation carrying only optional metadata.
The contents of a specific resource or sub-resource.
Defines a boolean-typed property in an elicitation schema.
Used by the client to invoke a tool provided by the server.
DSL builder for constructing CallToolRequest instances.
Parameters for a tools/call request.
The server's response to a CallToolRequest.
This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
Parameters for a notifications/cancelled notification.
A request to cancel a task.
Parameters for a tasks/cancel request.
The response to a tasks/cancel request.
Capabilities that a client may support.
DSL builder for constructing ClientCapabilities instances.
Represents a notification sent by the client.
Represents a request sent by the client.
Represents a result returned by the server in response to a ClientRequest.
A request from the client to the server to ask for completion options.
DSL builder for constructing CompleteRequest instances.
Parameters for the completion request.
The server's response to a CompleteRequest.
Base interface for all content blocks in the protocol.
Discriminator values for the polymorphic ContentBlock hierarchy.
A request from the server to sample an LLM via the client.
DSL builder for constructing CreateMessageRequest instances.
Parameters for a sampling/createMessage request.
The client's response to a CreateMessageRequest from the server.
A response to a task-augmented request.
Represents a custom notification method that is not part of the core MCP specification.
A custom request with a specified method.
Defines a floating-point number property in an elicitation schema.
An optional notification from the server to the client, informing it of a completion of an out-of-band elicitation request.
Parameters for a notifications/elicitation/complete notification.
Represents an elicitation/create request from the server to the client.
DSL builder for constructing ElicitRequest instances.
DSL builder for constructing ElicitRequestParams.RequestedSchema instances.
Represents form mode parameters for an elicitation/create request.
Represents the parameters for an elicitation/create request.
Represents URL mode parameters for an elicitation/create request.
Represents the client's response to an ElicitRequest.
The contents of a resource, embedded into a prompt or tool call result.
An empty result for a request containing optional metadata.
Represents an enum option with a value and a display label.
Defines an enumeration property in an elicitation schema.
Used by the client to get a prompt provided by the server.
DSL builder for constructing GetPromptRequest instances.
Parameters for a prompts/get request.
The server's response to a GetPromptRequest from the client.
A request to retrieve the result of a completed task.
Parameters for a tasks/result request.
The response to a tasks/result request.
A request to retrieve the state of a task.
Parameters for a tasks/get request.
The response to a tasks/get request.
An image provided to or from an LLM.
DSL builder for constructing ImageContent instances.
Specifies which MCP server context to include in the sampling request.
This notification is sent from the client to the server after initialization has finished.
This request is sent from the client to the server when it first connects, asking it to begin initialization.
DSL builder for constructing InitializeRequest instances.
Parameters for an initialize request.
After receiving an InitializeRequest from the client, the server sends this response.
Defines an integer-typed property in an elicitation schema.
Represents an empty JSON-RPC message used as a placeholder or no-op response.
A response to a request that indicates an error occurred.
Base interface for all JSON-RPC 2.0 messages.
A notification which does not expect a response.
A request that expects a response.
A successful (non-error) response to a request.
Defines a single-selection enumeration with display names via the deprecated enumNames array.
Sent from the client to request a list of prompts and prompt templates the server has.
DSL builder for constructing ListPromptsRequest instances.
The server's response to a ListPromptsRequest from the client.
Sent from the client to request a list of resources the server has.
DSL builder for constructing ListResourcesRequest instances.
The server's response to a ListResourcesRequest from the client.
Sent from the client to request a list of resource templates the server has.
DSL builder for constructing ListResourceTemplatesRequest instances.
The server's response to a ListResourceTemplatesRequest from the client.
Sent from the server to request a list of root URIs from the client.
DSL builder for constructing ListRootsRequest instances.
The client's response to a ListRootsRequest from the server.
A request to retrieve a list of tasks.
The response to a tasks/list request.
Sent from the client to request a list of tools the server has.
DSL builder for constructing ListToolsRequest instances.
The server's response to a ListToolsRequest from the client.
The severity of a log message.
A notification of a log message passed from server to client.
Parameters for a notifications/message notification.
Represents an error specific to the MCP protocol.
Content block that carries media data such as text, images, or audio.
Base DSL builder for constructing MediaContent instances.
Represents a method in the protocol, which can be predefined or custom.
Hints to use for model selection.
Defines a multiple-selection enumeration property.
Represents a notification in the protocol.
Interface for notification parameter types.
Defines a numeric property in an elicitation schema.
Represents a request supporting pagination.
Base DSL builder for constructing paginated MCP request instances.
Common parameters for paginated requests.
Represents a paginated result.
Represents a ping request used to check if the connection is alive.
DSL builder for constructing PingRequest instances.
Restricted schema definition for elicitation request properties.
An out-of-band notification used to inform the receiver of a progress update for a long-running request.
Parameters for a notifications/progress notification.
A progress token, used to associate progress notifications with the original request.
A prompt or prompt template that the server offers.
Describes an argument that a prompt can accept.
An optional notification from the server to the client, informing it that the list of prompts it offers has changed.
Describes a message returned as part of a prompt.
Identifies a prompt by reference.
Sent from the client to the server to read a specific resource URI.
DSL builder for constructing ReadResourceRequest instances.
Parameters for a resources/read request.
The server's response to a ReadResourceRequest from the client.
Base interface for reference types in the protocol.
Discriminator for Reference subtypes used in completion and other operations.
Metadata for associating messages with a task. Include this in the _meta field under the key io.modelcontextprotocol/related-task.
Represents a request in the protocol.
Base DSL builder for constructing MCP request instances.
A uniquely identifying ID for a request in JSON-RPC.
Metadata attached to a request's _meta field.
DSL builder for constructing RequestMeta instances.
Base interface for parameters attached to a Request.
Represents the result of a request, including additional metadata.
A known resource that the server is capable of reading.
The contents of a specific resource or sub-resource.
Common interface for resource-like types that share URI, name, and description fields.
A resource that the server is capable of reading, included in a prompt or tool call result.
An optional notification from the server to the client, informing it that the list of resources it can read from has changed.
A template description for resources available on the server.
A reference to a resource or resource template definition.
A notification from the server to the client, informing it that a resource has changed and may need to be read again.
Parameters for a notifications/resources/updated notification.
The sender or recipient of messages and data in a conversation.
Represents a root directory or file that the server can operate on.
A notification from the client to the server, informing it that the list of roots has changed.
Error information for a failed JSON-RPC request.
Describes a message issued to or received from an LLM API.
DSL builder for constructing lists of SamplingMessage instances.
Capabilities that a server may support.
Represents a notification sent by the server.
Represents a request sent by the server.
Represents a result returned by the client in response to a ServerRequest.
A request from the client to the server to enable or adjust logging.
DSL builder for constructing SetLevelRequest instances.
Parameters for a logging/setLevel request.
Defines a single-selection enumeration property.
The reason why the LLM stopped generating tokens.
Defines a string-typed property in an elicitation schema.
Supported format constraints for StringSchema.
Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
DSL builder for constructing SubscribeRequest instances.
Parameters for a resources/subscribe request.
Data associated with a task.
Common fields shared by all types representing the task state.
Metadata for augmenting a request with task execution. Include this in the task field of the request parameters.
The status of a task.
An optional notification from the receiver to the requestor, informing them that a task’s status has changed. Receivers are not required to send these notifications.
Parameters for a notifications/tasks/status notification.
Indicates whether a tool supports task-augmented execution.
Text provided to or from an LLM.
DSL builder for constructing TextContent instances.
Represents the text contents of a resource.
Defines a multiple-selection enumeration with display titles for each option.
Defines a single-selection enumeration with display titles for each option.
Definition for a tool the client can call.
Execution-related properties for a tool.
An optional notification from the server to the client, informing it that the list of tools it offers has changed.
A JSON Schema for tool input or output parameters.
Represents resource contents with unknown or unspecified data.
Sent from the client to request cancellation of resources/updated notifications from the server.
DSL builder for constructing UnsubscribeRequest instances.
Parameters for a resources/unsubscribe request.
Defines a multiple-selection enumeration without display titles for options.
Defines a single-selection enumeration without display titles for options.
Represents an entity that includes additional metadata in its responses.
Properties
The default protocol version used when negotiation is not performed.
Reusable empty JsonObject instance.
JSON-RPC protocol version used by MCP ("2.0").
The latest supported MCP protocol version string.
The key used in _meta to associate a message with a task.
All MCP protocol versions supported by this SDK.
Functions
Adds an assistant message with simple text content.
Adds an assistant message with audio content.
Adds an assistant message with image content.
Adds an assistant message with text content using a DSL builder.
Creates a CallToolRequest using a type-safe DSL builder.
Creates a CompleteRequest using a type-safe DSL builder.
Creates a CreateMessageRequest using a type-safe DSL builder.
Creates an ElicitRequest using a type-safe DSL builder.
Creates a GetPromptRequest using a type-safe DSL builder.
Creates an InitializeRequest using a type-safe DSL builder.
Creates a ListPromptsRequest using a type-safe DSL builder.
Creates a ListResourcesRequest using a type-safe DSL builder.
Creates a ListResourceTemplatesRequest using a type-safe DSL builder.
Creates a ListRootsRequest using a type-safe DSL builder.
Creates a ListToolsRequest using a type-safe DSL builder.
Creates a PingRequest using a type-safe DSL builder.
Creates a ReadResourceRequest using a type-safe DSL builder.
Creates a SetLevelRequest using a type-safe DSL builder.
Creates a SubscribeRequest using a type-safe DSL builder.
Creates an UnsubscribeRequest using a type-safe DSL builder.
Creates an ElicitRequestFormParams for backwards compatibility.
Creates a CallToolResult with single TextContent and meta, with isError being true.
Decodes a JSON-RPC request into a protocol-specific Request.
Creates a ProgressToken from a numeric value.
Creates a ProgressToken from a string value.
Creates a CallToolResult with single TextContent and meta.
Converts the notification to a JSON-RPC notification.
Converts the request to a JSON-RPC request.
Adds a user message with simple text content.
Adds a user message with audio content.
Adds a user message with image content.
Adds a user message with text content using a DSL builder.