Sign in

    colmugx/mcp/protocol/types does not have a README file

    MCPError

    pub(all) suberror MCPError {
    ParseError(String)
    InvalidRequest(String)
    MethodNotFound(String)
    InvalidParams(String)
    InternalError(String)
    TransportError(TransportError)
    ToolError(String)
    Cancelled(String)
    RemoteError(String, code~ : JsonInteger, data~ : Json?, extensions~ : Map[String, Json])
    HeaderMismatch(String)
    MissingRequiredClientCapability(String, required~ : ClientCapabilities)
    UnsupportedProtocolVersion(String, supported~ : Array[String], requested~ : String)
    } derive(Eq,
    Debug
    )

    MCP protocol-level errors These follow the JSON-RPC 2.0 error code conventions.

    Error code allocation (per 2026-07-28 spec):
    • -32700, -32600..-32603: standard JSON-RPC 2.0
    • -32000..-32019: legacy/implementation-defined (no new allocations)
    • -32020..-32099: reserved for the MCP specification

    MCPError::equal

    fn MCPError::equal(MCPError, MCPError) -> Bool

    MCPError::from_jsonrpc_error

    fn MCPError::from_jsonrpc_error(value : Json) -> MCPError raise MCPError

    Decode a peer error without collapsing its code or data to InternalError.

    MCPError::message

    fn MCPError::message(self : MCPError) -> String

    Get error message from MCPError

    MCPError::not_equal

    fn MCPError::not_equal(x : MCPError, y : MCPError) -> Bool

    MCPError::to_error_code

    fn MCPError::to_error_code(self : MCPError) -> JsonInteger

    Exact JSON-RPC error code. Use as_int() only when an Int32 projection is needed.

    MCPError::to_error_data

    fn MCPError::to_error_data(self : MCPError) -> Json?

    Serialize the structured data member of a JSON-RPC error response. Returns None for errors that carry no data per the spec. The -3202x MCP-spec-defined errors populate data with fields clients use for recovery (e.g. supported versions to retry with).

    MCPError::to_jsonrpc_error

    fn MCPError::to_jsonrpc_error(self : MCPError) -> Json

    MCPError::to_repr

    TransportError

    pub(all) suberror TransportError {
    ConnectionClosed
    ReadError(String)
    WriteError(String)
    Timeout
    InvalidState(String)
    Unauthorized(String)
    Forbidden(String)
    HttpError(Int, String)
    } derive(Eq,
    Debug
    )

    Transport-level errors These occur at the communication layer (network, IO, etc.)

    TransportError::equal

    TransportError::not_equal

    fn TransportError::not_equal(x : TransportError, y : TransportError) -> Bool

    TransportError::output

    fn TransportError::output(self : TransportError, logger : &Logger) -> Unit

    TransportError::to_repr

    Explicit trait method promotion for current MoonBit toolchains.

    TransportError::to_string

    fn TransportError::to_string(self : TransportError) -> String

    Annotations

    pub(all) struct Annotations {
    audience : Array[Role]?
    priority : JsonNumber?
    last_modified : String?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Annotation priority keeps the exact decimal literal (pinned schema: number, minimum 0, maximum 1); the range check never rounds through Double, so boundary spellings outside the interval stay invalid.

    Annotations::equal

    fn Annotations::equal(Annotations, Annotations) -> Bool

    Annotations::from_json

    fn Annotations::from_json(value : Json) -> Annotations raise MCPError

    Annotations::not_equal

    fn Annotations::not_equal(x : Annotations, y : Annotations) -> Bool

    Annotations::to_json

    fn Annotations::to_json(self : Annotations) -> Json

    CacheScope

    pub(all) enum CacheScope {
    Public
    Private
    } derive(Eq,
    Debug
    )

    CacheScope::equal

    fn CacheScope::equal(CacheScope, CacheScope) -> Bool

    CacheScope::not_equal

    fn CacheScope::not_equal(x : CacheScope, y : CacheScope) -> Bool

    CancelledNotification

    pub(all) struct CancelledNotification {
    request_id : RequestId
    reason : String?
    } derive(Eq,
    Debug
    )

    CancelledNotification — params for notifications/cancelled

    CancelledNotification::equal

    CancelledNotification::not_equal

    ClientCapabilities

    pub(all) struct ClientCapabilities {
    experimental : Map[String, Json]?
    roots : RootCapabilities?
    sampling : SamplingCapabilities?
    elicitation : ElicitationCapabilities?
    extra_fields : Map[String, Json]
    extensions : Map[String, Json]?
    } derive(Eq,
    Debug
    )

    Client Capabilities — declared during initialization

    ClientCapabilities::equal

    ClientCapabilities::from_json

    fn ClientCapabilities::from_json(value : Json) -> ClientCapabilities raise MCPError

    ClientCapabilities::new

    fn ClientCapabilities::new(experimental? : Map[String, Json], roots? : RootCapabilities, sampling? : SamplingCapabilities, elicitation? : ElicitationCapabilities, extensions? : Map[String, Json]) -> ClientCapabilities

    ClientCapabilities::not_equal

    ClientCapabilities::to_json

    ClientInfo

    pub(all) struct ClientInfo {
    name : String
    title : String?
    version : String
    } derive(Eq,
    Debug
    )

    Client Info — sent during initialization

    ClientInfo::equal

    fn ClientInfo::equal(ClientInfo, ClientInfo) -> Bool

    ClientInfo::not_equal

    fn ClientInfo::not_equal(x : ClientInfo, y : ClientInfo) -> Bool

    ClientInfo::to_repr

    Explicit trait method promotion for current MoonBit toolchains.

    CompleteRequestParams

    pub(all) struct CompleteRequestParams {
    reference : CompletionReference
    argument : CompletionArgument
    context : CompletionContext?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    CompleteRequestParams::equal

    CompleteRequestParams::from_json

    CompleteRequestParams::new

    fn CompleteRequestParams::new(reference : CompletionReference, argument : CompletionArgument, context? : CompletionContext, meta? : Map[String, Json]) -> CompleteRequestParams

    CompleteRequestParams::not_equal

    CompleteRequestParams::to_json

    CompletionArgument

    pub(all) struct CompletionArgument {
    name : String
    value : String
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    CompletionArgument::equal

    CompletionArgument::new

    fn CompletionArgument::new(name : String, value : String) -> CompletionArgument

    CompletionArgument::not_equal

    CompletionContext

    pub(all) struct CompletionContext {
    arguments : Map[String, String]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    CompletionContext::equal

    CompletionContext::new

    fn CompletionContext::new(arguments? : Map[String, String]) -> CompletionContext

    CompletionContext::not_equal

    fn CompletionContext::not_equal(x : CompletionContext, y : CompletionContext) -> Bool

    CompletionReference

    pub(all) enum CompletionReference {
    Prompt(name~ : String, title~ : String?, extensions~ : Map[String, Json])
    Resource(uri~ : String, extensions~ : Map[String, Json])
    } derive(Eq,
    Debug
    )

    CompletionReference::equal

    CompletionReference::from_json

    fn CompletionReference::from_json(value : Json) -> CompletionReference raise MCPError

    CompletionReference::not_equal

    CompletionReference::prompt

    fn CompletionReference::prompt(name : String, title? : String) -> CompletionReference

    CompletionReference::resource

    fn CompletionReference::resource(uri : String) -> CompletionReference

    CompletionReference::to_json

    CompletionResult

    pub(all) struct CompletionResult {
    values : Array[String]
    total : JsonInteger?
    has_more : Bool?
    completion_extensions : Map[String, Json]
    metadata : ResultMetadata
    } derive(Eq,
    Debug
    )

    Complete wire result, including open completion fields and result metadata. total keeps the exact integer literal (pinned schema: integer); a Double total cannot represent the count losslessly.

    CompletionResult::equal

    CompletionResult::from_json

    fn CompletionResult::from_json(value : Json) -> CompletionResult raise MCPError

    CompletionResult::new

    fn CompletionResult::new(values : Array[String], total? : Int, has_more? : Bool, metadata? : ResultMetadata) -> CompletionResult

    CompletionResult::not_equal

    fn CompletionResult::not_equal(x : CompletionResult, y : CompletionResult) -> Bool

    CompletionResult::to_json

    fn CompletionResult::to_json(self : CompletionResult) -> Json

    ContentBlock

    pub(all) enum ContentBlock {
    Text(String, metadata~ : ContentMetadata)
    Image(String, mime_type~ : String, metadata~ : ContentMetadata)
    Audio(String, mime_type~ : String, metadata~ : ContentMetadata)
    ResourceLink(ResourceLinkData, metadata~ : ContentMetadata)
    EmbeddedResource(ResourceContents, metadata~ : ContentMetadata)
    Unknown(Json)
    } derive(Eq,
    Debug
    )

    ContentBlock::audio

    fn ContentBlock::audio(data : String, mime_type~ : String, metadata? : ContentMetadata) -> ContentBlock

    ContentBlock::equal

    ContentBlock::from_json

    fn ContentBlock::from_json(value : Json) -> ContentBlock raise MCPError

    ContentBlock::image

    fn ContentBlock::image(data : String, mime_type~ : String, metadata? : ContentMetadata) -> ContentBlock

    ContentBlock::not_equal

    fn ContentBlock::not_equal(x : ContentBlock, y : ContentBlock) -> Bool

    ContentBlock::resource

    fn ContentBlock::resource(resource : ResourceContents, metadata? : ContentMetadata) -> ContentBlock

    fn ContentBlock::resource_link(uri : String, name~ : String, title? : String, description? : String, mime_type? : String, size? : Int, icons? : Array[Icon], metadata? : ContentMetadata) -> ContentBlock

    ContentBlock::text

    fn ContentBlock::text(text : String, metadata? : ContentMetadata) -> ContentBlock

    ContentBlock::to_json

    fn ContentBlock::to_json(self : ContentBlock) -> Json

    ContentMetadata

    pub(all) struct ContentMetadata {
    annotations : Annotations?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ContentMetadata::empty

    ContentMetadata::equal

    ContentMetadata::not_equal

    fn ContentMetadata::not_equal(x : ContentMetadata, y : ContentMetadata) -> Bool

    CreateMessageRequest

    pub(all) struct CreateMessageRequest {
    messages : Array[SamplingMessage]
    max_tokens : JsonInteger
    model_preferences : ModelPreferences?
    system_prompt : String?
    include_context : SamplingContext?
    temperature : JsonNumber?
    stop_sequences : Array[String]?
    metadata : Map[String, Json]?
    tools : Array[ToolDefinition]?
    tool_choice : ToolChoice?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    CreateMessageRequest — server asks client to sample an LLM. max_tokens keeps the exact integer literal (pinned schema: integer); temperature keeps the exact decimal literal (pinned schema: number).

    CreateMessageRequest::equal

    CreateMessageRequest::from_json

    fn CreateMessageRequest::from_json(value : Json) -> CreateMessageRequest raise MCPError

    CreateMessageRequest::new

    fn CreateMessageRequest::new(messages : Array[SamplingMessage], max_tokens : Int, model_preferences? : ModelPreferences, system_prompt? : String, include_context? : SamplingContext, temperature? : Double, stop_sequences? : Array[String], metadata? : Map[String, Json], tools? : Array[ToolDefinition], tool_choice? : ToolChoice) -> CreateMessageRequest raise

    Ergonomic constructor for exact typed fields: max_tokens accepts an Int (counts stay lossless), temperature accepts a Double whose shortest round-trip literal is kept. Non-finite temperatures fail instead of serializing invalid JSON. Wire-exact values beyond these can be set on the public record directly.

    CreateMessageRequest::not_equal

    CreateMessageRequest::to_json

    CreateMessageResult

    pub(all) struct CreateMessageResult {
    role : Role
    model : String
    content : SamplingContent
    stop_reason : String?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    CreateMessageResult — client's response to a sampling request

    CreateMessageResult::equal

    CreateMessageResult::from_json

    fn CreateMessageResult::from_json(value : Json) -> CreateMessageResult raise MCPError

    CreateMessageResult::new

    fn CreateMessageResult::new(role : Role, model : String, content : SamplingContent, stop_reason? : String, meta? : Map[String, Json]) -> CreateMessageResult

    CreateMessageResult::not_equal

    CreateMessageResult::text

    fn CreateMessageResult::text(model : String, content : String, stop_reason? : String) -> CreateMessageResult

    CreateMessageResult::to_json

    DiscoverResult

    pub(all) struct DiscoverResult {
    supported_versions : Array[String]
    capabilities : ServerCapabilities
    instructions : String?
    metadata : ResultMetadata
    } derive(Eq,
    Debug
    )

    Full discovery result, including cache hints and server identity metadata.

    DiscoverResult::equal

    DiscoverResult::from_json

    fn DiscoverResult::from_json(value : Json) -> DiscoverResult raise MCPError

    DiscoverResult::new

    fn DiscoverResult::new(supported_versions : Array[String], capabilities : ServerCapabilities, instructions? : String, metadata? : ResultMetadata) -> DiscoverResult

    DiscoverResult::not_equal

    fn DiscoverResult::not_equal(x : DiscoverResult, y : DiscoverResult) -> Bool

    DiscoverResult::to_json

    fn DiscoverResult::to_json(self : DiscoverResult) -> Json

    ElicitationAction

    pub(all) enum ElicitationAction {
    Accept
    Decline
    Cancel
    } derive(Eq,
    Debug
    )

    ElicitationAction::equal

    ElicitationAction::from_json

    fn ElicitationAction::from_json(value : Json) -> ElicitationAction raise MCPError

    ElicitationAction::not_equal

    fn ElicitationAction::not_equal(x : ElicitationAction, y : ElicitationAction) -> Bool

    ElicitationAction::to_json

    ElicitationCapabilities

    pub(all) struct ElicitationCapabilities {
    form : Map[String, Json]?
    url : Map[String, Json]?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Elicitation Capabilities — client supports user interaction requests

    ElicitationCapabilities::equal

    ElicitationCapabilities::from_json

    ElicitationCapabilities::new

    fn ElicitationCapabilities::new(form? : Map[String, Json], url? : Map[String, Json]) -> ElicitationCapabilities

    ElicitationCapabilities::not_equal

    ElicitationCapabilities::to_json

    ElicitationRequest

    pub(all) enum ElicitationRequest {
    Form(String, requested_schema~ : Json, explicit_mode~ : Bool, meta~ : Map[String, Json]?, extensions~ : Map[String, Json])
    Url(String, url~ : String, elicitation_id~ : String?, meta~ : Map[String, Json]?, extensions~ : Map[String, Json])
    } derive(Eq,
    Debug
    )

    ElicitationRequest — server asks client to interact with the user

    ElicitationRequest::equal

    ElicitationRequest::form

    fn ElicitationRequest::form(message : String, requested_schema : Json, explicit_mode? : Bool, meta? : Map[String, Json]) -> ElicitationRequest

    ElicitationRequest::from_json

    fn ElicitationRequest::from_json(value : Json) -> ElicitationRequest raise MCPError

    ElicitationRequest::not_equal

    ElicitationRequest::to_json

    ElicitationRequest::url

    fn ElicitationRequest::url(message : String, url : String, elicitation_id? : String, meta? : Map[String, Json]) -> ElicitationRequest

    ElicitationResult

    pub(all) struct ElicitationResult {
    action : ElicitationAction
    content : Map[String, ElicitationValue]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ElicitationResult — client's response to an elicitation request

    ElicitationResult::equal

    ElicitationResult::from_json

    fn ElicitationResult::from_json(value : Json) -> ElicitationResult raise MCPError

    ElicitationResult::new

    ElicitationResult::not_equal

    fn ElicitationResult::not_equal(x : ElicitationResult, y : ElicitationResult) -> Bool

    ElicitationResult::to_json

    ElicitationValue

    pub(all) enum ElicitationValue {
    String(String)
    Number(Double)
    ExactNumber(JsonNumber)
    Boolean(Bool)
    Strings(Array[String])
    } derive(
    Debug
    )

    Elicitation form values. Numeric content keeps its wire literal through ExactNumber, mirroring ProgressToken; Number remains a convenience constructor for programmatic values.

    ElicitationValue::equal

    fn ElicitationValue::equal(self : ElicitationValue, other : ElicitationValue) -> Bool

    ElicitationValue::from_json

    fn ElicitationValue::from_json(value : Json) -> ElicitationValue raise MCPError

    ElicitationValue::not_equal

    fn ElicitationValue::not_equal(x : ElicitationValue, y : ElicitationValue) -> Bool

    ElicitationValue::to_json

    fn ElicitationValue::to_json(self : ElicitationValue) -> Json

    GetPromptResult

    pub(all) struct GetPromptResult {
    description : String?
    messages : Array[PromptMessage]
    metadata : ResultMetadata
    } derive(Eq,
    Debug
    )

    GetPromptResult::equal

    GetPromptResult::from_json

    fn GetPromptResult::from_json(value : Json) -> GetPromptResult raise MCPError

    GetPromptResult::new

    fn GetPromptResult::new(messages : Array[PromptMessage], description? : String, metadata? : ResultMetadata) -> GetPromptResult

    GetPromptResult::not_equal

    fn GetPromptResult::not_equal(x : GetPromptResult, y : GetPromptResult) -> Bool

    GetPromptResult::to_json

    fn GetPromptResult::to_json(self : GetPromptResult) -> Json

    Icon

    pub(all) struct Icon {
    src : String
    mime_type : String?
    sizes : Array[String]?
    theme : IconTheme?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    impl ToJson for Icon

    Icon::equal

    fn Icon::equal(Icon, Icon) -> Bool

    Icon::from_json

    fn Icon::from_json(value : Json) -> Icon raise MCPError

    Icon::not_equal

    fn Icon::not_equal(x : Icon, y : Icon) -> Bool

    Icon::to_json

    fn Icon::to_json(self : Icon) -> Json

    Icon::to_repr

    IconTheme

    pub(all) enum IconTheme {
    Light
    Dark
    } derive(Eq,
    Debug
    )

    IconTheme::equal

    fn IconTheme::equal(IconTheme, IconTheme) -> Bool

    IconTheme::not_equal

    fn IconTheme::not_equal(x : IconTheme, y : IconTheme) -> Bool

    InputRequestEntry

    pub(all) struct InputRequestEntry {
    method_name : InputRequestKind
    params : Json
    } derive(Eq,
    Debug
    )

    One entry in an inputRequests map: a server-assigned key plus the request method and params the client must fulfill.

    InputRequestEntry::equal

    InputRequestEntry::not_equal

    fn InputRequestEntry::not_equal(x : InputRequestEntry, y : InputRequestEntry) -> Bool

    InputRequestKind

    pub(all) enum InputRequestKind {
    ElicitationCreate
    SamplingCreateMessage
    RootsList
    } derive(Eq,
    Debug
    )

    The three server→client input request methods. Servers MUST NOT send an input request the client did not declare support for in its capabilities.

    InputRequestKind::equal

    InputRequestKind::not_equal

    fn InputRequestKind::not_equal(x : InputRequestKind, y : InputRequestKind) -> Bool

    InputRequestKind::to_method

    fn InputRequestKind::to_method(self : InputRequestKind) -> String

    Convert an InputRequestKind to its JSON-RPC method string.

    JsonInteger

    pub struct JsonInteger {
    wire : Json
    canonical : String
    } derive(
    Debug
    )

    A mathematical JSON integer retaining its wire literal, without an Int32 or binary64 limit. Equivalent decimal/exponent spellings have the same key.
    impl Eq for JsonInteger

    JsonInteger::as_int

    fn JsonInteger::as_int(self : JsonInteger) -> Int?

    Returns None rather than narrowing an out-of-range integer.

    JsonInteger::equal

    fn JsonInteger::equal(self : JsonInteger, other : JsonInteger) -> Bool

    JsonInteger::from_int

    fn JsonInteger::from_int(value : Int) -> JsonInteger

    JsonInteger::from_json

    fn JsonInteger::from_json(value : Json) -> JsonInteger raise MCPError

    JsonInteger::from_literal

    fn JsonInteger::from_literal(literal : String) -> JsonInteger raise MCPError

    JsonInteger::is_nonnegative

    fn JsonInteger::is_nonnegative(self : JsonInteger) -> Bool

    Exact nonnegative test on the canonical identity; never rounds through Double, so fractional boundary literals stay invalid.

    JsonInteger::key

    fn JsonInteger::key(self : JsonInteger) -> String

    Compact canonical identity; huge exponents do not allocate expanded zeros.

    JsonInteger::not_equal

    fn JsonInteger::not_equal(x : JsonInteger, y : JsonInteger) -> Bool

    JsonInteger::to_json

    fn JsonInteger::to_json(self : JsonInteger) -> Json

    JsonInteger::to_json_string

    fn JsonInteger::to_json_string(self : JsonInteger) -> String

    JsonNumber

    pub struct JsonNumber {
    wire : Json
    canonical : String
    } derive(
    Debug
    )

    Exact JSON numeric identity and wire spelling, including fractional tokens. This is not an arithmetic API; conversion to Double is explicitly lossy.
    impl Eq for JsonNumber

    JsonNumber::as_double

    fn JsonNumber::as_double(self : JsonNumber) -> Double

    Explicitly lossy Double view for display or limit checks; the wire identity and equality stay exact.

    JsonNumber::compare

    fn JsonNumber::compare(self : JsonNumber, other : JsonNumber) -> Int

    Exact mathematical ordering, including fractional spellings. Comparison uses canonical identities, never rounded doubles, and does not expand huge exponents.

    JsonNumber::equal

    fn JsonNumber::equal(self : JsonNumber, other : JsonNumber) -> Bool

    JsonNumber::from_double

    fn JsonNumber::from_double(value : Double) -> JsonNumber raise MCPError

    Lossless for the Double itself: the shortest round-trip literal is kept, so programmatic doubles serialize exactly. Digits already lost to binary64 cannot be recovered; non-finite doubles have no JSON literal.

    JsonNumber::from_json

    fn JsonNumber::from_json(value : Json) -> JsonNumber raise MCPError

    JsonNumber::from_literal

    fn JsonNumber::from_literal(literal : String) -> JsonNumber raise MCPError

    JsonNumber::key

    fn JsonNumber::key(self : JsonNumber) -> String

    JsonNumber::not_equal

    fn JsonNumber::not_equal(x : JsonNumber, y : JsonNumber) -> Bool

    JsonNumber::to_json

    fn JsonNumber::to_json(self : JsonNumber) -> Json

    JsonRpcRequest

    pub(all) struct JsonRpcRequest {
    jsonrpc : String
    id : RequestId
    method_name : String
    params : Json
    } derive(Eq,
    Debug
    )

    JsonRpcRequest::equal

    JsonRpcRequest::from_json

    fn JsonRpcRequest::from_json(json : Json) -> JsonRpcRequest raise MCPError

    JsonRpcRequest::not_equal

    fn JsonRpcRequest::not_equal(x : JsonRpcRequest, y : JsonRpcRequest) -> Bool

    ModelHint

    pub(all) struct ModelHint {
    name : String?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    impl ToJson for ModelHint

    ModelHint::equal

    fn ModelHint::equal(ModelHint, ModelHint) -> Bool

    ModelHint::from_json

    fn ModelHint::from_json(value : Json) -> ModelHint raise MCPError

    ModelHint::new

    fn ModelHint::new(name? : String) -> ModelHint

    ModelHint::not_equal

    fn ModelHint::not_equal(x : ModelHint, y : ModelHint) -> Bool

    ModelHint::to_json

    fn ModelHint::to_json(self : ModelHint) -> Json

    ModelPreferences

    pub(all) struct ModelPreferences {
    hints : Array[ModelHint]?
    cost_priority : JsonNumber?
    speed_priority : JsonNumber?
    intelligence_priority : JsonNumber?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Sampling priorities keep exact decimal literals (pinned schema: number with minimum 0 and maximum 1); range checks never round through Double.

    ModelPreferences::equal

    ModelPreferences::from_json

    fn ModelPreferences::from_json(value : Json) -> ModelPreferences raise MCPError

    ModelPreferences::new

    fn ModelPreferences::new(hints? : Array[ModelHint], cost_priority? : Double, speed_priority? : Double, intelligence_priority? : Double) -> ModelPreferences raise

    ModelPreferences::not_equal

    fn ModelPreferences::not_equal(x : ModelPreferences, y : ModelPreferences) -> Bool

    ModelPreferences::to_json

    fn ModelPreferences::to_json(self : ModelPreferences) -> Json

    Notification

    pub(all) struct Notification {
    method_name : String
    params : Json?
    } derive(Eq,
    Debug
    )

    Server notification sent to clients Follows MCP spec notification format

    Notification::equal

    Explicit trait method promotion for current MoonBit toolchains.

    Notification::not_equal

    fn Notification::not_equal(x : Notification, y : Notification) -> Bool

    Explicit trait method promotion for current MoonBit toolchains.

    Notification::to_jsonrpc_string

    fn Notification::to_jsonrpc_string(self : Notification) -> String

    Serialize notification to JSON-RPC string

    ProgressNotification

    pub(all) struct ProgressNotification {
    progress_token : ProgressToken
    progress : JsonNumber
    total : JsonNumber?
    message : String?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ProgressNotification — params for notifications/progress. Counters keep exact decimal literals (pinned schema: number).

    ProgressNotification::equal

    ProgressNotification::from_json

    fn ProgressNotification::from_json(value : Json) -> ProgressNotification raise MCPError

    ProgressNotification::not_equal

    ProgressNotification::to_json

    ProgressToken

    pub(all) enum ProgressToken {
    String(String)
    Number(Double)
    ExactNumber(JsonNumber)
    } derive(
    Debug
    )

    Opaque progress identifier. Numeric tokens are not coerced to strings or integers.
    impl Eq for ProgressToken

    ProgressToken::equal

    fn ProgressToken::equal(self : ProgressToken, other : ProgressToken) -> Bool

    ProgressToken::from_json

    fn ProgressToken::from_json(value : Json) -> ProgressToken raise MCPError

    ProgressToken::not_equal

    fn ProgressToken::not_equal(x : ProgressToken, y : ProgressToken) -> Bool

    ProgressToken::to_json

    fn ProgressToken::to_json(self : ProgressToken) -> Json

    PromptArgument

    pub(all) struct PromptArgument {
    name : String
    title : String?
    description : String?
    required : Bool?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    PromptArgument::equal

    PromptArgument::from_json

    fn PromptArgument::from_json(value : Json) -> PromptArgument raise MCPError

    PromptArgument::new

    fn PromptArgument::new(name : String, title? : String, description? : String, required? : Bool) -> PromptArgument

    PromptArgument::not_equal

    fn PromptArgument::not_equal(x : PromptArgument, y : PromptArgument) -> Bool

    PromptArgument::to_json

    fn PromptArgument::to_json(self : PromptArgument) -> Json

    PromptCapabilities

    pub(all) struct PromptCapabilities {
    list_changed : Bool?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    PromptCapabilities::equal

    PromptCapabilities::from_json

    fn PromptCapabilities::from_json(value : Json) -> PromptCapabilities raise MCPError

    PromptCapabilities::new

    fn PromptCapabilities::new(list_changed? : Bool) -> PromptCapabilities

    PromptCapabilities::not_equal

    PromptCapabilities::to_json

    PromptDefinition

    pub(all) struct PromptDefinition {
    name : String
    title : String?
    description : String?
    arguments : Array[PromptArgument]?
    icons : Array[Icon]?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    PromptDefinition::equal

    PromptDefinition::from_json

    fn PromptDefinition::from_json(value : Json) -> PromptDefinition raise MCPError

    PromptDefinition::new

    fn PromptDefinition::new(name : String, title? : String, description? : String, arguments? : Array[PromptArgument], icons? : Array[Icon], meta? : Map[String, Json]) -> PromptDefinition

    PromptDefinition::not_equal

    fn PromptDefinition::not_equal(x : PromptDefinition, y : PromptDefinition) -> Bool

    PromptDefinition::to_json

    fn PromptDefinition::to_json(self : PromptDefinition) -> Json

    PromptMessage

    pub(all) struct PromptMessage {
    role : String
    content : ContentBlock
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    PromptMessage::equal

    PromptMessage::from_json

    fn PromptMessage::from_json(value : Json) -> PromptMessage raise MCPError

    PromptMessage::new

    fn PromptMessage::new(role : Role, content : ContentBlock) -> PromptMessage

    PromptMessage::not_equal

    fn PromptMessage::not_equal(x : PromptMessage, y : PromptMessage) -> Bool

    PromptMessage::to_json

    fn PromptMessage::to_json(self : PromptMessage) -> Json

    RequestId

    pub(all) enum RequestId {
    Int(Int)
    Number(JsonInteger)
    Str(String)
    } derive(
    Debug
    )

    Request ID supporting exact JSON integers and strings. Int is a convenience constructor; Number retains arbitrary-size wire integers.
    impl Eq for RequestId

    RequestId::equal

    fn RequestId::equal(self : RequestId, other : RequestId) -> Bool

    RequestId::from_json

    fn RequestId::from_json(value : Json) -> RequestId raise MCPError

    RequestId::key

    fn RequestId::key(self : RequestId) -> String

    Type-tagged canonical identity for routing, duplicate checks and cancellation.

    RequestId::not_equal

    fn RequestId::not_equal(x : RequestId, y : RequestId) -> Bool

    RequestId::to_json

    fn RequestId::to_json(self : RequestId) -> Json

    RequestId::to_json_string

    fn RequestId::to_json_string(self : RequestId) -> String

    Convert RequestId to its JSON string representation

    ResourceCapabilities

    pub(all) struct ResourceCapabilities {
    subscribe : Bool?
    list_changed : Bool?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ResourceCapabilities::equal

    ResourceCapabilities::from_json

    fn ResourceCapabilities::from_json(value : Json) -> ResourceCapabilities raise MCPError

    ResourceCapabilities::new

    fn ResourceCapabilities::new(subscribe? : Bool, list_changed? : Bool) -> ResourceCapabilities

    ResourceCapabilities::not_equal

    ResourceCapabilities::to_json

    ResourceContents

    pub(all) struct ResourceContents {
    uri : String
    mime_type : String?
    data : ResourceData
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ResourceContents::blob

    fn ResourceContents::blob(blob : String, uri~ : String, mime_type? : String) -> ResourceContents

    ResourceContents::equal

    ResourceContents::from_json

    fn ResourceContents::from_json(value : Json) -> ResourceContents raise MCPError

    ResourceContents::not_equal

    fn ResourceContents::not_equal(x : ResourceContents, y : ResourceContents) -> Bool

    ResourceContents::text

    fn ResourceContents::text(text : String, uri~ : String, mime_type? : String) -> ResourceContents

    ResourceContents::to_json

    fn ResourceContents::to_json(self : ResourceContents) -> Json

    ResourceData

    pub(all) enum ResourceData {
    Text(String)
    Blob(String)
    } derive(Eq,
    Debug
    )

    ResourceData::equal

    ResourceData::not_equal

    fn ResourceData::not_equal(x : ResourceData, y : ResourceData) -> Bool

    ResourceDefinition

    pub(all) struct ResourceDefinition {
    uri : String
    name : String
    title : String?
    description : String?
    mime_type : String?
    size : JsonInteger?
    icons : Array[Icon]?
    metadata : ContentMetadata
    } derive(Eq,
    Debug
    )

    ResourceDefinition::equal

    ResourceDefinition::from_json

    fn ResourceDefinition::from_json(value : Json) -> ResourceDefinition raise MCPError

    ResourceDefinition::new

    fn ResourceDefinition::new(uri : String, name : String, title? : String, description? : String, mime_type? : String, size? : Int, icons? : Array[Icon], metadata? : ContentMetadata) -> ResourceDefinition

    ResourceDefinition::not_equal

    ResourceDefinition::to_json

    ResourceLinkData

    pub(all) struct ResourceLinkData {
    uri : String
    name : String
    title : String?
    description : String?
    mime_type : String?
    size : JsonInteger?
    icons : Array[Icon]?
    } derive(Eq,
    Debug
    )

    ResourceLinkData::equal

    ResourceLinkData::not_equal

    fn ResourceLinkData::not_equal(x : ResourceLinkData, y : ResourceLinkData) -> Bool

    ResourceReadResult

    pub(all) struct ResourceReadResult {
    contents : Array[ResourceContents]
    metadata : ResultMetadata
    } derive(Eq,
    Debug
    )

    ResourceReadResult::blob

    fn ResourceReadResult::blob(blob : String, uri~ : String, mime_type? : String) -> ResourceReadResult

    ResourceReadResult::equal

    ResourceReadResult::from_json

    fn ResourceReadResult::from_json(value : Json) -> ResourceReadResult raise MCPError

    ResourceReadResult::new

    ResourceReadResult::not_equal

    ResourceReadResult::text

    fn ResourceReadResult::text(text : String, uri~ : String, mime_type? : String) -> ResourceReadResult

    ResourceReadResult::to_json

    ResourceTemplateDefinition

    pub(all) struct ResourceTemplateDefinition {
    uri_template : String
    name : String
    title : String?
    description : String?
    mime_type : String?
    icons : Array[Icon]?
    metadata : ContentMetadata
    } derive(Eq,
    Debug
    )

    ResourceTemplateDefinition::equal

    ResourceTemplateDefinition::from_json

    ResourceTemplateDefinition::new

    fn ResourceTemplateDefinition::new(uri_template : String, name : String, title? : String, description? : String, mime_type? : String, icons? : Array[Icon], metadata? : ContentMetadata) -> ResourceTemplateDefinition

    ResourceTemplateDefinition::not_equal

    ResourceTemplateDefinition::to_json

    ResourceUpdatedNotification

    pub(all) struct ResourceUpdatedNotification {
    uri : String
    } derive(Eq,
    Debug
    )

    ResourceUpdatedNotification — params for notifications/resources/updated

    ResourceUpdatedNotification::not_equal

    ResultMetadata

    pub(all) struct ResultMetadata {
    result_type : String?
    ttl_ms : JsonInteger?
    cache_scope : CacheScope?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Shared result fields retain wire presence; extensions are top-level fields. ttl_ms keeps the exact integer literal the server sent (pinned schema: integer, minimum 0) instead of a rounded Double.

    ResultMetadata::empty

    ResultMetadata::equal

    ResultMetadata::from_json

    fn ResultMetadata::from_json(value : Json, body_fields~ : Array[String]) -> ResultMetadata raise MCPError

    Decode metadata without retaining the caller's owned result-body fields.

    ResultMetadata::not_equal

    fn ResultMetadata::not_equal(x : ResultMetadata, y : ResultMetadata) -> Bool

    ResultMetadata::server_info

    fn ResultMetadata::server_info(self : ResultMetadata) -> Json?

    ResultMetadata::to_json

    fn ResultMetadata::to_json(self : ResultMetadata) -> Json

    Role

    pub(all) enum Role {
    User
    Assistant
    } derive(Eq,
    Debug
    )

    impl ToJson for Role

    Role::equal

    fn Role::equal(Role, Role) -> Bool

    Role::not_equal

    fn Role::not_equal(x : Role, y : Role) -> Bool

    Role::to_json

    fn Role::to_json(self : Role) -> Json

    Role::to_repr

    Root

    pub(all) struct Root {
    uri : String
    name : String?
    } derive(Eq,
    Debug
    )

    Root — a filesystem root exposed by the client for roots/list

    Root::equal

    fn Root::equal(Root, Root) -> Bool

    Root::not_equal

    fn Root::not_equal(x : Root, y : Root) -> Bool

    Root::to_repr

    RootCapabilities

    pub(all) struct RootCapabilities {
    list_changed : Bool?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Root Capabilities — client can provide filesystem roots

    RootCapabilities::equal

    RootCapabilities::from_json

    fn RootCapabilities::from_json(value : Json) -> RootCapabilities raise MCPError

    RootCapabilities::new

    fn RootCapabilities::new(list_changed? : Bool) -> RootCapabilities

    RootCapabilities::not_equal

    fn RootCapabilities::not_equal(x : RootCapabilities, y : RootCapabilities) -> Bool

    RootCapabilities::to_json

    fn RootCapabilities::to_json(self : RootCapabilities) -> Json

    SamplingCapabilities

    pub(all) struct SamplingCapabilities {
    context : Map[String, Json]?
    tools : Map[String, Json]?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Sampling Capabilities — client supports LLM sampling requests

    SamplingCapabilities::equal

    SamplingCapabilities::from_json

    fn SamplingCapabilities::from_json(value : Json) -> SamplingCapabilities raise MCPError

    SamplingCapabilities::new

    fn SamplingCapabilities::new(context? : Map[String, Json], tools? : Map[String, Json]) -> SamplingCapabilities

    SamplingCapabilities::not_equal

    SamplingCapabilities::to_json

    SamplingContent

    pub(all) enum SamplingContent {
    Single(SamplingContentBlock)
    Multiple(Array[SamplingContentBlock])
    } derive(Eq,
    Debug
    )

    Retains single-block versus array presence on the wire, even for a one-element array.

    SamplingContent::equal

    SamplingContent::from_json

    fn SamplingContent::from_json(value : Json) -> SamplingContent raise MCPError

    SamplingContent::not_equal

    fn SamplingContent::not_equal(x : SamplingContent, y : SamplingContent) -> Bool

    SamplingContent::text

    fn SamplingContent::text(value : String) -> SamplingContent

    SamplingContent::to_json

    fn SamplingContent::to_json(self : SamplingContent) -> Json

    SamplingContentBlock

    pub(all) enum SamplingContentBlock {
    Content(ContentBlock)
    ToolUse(ToolUseContent)
    ToolResult(ToolResultContent)
    Unknown(Json)
    } derive(Eq,
    Debug
    )

    Sampling has a narrower standard union than tool-result content, plus tool-use blocks.

    SamplingContentBlock::equal

    SamplingContentBlock::from_json

    fn SamplingContentBlock::from_json(value : Json) -> SamplingContentBlock raise MCPError

    SamplingContentBlock::not_equal

    SamplingContentBlock::to_json

    SamplingContext

    pub(all) enum SamplingContext {
    NoContext
    ThisServer
    AllServers
    } derive(Eq,
    Debug
    )

    SamplingContext::equal

    SamplingContext::from_json

    fn SamplingContext::from_json(value : Json) -> SamplingContext raise MCPError

    SamplingContext::not_equal

    fn SamplingContext::not_equal(x : SamplingContext, y : SamplingContext) -> Bool

    SamplingContext::to_json

    fn SamplingContext::to_json(self : SamplingContext) -> Json

    SamplingMessage

    pub(all) struct SamplingMessage {
    role : Role
    content : SamplingContent
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    SamplingMessage — a message within a sampling/createMessage request

    SamplingMessage::equal

    SamplingMessage::from_json

    fn SamplingMessage::from_json(value : Json) -> SamplingMessage raise MCPError

    SamplingMessage::new

    fn SamplingMessage::new(role : Role, content : SamplingContent, meta? : Map[String, Json]) -> SamplingMessage

    SamplingMessage::not_equal

    fn SamplingMessage::not_equal(x : SamplingMessage, y : SamplingMessage) -> Bool

    SamplingMessage::to_json

    fn SamplingMessage::to_json(self : SamplingMessage) -> Json

    ServerCapabilities

    pub(all) struct ServerCapabilities {
    experimental : Map[String, Json]?
    logging : Map[String, Json]?
    completions : Map[String, Json]?
    tools : ToolCapabilities?
    resources : ResourceCapabilities?
    prompts : PromptCapabilities?
    extra_fields : Map[String, Json]
    extensions : Map[String, Json]?
    } derive(Eq,
    Debug
    )

    ServerCapabilities::equal

    ServerCapabilities::from_json

    fn ServerCapabilities::from_json(value : Json) -> ServerCapabilities raise MCPError

    ServerCapabilities::new

    fn ServerCapabilities::new(experimental? : Map[String, Json], logging? : Map[String, Json], completions? : Map[String, Json], tools? : ToolCapabilities, resources? : ResourceCapabilities, prompts? : PromptCapabilities, extensions? : Map[String, Json]) -> ServerCapabilities

    ServerCapabilities::not_equal

    ServerCapabilities::to_json

    ServerInfo

    pub(all) struct ServerInfo {
    name : String
    title : String?
    version : String
    description : String?
    } derive(Eq,
    Debug
    )

    ServerInfo::equal

    fn ServerInfo::equal(ServerInfo, ServerInfo) -> Bool

    ServerInfo::not_equal

    fn ServerInfo::not_equal(x : ServerInfo, y : ServerInfo) -> Bool

    ServerInfo::to_repr

    Explicit trait method promotion for current MoonBit toolchains.

    SubscriptionNotificationKind

    pub(all) enum SubscriptionNotificationKind {
    ToolsListChanged
    PromptsListChanged
    ResourcesListChanged
    ResourceUpdated(uri~ : String)
    } derive(Eq,
    Debug
    )

    Which kind of change notification a subscription filter should match. Used internally by the server to route notifications to the right streams.

    SubscriptionNotificationKind::not_equal

    ToolAnnotations

    pub(all) struct ToolAnnotations {
    title : String?
    read_only_hint : Bool?
    destructive_hint : Bool?
    idempotent_hint : Bool?
    open_world_hint : Bool?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    Advisory hints, not an authorization or safety policy.

    ToolAnnotations::equal

    ToolAnnotations::from_json

    fn ToolAnnotations::from_json(value : Json) -> ToolAnnotations raise MCPError

    ToolAnnotations::new

    fn ToolAnnotations::new(title? : String, read_only_hint? : Bool, destructive_hint? : Bool, idempotent_hint? : Bool, open_world_hint? : Bool) -> ToolAnnotations

    ToolAnnotations::not_equal

    fn ToolAnnotations::not_equal(x : ToolAnnotations, y : ToolAnnotations) -> Bool

    ToolAnnotations::to_json

    fn ToolAnnotations::to_json(self : ToolAnnotations) -> Json

    ToolCapabilities

    pub(all) struct ToolCapabilities {
    list_changed : Bool?
    extra_fields : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ToolCapabilities::equal

    ToolCapabilities::from_json

    fn ToolCapabilities::from_json(value : Json) -> ToolCapabilities raise MCPError

    ToolCapabilities::new

    fn ToolCapabilities::new(list_changed? : Bool) -> ToolCapabilities

    ToolCapabilities::not_equal

    fn ToolCapabilities::not_equal(x : ToolCapabilities, y : ToolCapabilities) -> Bool

    ToolCapabilities::to_json

    fn ToolCapabilities::to_json(self : ToolCapabilities) -> Json

    ToolChoice

    pub(all) struct ToolChoice {
    mode : ToolChoiceMode?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ToolChoice::equal

    fn ToolChoice::equal(ToolChoice, ToolChoice) -> Bool

    ToolChoice::from_json

    fn ToolChoice::from_json(value : Json) -> ToolChoice raise MCPError

    ToolChoice::new

    ToolChoice::not_equal

    fn ToolChoice::not_equal(x : ToolChoice, y : ToolChoice) -> Bool

    ToolChoice::to_json

    fn ToolChoice::to_json(self : ToolChoice) -> Json

    ToolChoiceMode

    pub(all) enum ToolChoiceMode {
    Auto
    Required
    Disabled
    } derive(Eq,
    Debug
    )

    ToolChoiceMode::equal

    ToolChoiceMode::from_json

    fn ToolChoiceMode::from_json(value : Json) -> ToolChoiceMode raise MCPError

    ToolChoiceMode::not_equal

    fn ToolChoiceMode::not_equal(x : ToolChoiceMode, y : ToolChoiceMode) -> Bool

    ToolChoiceMode::to_json

    fn ToolChoiceMode::to_json(self : ToolChoiceMode) -> Json

    ToolDefinition

    pub(all) struct ToolDefinition {
    name : String
    title : String?
    description : String?
    input_schema : Json
    output_schema : Json?
    annotations : ToolAnnotations?
    icons : Array[Icon]?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ToolDefinition::equal

    ToolDefinition::from_json

    fn ToolDefinition::from_json(value : Json) -> ToolDefinition raise MCPError

    ToolDefinition::new

    fn ToolDefinition::new(name : String, input_schema : Json, title? : String, description? : String, output_schema? : Json, annotations? : ToolAnnotations, icons? : Array[Icon], meta? : Map[String, Json]) -> ToolDefinition

    ToolDefinition::not_equal

    fn ToolDefinition::not_equal(x : ToolDefinition, y : ToolDefinition) -> Bool

    ToolDefinition::to_json

    fn ToolDefinition::to_json(self : ToolDefinition) -> Json

    ToolResult

    pub(all) struct ToolResult {
    content : Array[ContentBlock]
    structured_content : Json?
    is_error : Bool?
    metadata : ResultMetadata
    } derive(Eq,
    Debug
    )

    ToolResult::equal

    fn ToolResult::equal(ToolResult, ToolResult) -> Bool

    ToolResult::error

    fn ToolResult::error(message : String) -> ToolResult

    ToolResult::from_json

    fn ToolResult::from_json(value : Json) -> ToolResult raise MCPError

    ToolResult::not_equal

    fn ToolResult::not_equal(x : ToolResult, y : ToolResult) -> Bool

    ToolResult::structured

    fn ToolResult::structured(value : Json, content? : Array[ContentBlock]) -> ToolResult

    Structured outputs may be any JSON value, including explicit null.

    test {
    let result = @types.ToolResult::structured(Json::null())
    assert_eq(result.structured_content, Some(Json::null()))
    assert_eq(result.to_json(), {
    "content": [],
    "structuredContent": null,
    "isError": false,
    })
    }

    ToolResult::success

    fn ToolResult::success(content : Array[ContentBlock]) -> ToolResult

    ToolResult::text

    fn ToolResult::text(text : String) -> ToolResult

    ToolResult::to_json

    fn ToolResult::to_json(self : ToolResult) -> Json

    ToolResultContent

    pub(all) struct ToolResultContent {
    tool_use_id : String
    content : Array[ContentBlock]
    structured_content : Json?
    is_error : Bool?
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ToolResultContent::equal

    ToolResultContent::from_json

    fn ToolResultContent::from_json(value : Json) -> ToolResultContent raise MCPError

    ToolResultContent::new

    fn ToolResultContent::new(tool_use_id : String, content : Array[ContentBlock], structured_content? : Json, is_error? : Bool, meta? : Map[String, Json]) -> ToolResultContent

    ToolResultContent::not_equal

    fn ToolResultContent::not_equal(x : ToolResultContent, y : ToolResultContent) -> Bool

    ToolResultContent::to_json

    ToolUseContent

    pub(all) struct ToolUseContent {
    id : String
    name : String
    input : Map[String, Json]
    meta : Map[String, Json]?
    extensions : Map[String, Json]
    } derive(Eq,
    Debug
    )

    ToolUseContent::equal

    ToolUseContent::from_json

    fn ToolUseContent::from_json(value : Json) -> ToolUseContent raise MCPError

    ToolUseContent::new

    fn ToolUseContent::new(id : String, name : String, input : Map[String, Json], meta? : Map[String, Json]) -> ToolUseContent

    ToolUseContent::not_equal

    fn ToolUseContent::not_equal(x : ToolUseContent, y : ToolUseContent) -> Bool

    ToolUseContent::to_json

    fn ToolUseContent::to_json(self : ToolUseContent) -> Json

    ProtocolVersion

    let ProtocolVersion : String

    MCP protocol version implemented by this SDK.

    Single source of truth for the MCP-Protocol-Version header and the _meta.io.modelcontextprotocol/protocolVersion field. Per the 2026-07-28 revision, every request carries its own version; there is no handshake.

    cancelled_notification

    fn cancelled_notification(request_id : RequestId, reason? : String) -> Notification

    Create cancelled notification

    progress_notification

    fn progress_notification(token : ProgressToken, progress : Double, total? : Double, message? : String) -> Notification raise

    Create progress notification. Counters keep the exact shortest literal of each Double; non-finite counters fail instead of emitting invalid JSON.

    prompts_list_changed_notification

    fn prompts_list_changed_notification() -> Notification

    Create prompts list changed notification

    resources_list_changed_notification

    fn resources_list_changed_notification() -> Notification

    Create resources list changed notification

    resources_updated_notification

    fn resources_updated_notification(uri : String) -> Notification

    Create resources updated notification with URI parameter

    tools_list_changed_notification

    fn tools_list_changed_notification() -> Notification

    Create tools list changed notification