Package-level declarations

Types

Link copied to clipboard
data class Annotations(val audience: List<Role>? = null, val priority: Double? = null, val lastModified: String? = null)

Optional annotations for the client.

Link copied to clipboard
data class AudioContent(val data: String, val mimeType: String, val annotations: Annotations? = null, val meta: JsonObject? = null) : MediaContent

Audio provided to or from an LLM.

Link copied to clipboard

DSL builder for constructing AudioContent instances.

Link copied to clipboard

Base parameters for notifications that only contain metadata.

Link copied to clipboard
Link copied to clipboard
data class BlobResourceContents(val blob: String, val uri: String, val mimeType: String? = null, val meta: JsonObject? = null) : ResourceContents

The contents of a specific resource or sub-resource.

Link copied to clipboard

Used by the client to invoke a tool provided by the server.

Link copied to clipboard

DSL builder for constructing CallToolRequest instances.

Link copied to clipboard
data class CallToolRequestParams(val name: String, val arguments: JsonObject? = null, val meta: RequestMeta? = null) : RequestParams

Parameters for a tools/call request.

Link copied to clipboard
data class CallToolResult(val content: List<ContentBlock>, val isError: Boolean? = null, val structuredContent: JsonObject? = null, val meta: JsonObject? = null) : ServerResult

The server's response to a CallToolRequest.

Link copied to clipboard

This notification can be sent by either side to indicate that it is cancelling a previously-issued request.

Link copied to clipboard
data class CancelledNotificationParams(val requestId: RequestId, val reason: String? = null, val meta: JsonObject? = null) : NotificationParams

Parameters for a notifications/cancelled notification.

Link copied to clipboard
data class ClientCapabilities(val sampling: JsonObject? = null, val roots: ClientCapabilities.Roots? = null, val elicitation: JsonObject? = null, val experimental: JsonObject? = null)

Capabilities that a client may support.

Link copied to clipboard

DSL builder for constructing ClientCapabilities instances.

Link copied to clipboard

Represents a notification sent by the client.

Link copied to clipboard

Represents a request sent by the client.

Link copied to clipboard

A request from the client to the server to ask for completion options.

Link copied to clipboard

DSL builder for constructing CompleteRequest instances.

Link copied to clipboard
data class CompleteRequestParams(val argument: CompleteRequestParams.Argument, val ref: Reference, val context: CompleteRequestParams.Context? = null, val meta: RequestMeta? = null) : RequestParams

Parameters for the completion request.

Link copied to clipboard
data class CompleteResult(val completion: CompleteResult.Completion, val meta: JsonObject? = null) : ServerResult

The server's response to a CompleteRequest.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A request from the server to sample an LLM via the client.

Link copied to clipboard

DSL builder for constructing CreateMessageRequest instances.

Link copied to clipboard
data class CreateMessageRequestParams(val maxTokens: Int, val messages: List<SamplingMessage>, val modelPreferences: ModelPreferences? = null, val systemPrompt: String? = null, val includeContext: IncludeContext? = null, val temperature: Double? = null, val stopSequences: List<String>? = null, val metadata: JsonObject? = null, val meta: RequestMeta? = null) : RequestParams

Parameters for a sampling/createMessage request.

Link copied to clipboard
data class CreateMessageResult(val role: Role, val content: MediaContent, val model: String, val stopReason: StopReason? = null, val meta: JsonObject? = null) : ClientResult

The client's response to a CreateMessageRequest from the server.

Link copied to clipboard

Represents a custom notification method that is not part of the core MCP specification.

Link copied to clipboard
open class CustomRequest(val method: Method, val params: BaseRequestParams?) : Request

A custom request with a specified method.

Link copied to clipboard

A request from the server to elicit additional information from the user via the client.

Link copied to clipboard

DSL builder for constructing ElicitRequest instances.

Link copied to clipboard

DSL builder for constructing ElicitRequestParams.RequestedSchema instances.

Link copied to clipboard
data class ElicitRequestParams(val message: String, val requestedSchema: ElicitRequestParams.RequestedSchema, val meta: RequestMeta? = null) : RequestParams

Parameters for an elicitation/create request.

Link copied to clipboard
data class ElicitResult(val action: ElicitResult.Action, val content: JsonObject? = null, val meta: JsonObject? = null) : ClientResult

The client's response to an ElicitRequest.

Link copied to clipboard
data class EmbeddedResource(val resource: ResourceContents, val annotations: Annotations? = null, val meta: JsonObject? = null) : ContentBlock

The contents of a resource, embedded into a prompt or tool call result.

Link copied to clipboard

An empty result for a request containing optional metadata.

Link copied to clipboard

Used by the client to get a prompt provided by the server.

Link copied to clipboard

DSL builder for constructing GetPromptRequest instances.

Link copied to clipboard
data class GetPromptRequestParams(val name: String, val arguments: Map<String, String>? = null, val meta: RequestMeta? = null) : RequestParams

Parameters for a prompts/get request.

Link copied to clipboard
data class GetPromptResult(val messages: List<PromptMessage>, val description: String? = null, val meta: JsonObject? = null) : ServerResult

The server's response to a GetPromptRequest from the client.

Link copied to clipboard
data class Icon(val src: String, val mimeType: String? = null, val sizes: List<String>? = null, val theme: Icon.Theme? = null)

An optionally sized icon that can be displayed in a user interface.

Link copied to clipboard
data class ImageContent(val data: String, val mimeType: String, val annotations: Annotations? = null, val meta: JsonObject? = null) : MediaContent

An image provided to or from an LLM.

Link copied to clipboard

DSL builder for constructing ImageContent instances.

Link copied to clipboard
data class Implementation(val name: String, val version: String, val title: String? = null, val websiteUrl: String? = null, val icons: List<Icon>? = null)

Describes an MCP (Model Context Protocol) implementation.

Link copied to clipboard

Specifies which MCP server context to include in the sampling request.

Link copied to clipboard

This notification is sent from the client to the server after initialization has finished.

Link copied to clipboard

This request is sent from the client to the server when it first connects, asking it to begin initialization.

Link copied to clipboard

DSL builder for constructing InitializeRequest instances.

Link copied to clipboard
data class InitializeRequestParams(val protocolVersion: String, val capabilities: ClientCapabilities, val clientInfo: Implementation, val meta: RequestMeta? = null) : RequestParams

Parameters for an initialize request.

Link copied to clipboard
data class InitializeResult(val protocolVersion: String = LATEST_PROTOCOL_VERSION, val capabilities: ServerCapabilities, val serverInfo: Implementation, val instructions: String? = null, val meta: JsonObject? = null) : ServerResult

After receiving an InitializeRequest from the client, the server sends this response.

Link copied to clipboard
data class JSONRPCError(val id: RequestId, val error: RPCError) : JSONRPCMessage

A response to a request that indicates an error occurred.

Link copied to clipboard

Base interface for all JSON-RPC 2.0 messages.

Link copied to clipboard
data class JSONRPCNotification(val method: String, val params: JsonElement? = null) : JSONRPCMessage

A notification which does not expect a response.

Link copied to clipboard
data class JSONRPCRequest @JvmOverloads constructor(val id: RequestId = RequestId(Uuid.random().toHexString()), val method: String, val params: JsonElement? = null) : JSONRPCMessage

A request that expects a response.

Link copied to clipboard
data class JSONRPCResponse(val id: RequestId, val result: RequestResult = EmptyResult()) : JSONRPCMessage

A successful (non-error) response to a request.

Link copied to clipboard

Sent from the client to request a list of prompts and prompt templates the server has.

Link copied to clipboard

DSL builder for constructing ListPromptsRequest instances.

Link copied to clipboard
data class ListPromptsResult(val prompts: List<Prompt>, val nextCursor: String? = null, val meta: JsonObject? = null) : ServerResult, PaginatedResult

The server's response to a ListPromptsRequest from the client.

Link copied to clipboard

Sent from the client to request a list of resources the server has.

Link copied to clipboard

DSL builder for constructing ListResourcesRequest instances.

Link copied to clipboard
data class ListResourcesResult(val resources: List<Resource>, val nextCursor: String? = null, val meta: JsonObject? = null) : ServerResult, PaginatedResult

The server's response to a ListResourcesRequest from the client.

Link copied to clipboard

Sent from the client to request a list of resource templates the server has.

Link copied to clipboard
data class ListResourceTemplatesResult(val resourceTemplates: List<ResourceTemplate>, val nextCursor: String? = null, val meta: JsonObject? = null) : ServerResult, PaginatedResult

The server's response to a ListResourceTemplatesRequest from the client.

Link copied to clipboard

Sent from the server to request a list of root URIs from the client.

Link copied to clipboard

DSL builder for constructing ListRootsRequest instances.

Link copied to clipboard
data class ListRootsResult(val roots: List<Root>, val meta: JsonObject? = null) : ClientResult

The client's response to a ListRootsRequest from the server.

Link copied to clipboard

Sent from the client to request a list of tools the server has.

Link copied to clipboard

DSL builder for constructing ListToolsRequest instances.

Link copied to clipboard
data class ListToolsResult(val tools: List<Tool>, val nextCursor: String? = null, val meta: JsonObject? = null) : ServerResult, PaginatedResult

The server's response to a ListToolsRequest from the client.

Link copied to clipboard

The severity of a log message.

Link copied to clipboard

A notification of a log message passed from server to client.

Link copied to clipboard
data class LoggingMessageNotificationParams(val level: LoggingLevel, val data: JsonElement, val logger: String? = null, val meta: JsonObject? = null) : NotificationParams

Parameters for a notifications/message notification.

Link copied to clipboard
annotation class McpDsl

DSL marker annotation for MCP builder classes.

Link copied to clipboard
class McpException @JvmOverloads constructor(val code: Int, message: String, val data: JsonElement? = null, cause: Throwable? = null) : Exception

Represents an error specific to the MCP protocol.

Link copied to clipboard
abstract class MediaContentBuilder

Base DSL builder for constructing MediaContent instances.

Link copied to clipboard

Represents a method in the protocol, which can be predefined or custom.

Link copied to clipboard
data class ModelHint(val name: String?)

Hints to use for model selection.

Link copied to clipboard
data class ModelPreferences(val hints: List<ModelHint>? = null, val costPriority: Double? = null, val speedPriority: Double? = null, val intelligencePriority: Double? = null)

The server's preferences for model selection, requested of the client during sampling.

Link copied to clipboard

Represents a notification in the protocol.

Link copied to clipboard

Interface for notification parameter types.

Link copied to clipboard

Represents a request supporting pagination.

Link copied to clipboard

Base DSL builder for constructing paginated MCP request instances.

Link copied to clipboard
data class PaginatedRequestParams(val cursor: String? = null, val meta: RequestMeta? = null) : RequestParams

Common parameters for paginated requests.

Link copied to clipboard

Represents a request supporting pagination.

Link copied to clipboard
Link copied to clipboard

DSL builder for constructing PingRequest instances.

Link copied to clipboard
class Progress(val progress: Double, val total: Double? = null, val message: String? = null)

Represents a progress notification.

Link copied to clipboard

An out-of-band notification used to inform the receiver of a progress update for a long-running request.

Link copied to clipboard
data class ProgressNotificationParams(val progressToken: ProgressToken, val progress: Double, val total: Double? = null, val message: String? = null, val meta: JsonObject? = null) : NotificationParams

Parameters for a notifications/progress notification.

Link copied to clipboard

A progress token, used to associate progress notifications with the original request.

Link copied to clipboard
data class Prompt(val name: String, val description: String? = null, val arguments: List<PromptArgument>? = null, val title: String? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : WithMeta

A prompt or prompt template that the server offers.

Link copied to clipboard
data class PromptArgument(val name: String, val description: String? = null, val required: Boolean? = null, val title: String? = null)

Describes an argument that a prompt can accept.

Link copied to clipboard

An optional notification from the server to the client, informing it that the list of prompts it offers has changed.

Link copied to clipboard
data class PromptMessage(val role: Role, val content: ContentBlock)

Describes a message returned as part of a prompt.

Link copied to clipboard
data class PromptReference(val name: String, val title: String? = null) : Reference

Identifies a prompt by reference.

Link copied to clipboard

Sent from the client to the server to read a specific resource URI.

Link copied to clipboard

DSL builder for constructing ReadResourceRequest instances.

Link copied to clipboard
data class ReadResourceRequestParams(val uri: String, val meta: RequestMeta? = null) : RequestParams

Parameters for a resources/read request.

Link copied to clipboard
data class ReadResourceResult(val contents: List<ResourceContents>, val meta: JsonObject? = null) : ServerResult

The server's response to a ReadResourceRequest from the client.

Link copied to clipboard

Base interface for reference types in the protocol.

Link copied to clipboard
Link copied to clipboard

Represents a request in the protocol.

Link copied to clipboard
abstract class RequestBuilder

Base DSL builder for constructing MCP request instances.

Link copied to clipboard

A uniquely identifying ID for a request in JSON-RPC.

Link copied to clipboard
Link copied to clipboard

DSL builder for constructing RequestMeta instances.

Link copied to clipboard
sealed interface RequestParams
Link copied to clipboard

Represents the result of a request, including additional metadata.

Link copied to clipboard
data class Resource(val uri: String, val name: String, val description: String? = null, val mimeType: String? = null, val size: Long? = null, val title: String? = null, val annotations: Annotations? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : ResourceLike

A known resource that the server is capable of reading.

Link copied to clipboard

The contents of a specific resource or sub-resource.

Link copied to clipboard
Link copied to clipboard
data class ResourceLink(val name: String, val uri: String, val title: String? = null, val size: Long? = null, val mimeType: String? = null, val icons: List<Icon>? = null, val description: String? = null, val annotations: Annotations? = null, val meta: JsonObject? = null) : ContentBlock, ResourceLike

A resource that the server is capable of reading, included in a prompt or tool call result.

Link copied to clipboard

An optional notification from the server to the client, informing it that the list of resources it can read from has changed.

Link copied to clipboard
data class ResourceTemplate(val uriTemplate: String, val name: String, val description: String? = null, val mimeType: String? = null, val title: String? = null, val annotations: Annotations? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : WithMeta

A template description for resources available on the server.

Link copied to clipboard

A reference to a resource or resource template definition.

Link copied to clipboard

A notification from the server to the client, informing it that a resource has changed and may need to be read again.

Link copied to clipboard

Parameters for a notifications/resources/updated notification.

Link copied to clipboard

The sender or recipient of messages and data in a conversation.

Link copied to clipboard
data class Root(val uri: String, val name: String? = null, val meta: JsonObject? = null) : WithMeta

Represents a root directory or file that the server can operate on.

Link copied to clipboard

A notification from the client to the server, informing it that the list of roots has changed.

Link copied to clipboard
data class RPCError(val code: Int, val message: String, val data: JsonElement? = null)

Error information for a failed JSON-RPC request.

Link copied to clipboard
data class SamplingMessage(val role: Role, val content: MediaContent)

Describes a message issued to or received from an LLM API.

Link copied to clipboard

DSL builder for constructing lists of SamplingMessage instances.

Link copied to clipboard
data class ServerCapabilities(val tools: ServerCapabilities.Tools? = null, val resources: ServerCapabilities.Resources? = null, val prompts: ServerCapabilities.Prompts? = null, val logging: JsonObject? = null, val completions: JsonObject? = null, val experimental: JsonObject? = null)

Capabilities that a server may support.

Link copied to clipboard

Represents a notification sent by the server.

Link copied to clipboard

Represents a request sent by the server.

Link copied to clipboard

A request from the client to the server to enable or adjust logging.

Link copied to clipboard

DSL builder for constructing SetLevelRequest instances.

Link copied to clipboard
data class SetLevelRequestParams(val level: LoggingLevel, val meta: RequestMeta? = null) : RequestParams

Parameters for a logging/setLevel request.

Link copied to clipboard
value class StopReason(val value: String)
Link copied to clipboard

Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.

Link copied to clipboard

DSL builder for constructing SubscribeRequest instances.

Link copied to clipboard
data class SubscribeRequestParams(val uri: String, val meta: RequestMeta? = null) : RequestParams

Parameters for a resources/subscribe request.

Link copied to clipboard
data class TextContent(val text: String, val annotations: Annotations? = null, val meta: JsonObject? = null) : MediaContent

Text provided to or from an LLM.

Link copied to clipboard

DSL builder for constructing TextContent instances.

Link copied to clipboard
data class TextResourceContents(val text: String, val uri: String, val mimeType: String? = null, val meta: JsonObject? = null) : ResourceContents

Represents the text contents of a resource.

Link copied to clipboard
data class Tool(val name: String, val inputSchema: ToolSchema, val description: String? = null, val outputSchema: ToolSchema? = null, val title: String? = null, val annotations: ToolAnnotations? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : WithMeta

Definition for a tool the client can call.

Link copied to clipboard
data class ToolAnnotations(val title: String? = null, val readOnlyHint: Boolean? = null, val destructiveHint: Boolean? = null, val idempotentHint: Boolean? = null, val openWorldHint: Boolean? = null)

Additional properties describing a Tool to clients.

Link copied to clipboard

An optional notification from the server to the client, informing it that the list of tools it offers has changed.

Link copied to clipboard
data class ToolSchema(val properties: JsonObject? = null, val required: List<String>? = null)

A JSON Schema for tool input or output parameters.

Link copied to clipboard
data class UnknownResourceContents(val uri: String, val mimeType: String? = null, val meta: JsonObject? = null) : ResourceContents

Represents resource contents with unknown or unspecified data.

Link copied to clipboard

Sent from the client to request cancellation of resources/updated notifications from the server.

Link copied to clipboard

DSL builder for constructing UnsubscribeRequest instances.

Link copied to clipboard
data class UnsubscribeRequestParams(val uri: String, val meta: RequestMeta? = null) : RequestParams

Parameters for a resources/unsubscribe request.

Link copied to clipboard
sealed interface WithMeta

Represents an entity that includes additional metadata in its responses.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds an assistant message with simple text content.

Link copied to clipboard

Adds an assistant message with audio content.

Link copied to clipboard

Adds an assistant message with image content.

Link copied to clipboard

Adds an assistant message with text content using a DSL builder.

Link copied to clipboard
fun ERROR CLASS: Symbol not found for CallToolResult.Companion.error(content: String, meta: JsonObject? = null): CallToolResult

Creates a CallToolResult with single TextContent and meta, with isError being true.

Link copied to clipboard

Decodes a JSON-RPC request into a protocol-specific Request.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ERROR CLASS: Symbol not found for CallToolResult.Companion.success(content: String, meta: JsonObject? = null): CallToolResult

Creates a CallToolResult with single TextContent and meta.

Link copied to clipboard

Converts the notification to a JSON-RPC notification.

Converts the request to a JSON-RPC request.

Link copied to clipboard
Link copied to clipboard

Adds a user message with simple text content.

Link copied to clipboard

Adds a user message with audio content.

Link copied to clipboard

Adds a user message with image content.

Link copied to clipboard

Adds a user message with text content using a DSL builder.