API

The public surface

Every type, function, method and value moonmcp exposes, drawn straight from the compiled package interfaces. Generated from source — it cannot drift from the code.

Three capability kinds give the reference its colours: tools, resources, prompts. Everything else is the server, the wire, or the errors in between.

MCP 2026-07-28 · 2025-11-25 · 2024-11-05 · Streamable HTTP · stdio

Facade

The names a server is written with. Re-exports the server and the three capability types, plus argument decoding.

Documentation page

The page a server serves beside its endpoint, listing what it offers and calling it, in two looks.

fn
pub fn page(endpoint? : String, theme? : Theme) -> String

The page as HTML, for a server whose endpoint answers at endpoint: a path on the same origin, or an absolute URL. It lists the tools, resources, resource templates and prompts the server offers and calls them over the endpoint, showing the JSON-RPC request it built and the reply it got back, in either era of the protocol, chosen on the page. Server::to_asgi serves it at /docs unless told otherwise; this hands the same document to a router of your own.

let
pub let theme : Theme

The look page and Server::to_asgi use unless told otherwise: the one the moonmcp website wears.

enum
pub(all) enum Theme { Site Plain }

The two looks the page comes in.

fn
pub fn Theme::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Theme::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Theme::to_repr(Self) -> @debug.Repr

Debug representation of this value.

Server

One server holds tools, resources, templates and prompts, and speaks both protocol eras over Streamable HTTP and stdio.

let
pub let ask_rounds : Int32

How many times one request may ask before it is taken to be stuck. A handler that asks again because it got an answer it did not like is fine; one that never stops is not.

let
pub let ask_timeout_ms : Int32

How long a question put to the client waits for its reply: 60 seconds, the TypeScript SDK's DEFAULT_REQUEST_TIMEOUT_MSEC.

fn
pub fn[T : @json.FromJson] decode(Map[String, @json.Json], String) -> T raise @json.JsonDecodeError

The argument name of a call, read as T; the code #mcp.tool generates calls this for each required parameter. A string read where something else is wanted is read again as JSON, which is how the {id} of a resource template, always text, reaches an Int parameter.

fn
pub fn[T : @json.FromJson] decode_option(Map[String, @json.Json], String) -> T? raise @json.JsonDecodeError

The argument name of a call when it may be left out: None when it is missing or null, else the value read as decode reads it. The code #mcp.tool generates calls this for optional parameters.

fn
pub fn list_changed_notification(String) -> @json.Json

The notification that a server's tools, prompts or resources changed.

fn
pub fn method_of(@json.Json) -> String?

The method a message names, if it is a JSON-RPC one at all.

fn
pub fn params_of(@json.Json) -> Map[String, @json.Json]

The parameters a message carries, empty when it carries none.

fn
pub fn request_id_of(@json.Json) -> @json.Json?

The id a request carries; None on a notification.

fn
pub fn resource_updated_notification(String) -> @json.Json

The notification that one resource was rewritten.

fn
pub fn subscription_closed_result(@json.Json) -> @json.Json

The reply that closes a subscription the server ended on purpose, carrying the id of the stream so a client can pair it with the request.

struct
pub struct Cancellations {

Which requests a client has withdrawn by notifications/cancelled. The notification names a request the client already sent, so a transport keeps this beside its read loop: the loop records, the running requests ask.

fn
pub fn Cancellations::add(Self, @json.Json) -> Unit

Record that the client no longer wants the answer to request id.

fn
pub fn Cancellations::has(Self, @json.Json) -> Bool

Whether the client has withdrawn request id.

fn
pub fn Cancellations::new() -> Self

Nothing withdrawn yet.

fn
pub fn Cancellations::unwatch(Self, @json.Json) -> Unit

Stop waiting to be told: the request is over.

fn
pub fn Cancellations::watch(Self, @json.Json, () -> Unit) -> Unit

Ask to be told when request id is withdrawn. A stream that waits for something other than its own answer, a subscription above all, has no other way to hear about it.

struct
pub(all) struct Channel { emit : async (@json.Json) -> Unit headers : Map[String, String] gone : () -> Bool subject : String? claims : Map[String, @json.Json] asks : Bool }

What a transport lends one request: the headers that carried it, the way to send a notification before the reply, and whether the caller is still there. A transport that can carry nothing beside the reply passes Channel::quiet, which is what Server::handle uses.

fn
pub fn Channel::new(emit~ : async (@json.Json) -> Unit, headers~ : Map[String, String], gone~ : () -> Bool, subject? : String, claims? : Map[String, @json.Json], asks? : Bool) -> Self

A channel over the transport that carries this request.

fn
pub fn Channel::quiet() -> Self

A channel with nowhere to send and no caller to lose.

enum
pub(all) enum Scope { Public Private }

Who may keep a cached list result: any intermediary, or only caches inside the same authorisation context (the cacheScope of a cacheable result).

fn
pub fn Scope::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Scope::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Scope::to_cache_scope(Self) -> @types.CacheScope

The same scope as the wire names it.

fn
pub fn Scope::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub struct Server { info : @types.Implementation instructions : String? ttl_ms : Int32 scope : Scope

An MCP server: the tools, resources, resource templates and prompts it offers, and who it says it is. It speaks both eras of the protocol. A request carrying its protocol version in _meta is served statelessly under the 2026-07-28 revision; an initialize request opens the handshake of the revisions before it. The same server is reached over Streamable HTTP with to_asgi, over stdio with run_stdio, or by any transport of your own through handle. ttl_ms and scope are the caching hints every list result carries under the 2026-07-28 revision. The presets say "stale at once" and "this caller only", the cautious end of both, since a server that changes what it lists per caller would otherwise leak one caller's list to the next.

fn
pub fn Server::add_prompt(Self, @prompts.Prompt) -> Unit

Offer prompt. A second prompt under the same name replaces the first.

fn
pub fn Server::add_provider(Self, &@providers.Provider) -> Unit

Take components from provider as well as from the server's own registry. The provider is asked again on every listing, so what it supplies may change between two of them. A name this server already answers is not taken from a provider.

fn
pub fn Server::add_resource(Self, @resources.Resource) -> Unit

Offer resource at its URI. A second resource at the same URI replaces the first.

fn
pub fn Server::add_template(Self, @resources.ResourceTemplate) -> Unit

Offer template; a URI no fixed resource answers is matched against the templates in the order they were added.

fn
pub fn Server::add_tool(Self, @tools.Tool) -> Unit

Offer tool. Its input schema is compiled here, so a call is checked against it before the tool runs. A schema that does not compile is a mistake in the program, not in a request, so it aborts now rather than failing the first call. A second tool under the same name replaces the first.

fn
pub fn Server::add_transform(Self, &@transforms.Transform) -> Unit

Apply transform to the components the server offers, in the order the transforms were added: each one sees what the one before it produced.

fn
pub fn Server::completion(Self, async (@types.CompleteRequestParams, @context.Context) -> @types.Completion) -> Unit

Answer completion/complete: what to offer for the argument a client is filling in. Registering this is what makes the server declare the completions capability.

fn
pub async fn Server::handle(Self, @json.Json) -> @json.Json?

Answer one JSON-RPC message, the way every transport does (← the low-level server's message loop). None is the answer to a notification. A message that is not JSON-RPC at all is answered with the error JSON-RPC prescribes, under a null id. This is the form for a caller with no channel of its own, so a handler's progress reports and log messages are dropped. A transport that can carry them calls handle_with.

fn
pub async fn Server::handle_with(Self, @json.Json, channel~ : Channel) -> @json.Json?

Answer one message over channel, which carries the request's headers and whatever the handlers send beside the reply.

fn
pub fn Server::log_to(Self, logger~ : @moonlog.Logger) -> Unit

Write the server's own log through logger (← a structured logger passed in, never reached for globally): a request served, a request refused, a subscription opened. Context::log writes here too, beside the notification it sends, so a client that went away does not take the record with it. Without one the server keeps no log of its own; the notifications/message its handlers ask for still go to the client.

fn
pub fn Server::new(String, version? : String, title? : String, instructions? : String, ttl_ms? : Int32, scope? : Scope, ask_timeout_ms? : Int32, ask_rounds? : Int32) -> Self

Construct a value with the given fields.

fn
pub fn Server::notify(Self, @json.Json) -> Unit

Hand message to every subscription whose filter asked for it. A subscription that has stopped reading its queue is dropped rather than allowed to hold the change.

fn
pub fn Server::notify_prompts_changed(Self) -> Unit

Tell every subscription that the prompts changed.

fn
pub fn Server::notify_resource_updated(Self, String) -> Unit

Tell the subscriptions that asked for uri that it was rewritten.

fn
pub fn Server::notify_resources_changed(Self) -> Unit

Tell every subscription that the resources changed.

fn
pub fn Server::notify_tools_changed(Self) -> Unit

Tell every subscription that the tools changed. Registering a tool does this by itself; a server whose tools come and go for reasons of its own calls it when it knows.

fn
pub fn Server::offered_prompts(Self) -> Array[@prompts.Prompt]

The prompts a client is offered, after the transforms.

fn
pub fn Server::offered_resources(Self) -> Array[@resources.Resource]

The resources a client is offered, after the transforms.

fn
pub fn Server::offered_templates(Self) -> Array[@resources.ResourceTemplate]

The resource templates a client is offered, after the transforms.

fn
pub fn Server::offered_tools(Self) -> Array[@tools.Tool]

The tools a client is offered: the registered ones, then whatever the providers supply, as the transforms leave them.

fn
pub fn Server::prompt(Self, String, async (Map[String, @json.Json]) -> String, title? : String, description? : String, arguments? : Array[@types.PromptArgument]) -> Unit

Offer a prompt rendered as one user message (← @mcp.prompt).

fn
pub fn Server::prompt_context(Self, String, async (Map[String, @json.Json], @context.Context) -> @prompts.RenderedPrompt, title? : String, description? : String, arguments? : Array[@types.PromptArgument]) -> Unit

Offer a prompt whose renderer sees the request it serves.

fn
pub fn Server::resource(Self, String, async () -> String, name? : String, title? : String, description? : String, mime_type? : String) -> Unit

Offer a resource read as text (← @mcp.resource(uri)).

fn
pub fn Server::resource_context(Self, String, async (@context.Context) -> @resources.RawResourceValue, name? : String, title? : String, description? : String, mime_type? : String) -> Unit

Offer a resource whose reader sees the request it serves. A read that needs something from the client answers with ResourceResult::input_required instead of contents.

fn
pub async fn Server::serve_lines(Self, async () -> String?, async (String) -> Unit) -> Unit

Serve newline-delimited JSON-RPC: read a line with read until it gives None, answer it, and write the reply as one line (← the stdio transport, over any pair of streams). A line that is not JSON is answered with a parse error; a blank one is skipped. Requests are worked on as they arrive, each in a task of its own, so a slow tool does not hold up the next call. Replies still leave in the order their requests came in, which is what a client that counts lines expects; a subscription's notifications are the exception, since they are not replies to anything. notifications/cancelled withdraws the request it names, which the running task sees through its context.

fn
pub async fn Server::serve_subscription(Self, @json.Json, Map[String, @json.Json], Channel, cancellations? : Cancellations, queue? : @aqueue.Queue[@json.Json]) -> Unit

Serve one subscriptions/listen request until the transport lets go: the acknowledgement first, then every notification the filter asked for, each tagged with the id of the request that opened the stream. The reply to the request itself is sent by the caller when this returns, and only when it returns of its own accord: a stream cut by the transport has no reply, as the specification has it.

fn
pub fn Server::template(Self, String, async (Map[String, @json.Json]) -> String, name? : String, title? : String, description? : String, mime_type? : String) -> Unit

Offer the resources an RFC 6570 template names, read as text with the parameters the URI matched (← @mcp.resource("users://{id}")). A template that does not parse aborts at registration.

fn
pub fn Server::template_context(Self, String, async (Map[String, @json.Json], @context.Context) -> @resources.RawResourceValue, name? : String, title? : String, description? : String, mime_type? : String) -> Unit

Offer the resources an RFC 6570 template names, read in the request that matched them.

fn
pub fn Server::to_asgi(Self, path? : String, origins? : Array[String], hosts? : Array[String], docs? : String?, theme? : @docs.Theme, auth? : @auth.Bearer) -> async (@spec.Scope, async () -> @spec.Event, async (@spec.Event) -> Unit) -> Unit

The server as an ASGI application serving the MCP endpoint at path. Run it with mooncat, or mount it beside a moonapi app. Every message is its own POST, answered with one JSON object, or 202 for a notification. This server keeps no session, so DELETE answers 405. A 2026-07-28 request that offers a progress token, or that opens a subscription, is answered with text/event-stream when the client accepts it: the notifications the handler sends arrive on that stream, and the reply ends it. Under the revisions before, a request becomes a stream the moment its handler has something to send, and stays one JSON object when it has nothing. A GET that accepts text/event-stream opens the stream those revisions hear list changes and subscribed resources on; with no session to tie it to, every such stream hears the updates to anything a client has subscribed to. A request whose Origin header names another site is refused with 403, as the transport requires against DNS rebinding. An origin passes when its host is the request's own Host, a loopback address, or one listed in origins. Host is checked as well, since a rebound name reaches a local server with a Host that is not its own. hosts lists the names this server answers to; left out, a server listening on a loopback address answers to loopback names only, and one listening anywhere else takes any. A reverse proxy in front of a loopback listener has to name the public host here. docs names the path the documentation page is served at, beside the endpoint: a browser opened on it lists what the server offers and calls it, in both eras of the protocol. It is on at /docs unless told otherwise, as an API framework's interactive docs are; docs=None leaves it off, and a path equal to the endpoint's is ignored. theme picks its look, the moonmcp website's by default. The page carries no credentials of its own.

fn
pub fn Server::tool(Self, String, async (Map[String, @json.Json]) -> @json.Json, input_schema? : @json.Json, title? : String, description? : String, output_schema? : @json.Json, annotations? : @types.ToolAnnotations) -> Unit

Offer a tool whose handler returns any JSON value (← @mcp.tool). An object becomes structured content as well as text; anything else becomes text. An error the handler raises becomes a result marked isError, which the model reads and can correct itself from. A name the protocol does not allow aborts at registration.

fn
pub fn Server::tool_context(Self, String, async (Map[String, @json.Json], @context.Context) -> @tools.ToolResult, input_schema? : @json.Json, title? : String, description? : String, output_schema? : @json.Json, annotations? : @types.ToolAnnotations) -> Unit

Offer a tool that also sees the request it serves: its identity in _meta, the headers that carried it, the progress token it offered, and whatever the client answered on a retry. The handler answers with a ToolResult. An ordinary one carries content; ToolResult::input_required carries an ask instead, which the client satisfies and then sends the same call again with inputResponses and requestState, or with an answer if it cannot.

fn
pub fn Server::use_layer(Self, @layers.Layer) -> Unit

Put layer in front of every request: the first one added is the outermost, so it sees a request before the ones after it and its answer last. A layer that raises @exceptions.Mcp refuses the request with that code; a layer that answers without calling on to the rest answers for the server.

fn
pub async fn Server::run_stdio(self : Server) -> Unit

Serve over the process's standard input and output: one message per line each way, until standard input closes. Anything else the program prints belongs on standard error, since standard output carries nothing but messages.

Context

The request a handler serves: who asked, with what, and the way back out while the answer is still being worked out.

fn
pub fn notification(String, Map[String, @json.Json]) -> @json.Json

One notification message, framed as the wire carries it.

struct
pub struct Context {

The request a tool, a resource or a prompt is serving: the facts above, and the two things a handler can do with the connection while it runs, report progress and ask whether the caller has gone away. A Context is passed by the framework with every request; a handler called straight from a program gets Context::quiet, whose reports go nowhere.

fn
pub fn Context::claims(Self) -> Map[String, @json.Json]

Every claim the token carried, as the issuer wrote them. Empty when no token was checked.

fn
pub fn Context::client_capabilities(Self) -> @types.ClientCapabilities?

What the client says it can do on this request. A request carries its own capabilities, so this is never inherited from an earlier one.

fn
pub fn Context::client_info(Self) -> @types.Implementation?

Who the client says it is. Self-reported and unverified, of use for display and for logging, never for a permission decision.

fn
pub async fn Context::debug(Self, String) -> Unit

A log message at debug.

fn
pub async fn Context::error(Self, String) -> Unit

A log message at error.

fn
pub fn Context::facts(Self) -> Facts

The facts this request was served with.

fn
pub fn Context::header(Self, String) -> String?

The value of the request header name, in lower case as ASGI carries it. Over stdio there are none.

fn
pub fn Context::headers(Self) -> Map[String, String]

Every header the request carried, keyed in lower case.

fn
pub async fn Context::info(Self, String) -> Unit

A log message at info.

fn
pub fn Context::input_responses(Self) -> Map[String, @json.Json]

The answers a client sent back with a retried request, keyed by the id the server gave each input request.

fn
pub fn Context::is_cancelled(Self) -> Bool

Whether the caller said it no longer wants this answer. A long handler should stop; the framework drops whatever it returns.

fn
pub async fn Context::log(Self, level~ : @types.LoggingLevel, message~ : String, logger? : String, data? : @json.Json) -> Unit

Report a log message to the client, at level, as notifications/message. It travels the same way progress does: on the stream of the request that caused it, and nowhere when the transport has no stream.

fn
pub fn Context::logger(Self) -> @moonlog.Logger?

The server's log, scoped to this request: its id and operation are already bound, so a line says which request it came from. None when the server was given no logger, which is the default.

fn
pub fn Context::new(facts~ : Facts, emit? : async (@json.Json) -> Unit, gone? : () -> Bool, logger? : @moonlog.Logger, level? : () -> @types.LoggingLevel?) -> Self

Whether a message leaving a handler goes out at all, and whether the caller is still there. Both are supplied by the transport that carries the request; the defaults do nothing.

fn
pub fn Context::operation(Self) -> String

The method that reached this handler, for example tools/call.

fn
pub fn Context::progress_token(Self) -> @json.Json?

The token the client gave for progress reports, if it asked for any. A handler that reports progress without one is not answered, and the reports go nowhere.

fn
pub fn Context::protocol_version(Self) -> String

The protocol revision the request was sent under.

fn
pub fn Context::quiet() -> Self

A context for a call made without a connection: reports are dropped and the caller is always there.

fn
pub async fn Context::report_progress(Self, progress~ : Double, total? : Double, message? : String) -> Unit

Report how far along the work is. Silent when the client gave no progress token, as the specification has it: a report the caller did not ask for is not sent. progress grows towards total; a report without total says how much is done but not how much is left.

fn
pub fn Context::request_id(Self) -> @json.Json

The JSON-RPC id of the request, which a progress notification or a subscription echoes back.

fn
pub fn Context::request_state(Self) -> String?

The opaque state the server asked the client to hand back on the retry, or None on the first leg.

fn
pub fn Context::subject(Self) -> String?

The subject a bearer token vouched for, when the transport checked one. None over stdio, and over HTTP when the endpoint is open.

fn
pub async fn Context::warning(Self, String) -> Unit

A log message at warning.

struct
pub(all) struct Facts { protocol_version : String operation : String request_id : @json.Json client_info : @types.Implementation? client_capabilities : @types.ClientCapabilities? progress_token : @json.Json? headers : Map[String, String] input_responses : Map[String, @json.Json] request_state : String? subject : String? claims : Map[String, @json.Json] }

What one request says about itself: the revision it was sent under, the client's identity and capabilities, the progress token it offered, the headers that carried it, and the answers it brings back to an earlier leg.

fn
pub fn Facts::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Facts::new(operation? : String, request_id? : @json.Json, protocol_version? : String, client_info? : @types.Implementation, client_capabilities? : @types.ClientCapabilities, progress_token? : @json.Json, headers? : Map[String, String], input_responses? : Map[String, @json.Json], request_state? : String, subject? : String, claims? : Map[String, @json.Json]) -> Self

The facts of a request that carries nothing but its own name, which is what a handler called straight from a program sees.

fn
pub fn Facts::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Facts::to_repr(Self) -> @debug.Repr

Debug representation of this value.

Client

The protocol from the caller's side, over an in-memory server, a pair of line streams, or HTTP.

fn
pub fn fill_defaults(Map[String, @json.Json]?, Map[String, @json.Json]) -> Map[String, @json.Json]

content with the default of every property of schema it leaves out, one level deep: a form's fields are properties of the requested schema, and a nested object carries its own form. A property without a default stays out — the person left it empty, which the server may treat as an error.

error
pub suberror Refused { Refused(code~ : Int32, message~ : String, data~ : @json.Json?) }

A server said no. The code and data are the JSON-RPC error as it arrived.

struct
pub struct Client { info : @types.Implementation capabilities : @types.ClientCapabilities

A connection to a server, with the handshake behind it. On the 2026-07-28 revision there is no handshake: every request carries the version, the client's identity and its capabilities in _meta, and the server answers on its own. On the revisions before it, connect runs initialize and notifications/initialized once.

fn
pub async fn Client::call_tool(Self, String, arguments? : Map[String, @json.Json], on_notification? : async (@json.Json) -> Unit, progress_token? : @json.Json) -> @types.CallToolResult

Call name with arguments; notifications sent before the answer go to on_notification.

fn
pub async fn Client::close(Self) -> Unit

Stop asking for anything on this connection.

fn
pub async fn Client::connect(&Transport, name? : String, version? : String, protocol_version? : String, capabilities? : @types.ClientCapabilities, handlers? : Handlers) -> Self

Connect over transport. protocol_version picks the dialect: 2026-07-28 speaks the stateless revision, anything the server lists as older runs the handshake. The default follows the server's own latest_protocol_version.

fn
pub async fn Client::discover(Self) -> Map[String, @json.Json]

What the server supports and which revisions it speaks.

fn
pub async fn Client::exchange(Self, String, params? : Map[String, @json.Json], on_notification? : async (@json.Json) -> Unit, progress_token? : @json.Json) -> Map[String, @json.Json]

The same, with somewhere to put the notifications the server sends while the answer is being worked out: progress, log messages.

fn
pub async fn Client::get_prompt(Self, String, arguments? : Map[String, @json.Json]) -> @types.GetPromptResult

Render the prompt name with arguments.

fn
pub async fn Client::list_prompts(Self) -> Array[@types.Prompt]

The prompts the server offers.

fn
pub async fn Client::list_resources(Self) -> Array[@types.Resource]

The resources the server offers.

fn
pub async fn Client::list_tools(Self) -> Array[@types.Tool]

The tools the server offers.

fn
pub async fn Client::listen(Self, filter~ : @types.SubscriptionFilter, on_notification~ : async (@json.Json) -> Unit) -> Unit

Open a subscription and hand every notification on it to on_notification until the server ends it.

fn
pub async fn Client::notify(Self, String, params? : Map[String, @json.Json]) -> Unit

Send a message that gets no reply.

fn
pub async fn Client::ping(Self) -> Unit

A bare result with no payload.

fn
pub fn Client::protocol_version(Self) -> String

The revision in force on this connection.

fn
pub async fn Client::read_resource(Self, String) -> @types.ReadResourceResult

Read the resource at uri.

fn
pub async fn Client::request(Self, String, params? : Map[String, @json.Json]) -> Map[String, @json.Json]

Ask operation with params and hand back the result, raising Refused when the server answers with an error.

fn
pub fn Client::server_capabilities(Self) -> @types.ServerCapabilities?

What the server says it can do.

fn
pub fn Client::server_info(Self) -> @types.Implementation?

Who the server says it is, once it has said.

struct
pub(all) struct Handlers { sampling : (async (@types.CreateMessageRequestParams) -> @types.CreateMessageResult)? elicitation : (async (@types.ElicitRequestParams) -> @types.ElicitResult)? roots : (async () -> @types.ListRootsResult)? apply_defaults : Bool }

A client's answers to the requests a server may make of it. Any of the three may be left out, and a server that asks for one the client does not do is told so with the error JSON-RPC prescribes. apply_defaults is SEP-1034: an accepted elicitation leaves out a field the person did not touch, and the default from the requested schema is filled in before the answer goes back, so the server sees a complete form.

fn
pub async fn Handlers::answer(Self, @json.Json) -> @json.Json?

What to send back for a message the server sent: a reply when it was a request, nothing when it was a notification.

fn
pub fn Handlers::new(sampling? : async (@types.CreateMessageRequestParams) -> @types.CreateMessageResult, elicitation? : async (@types.ElicitRequestParams) -> @types.ElicitResult, roots? : async () -> @types.ListRootsResult, apply_defaults? : Bool) -> Self

The answers a client gives. Everything left out is a request the client declines to serve.

fn
pub fn Handlers::none() -> Self

A client that answers nothing.

struct
pub struct Lines { lock : @async.Mutex answer : @ref.Ref[(async (@json.Json) -> @json.Json?)?]

A transport over a pair of line streams: standard input and output of a child process, a socket, a pipe. The same reader and writer a server is served on, seen from the other end. One message is one line. The framing and the pairing of a reply with its request are moonjrpc's: a Peer over these streams assigns the request identifiers, wakes the caller whose reply arrived, answers whatever the server asks, and ends when the stream does.

fn
pub fn Lines::answer_with(Self, async (@json.Json) -> @json.Json?) -> Unit

Keep answer as the place the server's questions go.

fn
pub async fn Lines::ask(Self, @json.Json, async (@json.Json) -> Unit) -> @json.Json

Write the request and wait for its reply, with whatever the server asks in between answered on the same stream.

fn
pub async fn Lines::close(Self) -> Unit

Nothing to let go: the streams belong to whoever made them.

fn
pub async fn Lines::listen(Self, @json.Json, async (@json.Json) -> Unit) -> Unit

Open a subscription and hand every notification to on_notification until the server answers the request that opened it.

fn
pub fn Lines::new(read~ : async () -> String?, write~ : async (String) -> Unit) -> Self

Speak newline-delimited JSON-RPC over read and write.

fn
pub async fn Lines::tell(Self, @json.Json) -> Unit

Write one notification; nothing is read back.

item
pub impl Transport for Lines

The Transport implementation for Lines.

struct
pub struct Memory { server : @server.Server answer : @ref.Ref[(async (@json.Json) -> @json.Json?)?] }

A transport that reaches a server in the same program, with no wire between them: what an editor, a test or an embedded agent uses.

fn
pub fn Memory::answer_with(Self, async (@json.Json) -> @json.Json?) -> Unit

Keep answer as the place the server's questions go.

fn
pub async fn Memory::ask(Self, @json.Json, async (@json.Json) -> Unit) -> @json.Json

Ask the server in this program. Nothing carried the message, so its handlers see no headers and no client identity. A question the server puts to the client inside a handler travels out through the same channel and comes back the same way, which is what makes sampling and elicitation work with no wire at all.

fn
pub async fn Memory::close(Self) -> Unit

Nothing to let go: the server is in this process.

fn
pub async fn Memory::listen(Self, @json.Json, async (@json.Json) -> Unit) -> Unit

Open a subscription on the server and hand its notifications on until the stream ends.

fn
pub fn Memory::new(@server.Server) -> Self

Reach server directly. Its handlers see no headers and no client identity, since nothing carried the message.

fn
pub async fn Memory::tell(Self, @json.Json) -> Unit

Hand a notification to the server; nothing comes back.

item
pub impl Transport for Memory

The Transport implementation for Memory.

item
pub(open) trait Transport { async fn ask(Self, @json.Json, async (@json.Json) -> Unit) -> @json.Json async fn tell(Self, @json.Json) -> Unit async fn listen(Self, @json.Json, async (@json.Json) -> Unit) -> Unit async fn close(Self) -> Unit fn answer_with(Self, async (@json.Json) -> @json.Json?) -> Unit }

A contract a transport implements to carry the client's messages.

Authorization

The bearer token an HTTP transport checks before it serves anything, verified through mooncred.

fn
pub fn authorization_code_form(code~ : String, redirect_uri~ : String, verifier~ : String, resource? : String, scope? : String) -> Array[(String, String)]

The body of an authorization-code exchange (RFC 6749 §4.1.3) with the PKCE verifier and the RFC 8707 resource indicator.

fn
pub fn authorize_url(Server, Registration, String, String, Pkce, scope? : String, resource? : String) -> String raise Refused

The URL to send the user to: response_type=code, the client, the redirect, the state, the S256 challenge, and the resource indicator RFC 8707 asks for.

fn
pub fn client_credentials_form(resource? : String, scope? : String) -> Array[(String, String)]

The body of a client-credentials request (RFC 6749 §4.4).

fn
pub fn form_encode(Array[(String, String)]) -> String

pairs as an application/x-www-form-urlencoded body.

fn
pub fn new_state() -> String raise Refused

The state parameter of an authorization request: a value the client makes up and checks on the way back, so a redirect it did not cause is not taken.

fn
pub fn origin_of(String) -> String

Everything in url before its path: scheme, authority, and nothing else.

fn
pub fn path_of(String) -> String

The path of url, from the slash after the authority up to the query or fragment. / when it has none, which is what the well-known lookups expect.

fn
pub fn percent_encode(StringView) -> String

Percent-encode everything but the unreserved characters, which is what a form body and an OAuth parameter take.

fn
pub fn query_of(String) -> String

The query of url, without the ?.

fn
pub fn query_value(String, String) -> String?

The value of name in a query string, with + read as a space as application/x-www-form-urlencoded says and the escapes decoded.

fn
pub fn refresh_form(refresh_token~ : String, resource? : String, scope? : String) -> Array[(String, String)]

The body of a refresh (RFC 6749 §6).

fn
pub fn same_origin(String, String) -> Bool

Whether url names the same resource as expected: the scheme and host compared without regard to case, the rest exactly. RFC 8707 lets a client refuse a protected resource that names another origin.

fn
pub fn scope_for(Challenge?, Resource?, String?) -> String?

The scope for an authorization request. None when nothing names one, in which case the request carries no scope parameter at all: sending an empty one is not the same thing to every server.

fn
pub fn scope_within(String?, String?) -> Bool

Whether every scope asked names is one granted already carries. A challenge that names no scope asks nothing new; one that names a scope this client was never granted is a step up, and a refresh cannot answer it (RFC 6749 §6 keeps a refresh inside the scope it was given).

fn
pub fn target_of(String) -> String

The whole of url as a request line carries it: path and query.

fn
pub fn trimmed_path_of(String) -> String

The path of url without its trailing slash, which is the form the well-known prefixes are built from.

fn
pub fn widen_scope(String?, String?) -> String?

The union of two scope strings, the current one first, without repeats.

fn
pub fn with_offline_access(String?, Server, Grant) -> String?

The scope to ask for when this client wants a refresh token. The authorization server's own offline_access is what makes it hand one out, and a server that does not list it must not be asked (SEP-2207). The client-credentials grant gets no refresh token at all (RFC 6749 §4.4.3), so nothing is added for it.

fn
pub fn with_query(String, Array[(String, String)]) -> String

url with query as its query, replacing one it had.

error
pub(all) suberror Refused { Refused(message~ : String) }

Why an OAuth client could not go on, in words a person reads.

struct
pub struct Bearer {

How a transport checks a bearer token (← the authorization section of the protocol): a request without one is answered 401 with a WWW-Authenticate challenge, and one whose token does not verify is answered the same way with invalid_token. Two ways to build one: Bearer::hmac for a token signed with a shared secret, which is what a test and a single-tenant deployment use, and Bearer::own for anything else — an RSA or ECDSA key, a JSON Web Key Set fetched from the issuer, an opaque token looked up in a table. own takes the whole decision, so this library never has an opinion about how a token is judged, only about what happens when it is not.

fn
pub fn Bearer::check(Self, String) -> Result[Principal, String]

Check the Authorization header of a request. Err carries the reason the token is refused, phrased for the client.

fn
pub fn Bearer::hmac(secret~ : String, alg? : @jwt.Alg, issuer? : String, audience? : Array[String], leeway? : Int64, clock? : () -> Int64) -> Self

Check tokens signed with secret by a shared key: alg is the algorithm the verifier uses, and a token that names another one is refused rather than trusted. issuer and audience are checked when given, so a token minted for another service does not open this one. clock is the instant in seconds since the epoch that expiry is measured against, which a test fixes and a deployment leaves alone.

fn
pub fn Bearer::own(check~ : (String) -> Result[Principal, String]) -> Self

Check tokens with check, which returns the caller or the reason the token is refused. The reason travels to the client in error_description, so it should say what is wrong without saying anything a stranger could use.

struct
pub(all) struct Challenge { resource_metadata : String? scope : String? error : String? error_description : String? }

The Bearer challenge of a 401 or 403: where the resource metadata is, which scope would satisfy it, and what went wrong.

fn
pub fn Challenge::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Challenge::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Challenge::parse(String) -> Self?

Read the Bearer challenge out of a WWW-Authenticate header. Parameters are name=value with the value optionally quoted; a name repeated keeps the first, which is what a client needs.

fn
pub fn Challenge::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum Credentials { Basic Post Public }

How the token endpoint is asked to authenticate the client.

fn
pub fn Credentials::authorization(Self, Registration) -> String?

The Authorization header value for this method, when it uses one. Basic credentials are client_id:client_secret in base64, both percent-encoded as RFC 6749 §2.3.1 requires.

fn
pub fn Credentials::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Credentials::form(Self, Registration) -> Array[(String, String)]

The fields this method puts in the token request's body.

fn
pub fn Credentials::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Credentials::select(Registration, Array[String]) -> Self

The method to use, given what the server says it supports and how the client was registered. Priority is the one a client that holds a secret should follow: what registration returned when the server lists it, else HTTP Basic, else the secret in the body, else nothing.

fn
pub fn Credentials::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum Grant { AuthorizationCode ClientCredentials }

Which grant a client is set up to use: the interactive one, or the one a client makes on its own behalf.

fn
pub fn Grant::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Grant::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Grant::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Metadata { client_name : String redirect_uris : Array[String] grant_types : Array[String] response_types : Array[String] token_endpoint_auth_method : String scope : String? }

What a client says about itself: at registration, and in the document a URL client identifier points at.

fn
pub fn Metadata::body(Self) -> Map[String, @json.Json]

The body of a registration request.

fn
pub fn Metadata::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Metadata::new(client_name~ : String, redirect_uris~ : Array[String], scope? : String, grant_types? : Array[String], response_types? : Array[String], token_endpoint_auth_method? : String) -> Self

A client's metadata. refresh_token is among the grants because a client that can keep a session wants one; none is the authentication method of a public client that a loopback redirect makes safe with PKCE.

fn
pub fn Metadata::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Metadata::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Pkce { verifier : String challenge : String }

A PKCE pair: verifier goes in the token request, challenge in the authorization request. Only S256 is used — the plain method protects nothing, and the protocol requires S256 of every client that can do it.

fn
pub fn Pkce::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Pkce::new() -> Self raise Refused

A fresh pair, from 32 bytes of entropy: 43 characters, which is the shortest length RFC 7636 allows and enough to be unguessable.

fn
pub fn Pkce::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Pkce::of(String) -> Self

The pair for a verifier already chosen: the challenge is its SHA-256 digest in base64url, without padding.

fn
pub fn Pkce::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Principal { subject : String? claims : Map[String, @json.Json] }

The caller a token vouched for: its sub, and every claim as it arrived. A claim is whatever the issuer put there — a scope list, a tenant, a role. Nothing here interprets them; a handler reads what it needs.

fn
pub fn Principal::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Principal::has_scope(Self, String) -> Bool

Whether the token grants scope, read from the scope claim (space separated) or scp (a list), which are the two spellings in use.

fn
pub fn Principal::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Principal::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Redirect { code : String state : String? }

The code and state a redirect carried, or why there is none.

fn
pub fn Redirect::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Redirect::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Redirect::parse(String) -> Self raise Refused

Read a redirect back: the code, the state to compare with the one sent, and an error if the server refused instead.

fn
pub fn Redirect::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Registration { client_id : String client_secret : String? token_endpoint_auth_method : String? }

What a client is known by: the identifier the server issued, or the one a deployment was given, and the secret if it has one.

fn
pub fn Registration::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Registration::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Registration::parse(@json.Json) -> Self raise Refused

Read a registration response.

fn
pub fn Registration::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Resource { resource : String authorization_servers : Array[String] scopes_supported : Array[String]? }

What a protected resource says about itself (RFC 9728): the identifier tokens for it must be minted for, and the authorization servers that mint them.

fn
pub fn Resource::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Resource::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Resource::parse(@json.Json) -> Self raise Refused

Read protected resource metadata.

fn
pub fn Resource::probes(String, hinted? : String) -> Array[String]

The documents to try for protected resource metadata, in the order the specification asks for: the one a challenge pointed at, else the path-aware location, else the root. A server that publishes the path-aware location is not asked for the root one — a client that asks both is told apart by that.

fn
pub fn Resource::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Server { issuer : String authorization_endpoint : String? token_endpoint : String registration_endpoint : String? scopes_supported : Array[String]? response_types_supported : Array[String] grant_types_supported : Array[String] token_endpoint_auth_methods_supported : Array[String] token_endpoint_auth_signing_alg_values_supported : Array[String] code_challenge_methods_supported : Array[String]? client_id_metadata_document_supported : Bool }

What an authorization server says it can do (RFC 8414 and OpenID Connect Discovery). A field the document leaves out keeps the default the metadata specification gives it, except where the default is "not offered".

fn
pub fn Server::at_root(String) -> Self

The endpoints a 2025-03-26 server has when it publishes no metadata at all: the three OAuth paths at the server's own root (MCP's authorization section before it named RFC 8414).

fn
pub fn Server::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Server::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Server::offers(Self, String) -> Bool

Whether this server offers the grant.

fn
pub fn Server::parse(@json.Json) -> Self raise Refused

Read authorization server metadata. issuer and token_endpoint are the two a client cannot work without.

fn
pub fn Server::probes(String) -> Array[String]

The documents to try for authorization server metadata, in the order RFC 8414 and OpenID Connect Discovery put them: the path inserted after the well-known prefix, then the two OpenID spellings.

fn
pub fn Server::serves_authorization_code(Self) -> Bool

Whether this server can run an authorization-code flow with PKCE.

fn
pub fn Server::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Tokens { access_token : String token_type : String expires_in : Int64? refresh_token : String? scope : String? }

What the token endpoint answered.

fn
pub fn Tokens::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Tokens::good_until(Self, Int64) -> Int64?

When the token stops being good, in seconds since the epoch, measured from issued; None when it names no lifetime, which a client reads as "until the server says otherwise".

fn
pub fn Tokens::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Tokens::parse(@json.Json) -> Self raise Refused

Read a token response. access_token is the only field a client cannot do without; a server that omits token_type is taken at its word that the token goes in the Authorization header.

fn
pub fn Tokens::renewed(Self, Self) -> Self

The token a refresh left this client with. A server may rotate the refresh token, so a response that carries one replaces the old; one that carries none leaves the old in place rather than throwing the only key away. The same holds for the scope: what a response does not name is what was asked for, which is what this client already had.

fn
pub fn Tokens::to_repr(Self) -> @debug.Repr

Debug representation of this value.

Tools

A tool: a handler, an input schema, and a typed result.

fn
pub fn convert_to_content(@json.Json) -> Array[@types.ContentBlock] raise @json.JsonDecodeError

Convert a raw result to a sequence of content blocks.

fn
pub fn default_title(String) -> String

Derive a display title from a tool name. The MCP spec says clients should fall back to name for display when title is absent, but some clients instead drop the tool entirely. Always emitting a title avoids depending on that fallback.

fn
pub fn is_valid_tool_name(String) -> Bool

Whether a tool name is valid per the MCP specification (SEP-986): 1-64 characters of letters, digits, underscores and hyphens.

struct
pub(all) struct Tool { component : @component.ComponentBase parameters : @json.Json output_schema : @json.Json? annotations : @types.ToolAnnotations? execution : @types.ToolExecution? timeout : Double? run_fn : async (Map[String, @json.Json]) -> ToolResult raise @exceptions.FastMCPError context_run_fn : (async (Map[String, @json.Json], @context.Context) -> ToolResult raise @exceptions.FastMCPError)? }

A registered tool.

fn
pub fn Tool::base(Self) -> @component.ComponentBase

The shared component metadata.

fn
pub fn Tool::convert_result(Self, @json.Json) -> ToolResult raise @exceptions.FastMCPError

Convert a raw return value to a ToolResult, honouring the declared output schema.

fn
pub async fn Tool::dispatch(Self, Map[String, @json.Json]) -> ToolResult raise @exceptions.FastMCPError

Server entry point for tool execution; subclasses customise dispatch by supplying a different run_fn at construction.

fn
pub fn Tool::get_meta(Self) -> Map[String, @json.Json]

Arbitrary metadata carried with the component.

fn
pub fn Tool::identifier(Self) -> String

The stable identifier used in listings.

fn
pub fn Tool::key(Self) -> String

The de-duplication key used in the registry.

fn
pub fn Tool::new(String, parameters~ : @json.Json, run_fn~ : async (Map[String, @json.Json]) -> ToolResult raise @exceptions.FastMCPError, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.ToolAnnotations, output_schema? : @json.Json, execution? : @types.ToolExecution, timeout? : Double, task_config? : @tasks.TaskConfig, context_run_fn? : async (Map[String, @json.Json], @context.Context) -> ToolResult raise @exceptions.FastMCPError) -> Self raise @exceptions.FastMCPError

Register a tool. parameters is the JSON schema of its arguments and run_fn executes it.

fn
pub async fn Tool::run(Self, Map[String, @json.Json]) -> ToolResult raise @exceptions.FastMCPError

Run the tool with arguments.

fn
pub async fn Tool::run_with(Self, Map[String, @json.Json], @context.Context) -> ToolResult raise @exceptions.FastMCPError

Run the tool with arguments and the request it serves. A tool registered from a function that wants only its arguments ignores the context.

fn
pub fn Tool::to_mcp_tool(Self) -> @types.Tool

Convert the tool to its wire representation. Title precedence: explicit title, then annotation title, then a title derived from the name.

item
pub impl @component.Component for Tool

The Component implementation for Tool.

struct
pub(all) struct ToolResult { content : Array[@types.ContentBlock] structured_content : Map[String, @json.Json]? meta : Map[String, @json.Json]? is_error : Bool raw_mcp_result : @types.CallToolResult? input_required : @types.InputRequiredResult? }

The canonical result of running a tool.

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

Equality with another value of the same type.

fn
pub fn ToolResult::from_mcp_result(@types.CallToolResult) -> Self

Wrap a protocol result while preserving its exact wire representation.

fn
pub fn ToolResult::input_required(@types.InputRequiredResult) -> Self

Wrap a client-input ask (SEP-2322) as an ordinary tool result.

fn
pub fn ToolResult::is_input_required(Self) -> Bool

Whether this result carries a client-input ask (SEP-2322).

fn
pub fn ToolResult::new(content? : Array[@types.ContentBlock], structured_content? : Map[String, @json.Json], meta? : Map[String, @json.Json], is_error? : Bool) -> Self raise @exceptions.FastMCPError

Create a tool result from explicit parts; content or structured content must be provided.

fn
pub fn ToolResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ToolResult::to_mcp_result(Self) -> @types.CallToolResult

Convert to the protocol result, keeping the original wire representation when one was preserved.

fn
pub fn ToolResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

Resources

A resource: a URI and a reader. Templates fill a URI pattern from arguments.

fn
pub fn contains_path_traversal(String) -> Bool

Whether value contains .. as a path component, considering both separators. Dots inside a single segment are not traversal.

fn
pub fn convert_raw_to_resource_result(RawResourceValue, mime_type? : String, meta? : Map[String, @json.Json]) -> ResourceResult

Wrap a resource function's return value in a ResourceResult. Shared by Resource and ResourceTemplate so both honour the MIME type the component declares in listings: a component that advertises text/csv must not serve text/plain on read.

fn
pub fn encode_literal(String) -> String

Percent-encode literal template text per RFC 6570 section 3.1. Existing %XX triplets pass through so an already-encoded literal is not encoded twice; everything else keeps reserved and unreserved characters and encodes the rest.

fn
pub fn expand_uri_template(String, Map[String, @json.Json]) -> String

Expand a URI template with parameters — the inverse of match_uri_template. Params use underscored keys but templates may use hyphens, so both spellings are tried.

fn
pub fn extract_exploded_query_params(String) -> Array[String]

Extract query parameter names declared with the explode modifier: {?tags*} marks tags as repeatable.

fn
pub fn extract_query_params(String) -> Array[String]

Extract query parameter names from RFC 6570 {?param1,param2} syntax. The explode modifier is stripped, so {?tags*} yields tags.

fn
pub fn forward_uri(String, Map[String, @json.Json], String) -> String

Build the URI a forwarding layer (mount or proxy) sends to the server behind it: the path is expanded from the template, but the query string is carried over from the incoming URI byte for byte.

fn
pub fn is_absolute_path(String) -> Bool

Whether value looks like an absolute filesystem path: rooted at / or \\, UNC-prefixed, or a Windows drive letter path.

fn
pub fn match_uri_template(String, String, list_params? : Array[String], segments? : Array[TemplateSegment]) -> Map[String, @json.Json]?

Match a URI against a template and extract both path and query parameters, percent-decoded. list_params names non-exploded query parameters that hold lists; their first value is comma-split per RFC 6570 section 3.2.8. Pass pre-parsed segments when the caller already holds them.

fn
pub fn parse_template(String) -> Array[TemplateSegment]

Parse the path portion of a URI template into literal and variable segments; query blocks are dropped for path matching.

fn
pub fn parse_template_params(String) -> @set.Set[String]

All parameter names a template declares, hyphens normalised to underscores, path and query parameters combined.

fn
pub fn pct_encode(String, safe? : String) -> String

Percent-encode text, keeping unreserved characters plus safe.

fn
pub fn resolve_security(ResourceSecuritySetting, ResourceSecurity?) -> ResourceSecurity?

Resolve the effective policy for a component.

enum
pub(all) enum ContentPayload { Text(String) Blob(Bytes) }

The payload of a resource content item: inline text or raw bytes.

fn
pub fn ContentPayload::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ContentPayload::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ContentPayload::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum RawResourceValue { Text(String) Blob(Bytes) Ready(ResourceResult) }

What a resource read function may return: text, bytes or a full result.

struct
pub(all) struct Resource { component : @component.ComponentBase uri : String mime_type : String annotations : @types.Annotations? read_fn : async () -> RawResourceValue raise @exceptions.FastMCPError context_read_fn : (async (@context.Context) -> RawResourceValue raise @exceptions.FastMCPError)? }

A registered resource.

fn
pub fn Resource::base(Self) -> @component.ComponentBase

The shared component metadata.

fn
pub fn Resource::binary(String, data~ : Bytes, name? : String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], mime_type? : String, tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.Annotations) -> Self

A resource backed by inline bytes.

fn
pub fn Resource::convert_result(Self, RawResourceValue) -> ResourceResult

Convert a raw result to a ResourceResult, forwarding this resource's declared MIME type and component metadata to each content item.

fn
pub fn Resource::from_function(String, read_fn~ : async () -> RawResourceValue raise @exceptions.FastMCPError, name? : String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], mime_type? : String, tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.Annotations, context_read_fn? : async (@context.Context) -> RawResourceValue raise @exceptions.FastMCPError) -> Self

A resource backed by a closure computing its value on read.

fn
pub fn Resource::get_meta(Self) -> Map[String, @json.Json]

Arbitrary metadata carried with the component.

fn
pub fn Resource::identifier(Self) -> String

The stable identifier used in listings.

fn
pub fn Resource::key(Self) -> String

The de-duplication key used in the registry.

fn
pub fn Resource::new(String, read_fn~ : async () -> RawResourceValue raise @exceptions.FastMCPError, name? : String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], mime_type? : String, tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.Annotations, context_read_fn? : async (@context.Context) -> RawResourceValue raise @exceptions.FastMCPError) -> Self

Register a resource at uri. The name defaults to the URI when absent.

fn
pub async fn Resource::read(Self) -> RawResourceValue raise @exceptions.FastMCPError

Read the resource content.

fn
pub async fn Resource::read_result(Self) -> ResourceResult raise @exceptions.FastMCPError

Server entry point for resource reads.

fn
pub async fn Resource::read_with(Self, @context.Context) -> RawResourceValue raise @exceptions.FastMCPError

Read the resource in the request it serves. A resource registered from a function that wants no context ignores it.

fn
pub fn Resource::text(String, text~ : String, name? : String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], mime_type? : String, tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.Annotations) -> Self

A resource backed by inline text.

fn
pub fn Resource::to_mcp_resource(Self) -> @types.Resource

Convert the resource to its wire representation.

item
pub impl @component.Component for Resource

The Component implementation for Resource.

struct
pub(all) struct ResourceContent { content : ContentPayload mime_type : String? meta : Map[String, @json.Json]? }

A single resource content item with optional MIME type and metadata.

fn
pub fn ResourceContent::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceContent::new(ContentPayload, mime_type? : String, meta? : Map[String, @json.Json]) -> Self

Create a resource content item, defaulting the MIME type by payload: text/plain for text, application/octet-stream for bytes.

fn
pub fn ResourceContent::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceContent::to_mcp_resource_contents(Self, String) -> @types.ResourceContents

Convert to the wire resource contents type; bytes are base64-encoded.

fn
pub fn ResourceContent::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct ResourceResult { contents : Array[ResourceContent] meta : Map[String, @json.Json]? input_required : @types.InputRequiredResult? }

The canonical result of a resource read.

fn
pub fn ResourceResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceResult::input_required(@types.InputRequiredResult) -> Self

Wrap a client-input ask (SEP-2322) as an ordinary resource result.

fn
pub fn ResourceResult::is_input_required(Self) -> Bool

Whether this result carries a client-input ask (SEP-2322).

fn
pub fn ResourceResult::new(Array[ResourceContent], meta? : Map[String, @json.Json]) -> Self

Create a resource result from content items.

fn
pub fn ResourceResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceResult::to_mcp_result(Self, String) -> @types.ReadResourceResult

Convert to the wire read-resource result.

fn
pub fn ResourceResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct ResourceSecurity { reject_path_traversal : Bool reject_absolute_paths : Bool reject_null_bytes : Bool exempt_params : @set.Set[String] }

Security policy applied to extracted resource template parameters. The checks run after a URI has matched a template and its parameter values have been extracted and percent-decoded; they catch path-traversal and absolute-path injection regardless of how the value was encoded in the URI.

fn
pub fn ResourceSecurity::default() -> Self

Secure-by-default policy: traversal, absolute paths and null bytes all rejected.

fn
pub fn ResourceSecurity::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceSecurity::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceSecurity::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn ResourceSecurity::validate(Self, Map[String, @json.Json]) -> String?

Check all parameter values against the policy. String values (and lists of strings, from wildcard parameters) are screened; non-string values are ignored. Returns the name of the first failing parameter, if any.

enum
pub(all) enum ResourceSecuritySetting { Inherit Explicit(ResourceSecurity) Disabled }

Per-component security setting: inherit the server-wide default, apply an explicit policy, or disable screening.

fn
pub fn ResourceSecuritySetting::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceSecuritySetting::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceSecuritySetting::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct ResourceTemplate { component : @component.ComponentBase uri_template : String mime_type : String parameters : @json.Json annotations : @types.Annotations? security : ResourceSecuritySetting list_query_params : @set.Set[String] segments : Array[TemplateSegment] read_fn : async (Map[String, @json.Json]) -> RawResourceValue raise @exceptions.FastMCPError context_read_fn : (async (Map[String, @json.Json], @context.Context) -> RawResourceValue raise @exceptions.FastMCPError)? }

A template for dynamically creating resources.

fn
pub fn ResourceTemplate::base(Self) -> @component.ComponentBase

The shared component metadata.

fn
pub fn ResourceTemplate::convert_result(Self, RawResourceValue) -> ResourceResult

Convert a raw result to a ResourceResult, forwarding the template's declared MIME type so reads match what it advertises in listings.

fn
pub fn ResourceTemplate::create_resource(Self, String, Map[String, @json.Json]) -> Resource

Create a concrete resource from the template for the given parameters.

fn
pub fn ResourceTemplate::from_mcp_template(@types.ResourceTemplate) -> Self raise @exceptions.FastMCPError

Create a template from a raw wire template, for remote servers whose original function is lost.

fn
pub fn ResourceTemplate::get_meta(Self) -> Map[String, @json.Json]

Arbitrary metadata carried with the component.

fn
pub fn ResourceTemplate::identifier(Self) -> String

The stable identifier used in listings.

fn
pub fn ResourceTemplate::key(Self) -> String

The de-duplication key used in the registry.

fn
pub fn ResourceTemplate::matches(Self, String, ResourceSecurity?) -> Map[String, @json.Json]? raise @exceptions.FastMCPError

Check if a URI matches this template and extract its parameters, screening extracted values against the effective security policy.

fn
pub fn ResourceTemplate::new(String, parameters~ : @json.Json, read_fn~ : async (Map[String, @json.Json]) -> RawResourceValue raise @exceptions.FastMCPError, name? : String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], mime_type? : String, tags? : @set.Set[String], meta? : Map[String, @json.Json], annotations? : @types.Annotations, security? : ResourceSecuritySetting, list_query_params? : @set.Set[String], context_read_fn? : async (Map[String, @json.Json], @context.Context) -> RawResourceValue raise @exceptions.FastMCPError) -> Self raise @exceptions.FastMCPError

Register a resource template; read_fn receives the parameters matched from the request URI.

fn
pub async fn ResourceTemplate::read(Self, Map[String, @json.Json]) -> RawResourceValue raise @exceptions.FastMCPError

Read the resource content with the matched parameters.

fn
pub async fn ResourceTemplate::read_result(Self, String, Map[String, @json.Json]) -> ResourceResult raise @exceptions.FastMCPError

Server entry point for template reads.

fn
pub async fn ResourceTemplate::read_with(Self, Map[String, @json.Json], @context.Context) -> RawResourceValue raise @exceptions.FastMCPError

Read the template in the request it serves. A template registered from a function that wants only its parameters ignores the context.

fn
pub fn ResourceTemplate::resolve_security(Self, ResourceSecurity?) -> ResourceSecurity?

Resolve the effective security policy for this template.

fn
pub fn ResourceTemplate::to_mcp_template(Self) -> @types.ResourceTemplate

Convert the template to its wire representation.

item
pub impl @component.Component for ResourceTemplate

The Component implementation for ResourceTemplate.

enum
pub(all) enum TemplateSegment { Literal(Array[Char]) PathVar(name~ : String, wildcard~ : Bool) }

One parsed chunk of a template's path portion.

Prompts

A prompt: a renderer that turns arguments into messages.

struct
pub(all) struct Message { role : @types.Role content : @types.ContentBlock }

A wrapper for a prompt message with a role.

fn
pub fn Message::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Message::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Message::of_content(@types.ContentBlock, role? : @types.Role) -> Self

Create a message from an existing content block, user role by default.

fn
pub fn Message::text(String, role? : @types.Role) -> Self

Create a message from plain text, user role by default.

fn
pub fn Message::to_mcp_prompt_message(Self) -> @types.PromptMessage

Convert to the wire prompt message.

fn
pub fn Message::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct Prompt { component : @component.ComponentBase arguments : Array[@types.PromptArgument]? render_fn : async (Map[String, @json.Json]) -> RenderedPrompt raise @exceptions.FastMCPError context_render_fn : (async (Map[String, @json.Json], @context.Context) -> RenderedPrompt raise @exceptions.FastMCPError)? }

A prompt template that can be rendered with arguments.

fn
pub fn Prompt::base(Self) -> @component.ComponentBase

The shared component metadata.

fn
pub fn Prompt::convert_result(Self, RenderedPrompt) -> PromptResult

Convert a rendered value to a canonical result.

fn
pub fn Prompt::get_meta(Self) -> Map[String, @json.Json]

Arbitrary metadata carried with the component.

fn
pub fn Prompt::identifier(Self) -> String

The stable identifier used in listings.

fn
pub fn Prompt::key(Self) -> String

The de-duplication key used in the registry.

fn
pub fn Prompt::new(String, render_fn~ : async (Map[String, @json.Json]) -> RenderedPrompt raise @exceptions.FastMCPError, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], tags? : @set.Set[String], meta? : Map[String, @json.Json], arguments? : Array[@types.PromptArgument], context_render_fn? : async (Map[String, @json.Json], @context.Context) -> RenderedPrompt raise @exceptions.FastMCPError) -> Self

Register a prompt; render_fn renders it with the given arguments.

fn
pub async fn Prompt::render(Self, Map[String, @json.Json]) -> RenderedPrompt raise @exceptions.FastMCPError

Render the prompt with arguments.

fn
pub async fn Prompt::render_result(Self, Map[String, @json.Json]) -> PromptResult raise @exceptions.FastMCPError

Server entry point for prompt rendering.

fn
pub async fn Prompt::render_with(Self, Map[String, @json.Json], @context.Context) -> RenderedPrompt raise @exceptions.FastMCPError

Render the prompt in the request it serves. A prompt registered from a function that wants only its arguments ignores the context.

fn
pub fn Prompt::to_mcp_prompt(Self) -> @types.Prompt

Convert the prompt to its wire representation.

item
pub impl @component.Component for Prompt

The Component implementation for Prompt.

struct
pub(all) struct PromptResult { messages : Array[Message] description : String? meta : Map[String, @json.Json]? input_required : @types.InputRequiredResult? }

The canonical result of rendering a prompt.

fn
pub fn PromptResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn PromptResult::input_required(@types.InputRequiredResult) -> Self

Wrap a client-input ask (SEP-2322) as an ordinary prompt result.

fn
pub fn PromptResult::is_input_required(Self) -> Bool

Whether this result carries a client-input ask (SEP-2322).

fn
pub fn PromptResult::new(Array[Message], description? : String, meta? : Map[String, @json.Json]) -> Self

Create a prompt result from a list of messages.

fn
pub fn PromptResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn PromptResult::to_mcp_prompt_result(Self) -> @types.GetPromptResult

Convert to the wire get-prompt result.

fn
pub fn PromptResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum RenderedPrompt { Text(String) Messages(Array[Message]) Ready(PromptResult) }

What a prompt's render function may return: plain text, a message list, or an already-assembled result.

Providers

Where the capabilities come from when they are not registered one at a time: a contract, and a fixed listing.

struct
pub(all) struct Listing { tools : Array[@tools.Tool] resources : Array[@resources.Resource] templates : Array[@resources.ResourceTemplate] prompts : Array[@prompts.Prompt] }

A fixed set of components, built once and handed over as it stands.

fn
pub fn Listing::new(tools? : Array[@tools.Tool], resources? : Array[@resources.Resource], templates? : Array[@resources.ResourceTemplate], prompts? : Array[@prompts.Prompt]) -> Self

A listing of whatever is given; the arrays are kept, not copied.

fn
pub fn Listing::prompts(Self) -> Array[@prompts.Prompt]

The prompts this value supplies or lets through.

fn
pub fn Listing::resources(Self) -> Array[@resources.Resource]

The resources this value supplies or lets through.

fn
pub fn Listing::templates(Self) -> Array[@resources.ResourceTemplate]

The resource templates this value supplies or lets through.

fn
pub fn Listing::tools(Self) -> Array[@tools.Tool]

The tools this value supplies or lets through.

item
pub impl Provider for Listing

The Provider implementation for Listing.

item
pub(open) trait Provider { fn tools(Self) -> Array[@tools.Tool] = _ fn resources(Self) -> Array[@resources.Resource] = _ fn templates(Self) -> Array[@resources.ResourceTemplate] = _ fn prompts(Self) -> Array[@prompts.Prompt] = _ }

The tools this value supplies or lets through.

Transforms

What the client is shown: the contract that rewrites a set of capabilities, and the renames and filters that ship with it.

fn
pub fn apply(Array[&Transform], Array[@tools.Tool], Array[@resources.Resource], Array[@resources.ResourceTemplate], Array[@prompts.Prompt]) -> (Array[@tools.Tool], Array[@resources.Resource], Array[@resources.ResourceTemplate], Array[@prompts.Prompt])

Serve one set of components through every transform, in order.

struct
pub(all) struct Hidden { names : @set.Set[String] }

Keep a component out of the listing, and out of reach: a call to a hidden name is answered as an unknown one.

fn
pub fn Hidden::hides(Self, String) -> Bool

Whether name is hidden.

fn
pub fn Hidden::new(names~ : Array[String]) -> Self

Hide the components named here — a tool or prompt name, a resource URI or a template pattern.

fn
pub fn Hidden::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]

The prompts this value supplies or lets through.

fn
pub fn Hidden::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]

The resources this value supplies or lets through.

fn
pub fn Hidden::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]

The resource templates this value supplies or lets through.

fn
pub fn Hidden::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]

The tools this value supplies or lets through.

item
pub impl Transform for Hidden

The Transform implementation for Hidden.

struct
pub(all) struct Namespace { prefix : String }

Put everything a server offers under prefix: a tool or prompt add becomes prefix_add, and a resource or template users://{id} becomes prefix+users://{id} (the prefix joins the scheme, so the URI keeps its shape and a template keeps its parameters). prefix should be spelled the way a tool name is — letters, digits, underscores and hyphens — since that is what prefixed tool names become.

fn
pub fn Namespace::new(String) -> Self

A namespace under prefix.

fn
pub fn Namespace::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]

The prompts this value supplies or lets through.

fn
pub fn Namespace::rename(Self, String) -> String

The name name takes inside the namespace.

fn
pub fn Namespace::rename_uri(Self, String) -> String

The URI uri takes inside the namespace.

fn
pub fn Namespace::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]

The resources this value supplies or lets through.

fn
pub fn Namespace::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]

The resource templates this value supplies or lets through.

fn
pub fn Namespace::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]

The tools this value supplies or lets through.

item
pub impl Transform for Namespace

The Transform implementation for Namespace.

struct
pub(all) struct Tagged { any_of : @set.Set[String] }

Offer only the components that carry one of these tags. A component without tags is held back, since a set chosen by tag is a set of tagged things.

fn
pub fn Tagged::keeps(Self, @set.Set[String]) -> Bool

Whether a component carrying tags passes.

fn
pub fn Tagged::new(any_of~ : Array[String]) -> Self

Keep the components tagged with any of any_of.

fn
pub fn Tagged::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]

The prompts this value supplies or lets through.

fn
pub fn Tagged::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]

The resources this value supplies or lets through.

fn
pub fn Tagged::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]

The resource templates this value supplies or lets through.

fn
pub fn Tagged::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]

The tools this value supplies or lets through.

item
pub impl Transform for Tagged

The Transform implementation for Tagged.

item
pub(open) trait Transform { fn tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool] = _ fn resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource] = _ fn templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate] = _ fn prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt] = _ }

The tools this value supplies or lets through.

Layers

The code every request passes through: the chain, a result cache, a rate limiter and a span recorder.

fn
pub async fn chain(Array[Layer], Call, async (Call) -> @json.Json raise @exceptions.FastMCPError) -> @json.Json raise @exceptions.FastMCPError

Serve call through layers in the order they were added, the first one outermost, and end in the middle. An empty list calls end directly.

let
pub let refused_code : Int32

The JSON-RPC code a refusal carries: -32000, the first of the range JSON-RPC leaves to the server for errors of its own.

struct
pub struct Caching {

Answers a call from memory when the same call was made recently. The key is the operation, the name and the arguments, with object keys sorted at every depth, so a client that sends the same arguments in another order still gets the stored answer. Errors and asks for client input are never stored: repeating them would hide the reason and replay a state the client has already answered. ttl_ms is how long an answer stays good — five minutes, the default of MCP's cache. capacity is how many answers are kept before the oldest goes; shared says whether one caller's answer may be handed to another, which is only safe when the answer does not depend on who asked.

fn
pub fn Caching::clear(Self) -> Unit

Forget everything.

fn
pub fn Caching::hits(Self) -> Int32

How many calls were answered without asking the server.

fn
pub fn Caching::layer(Self) -> Layer

The layer this cache installs on a server.

fn
pub fn Caching::misses(Self) -> Int32

How many went through.

fn
pub fn Caching::new(ttl_ms? : Int32, capacity? : Int32, operations? : Array[Operation], shared? : Bool) -> Self

A cache of every call and every listing, kept for five minutes.

fn
pub fn Caching::size(Self) -> Int32

How many answers are held right now.

struct
pub(all) struct Call { operation : Operation name : String arguments : Map[String, @json.Json] context : @context.Context }

One request on its way through the chain: what it is, what it names, the arguments it carries, and the request context it will be served in.

fn
pub fn Call::fingerprint(Self) -> String

The arguments as one string: keys sorted at every depth, so two calls that mean the same thing also spell the same thing. A cache keys on it, and a rate limiter that counts by argument does too.

fn
pub fn Call::new(operation~ : Operation, name~ : String, arguments? : Map[String, @json.Json], context~ : @context.Context) -> Self

The call a request makes.

fn
pub fn Call::subject(Self) -> String

Who is calling, as the authorisation check named them; empty when the request carried no identity.

struct
pub(all) struct Layer { name : String

One step of a chain: a name for the logs and spans, and the function that sees every call passing through it. A layer may answer without going on, pass the call along with next.then(call), look at what came back, or refuse it by raising @exceptions.Mcp with the code it wants sent.

fn
pub fn Layer::new(name? : String, run~ : async (Call, Next) -> @json.Json raise @exceptions.FastMCPError) -> Self

A layer made of a function.

fn
pub async fn Layer::serve(Self, Call, Next) -> @json.Json raise @exceptions.FastMCPError

Serve the call through this layer alone, with next behind it.

struct
pub(all) struct Next {

The rest of the chain, as a layer is handed it.

fn
pub async fn Next::then(Self, Call) -> @json.Json raise @exceptions.FastMCPError

Serve the call with everything behind this point in the chain.

enum
pub(all) enum Operation { ListTools ListResources ListTemplates ListPrompts CallTool ReadResource GetPrompt }

The request kinds a layer is asked about: the three that run a component, and the four that list them.

fn
pub fn Operation::code(Self) -> String

The JSON-RPC method an operation answers.

fn
pub fn Operation::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Operation::is_list(Self) -> Bool

Whether the operation lists components rather than running one.

fn
pub fn Operation::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Operation::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub struct RateLimiting {

A token bucket per caller. Each caller starts with a full bucket of burst tokens, spends one per call, and gains rate tokens a second up to that ceiling. A caller with none left is refused with refused_code and told how long to wait; the bucket keeps no token for them, so a caller that keeps asking only waits longer. Ten a second, twenty at once, is MCP's default. The caller is the subject the authorisation check named, and everyone unauthenticated shares one bucket — give key to count by a header or a tool instead. clock reads seconds from any fixed origin; the default is the monotonic clock.

fn
pub fn RateLimiting::callers(Self) -> Int32

How many callers are being counted.

fn
pub fn RateLimiting::layer(Self) -> Layer

The layer this limiter installs on a server.

fn
pub fn RateLimiting::new(rate? : Int32, burst? : Int32, operations? : Array[Operation], key? : (Call) -> String, clock? : () -> Double) -> Self

A limiter of ten calls a second per caller, twenty in a burst.

fn
pub fn RateLimiting::refused(Self) -> Int32

How many calls were refused.

fn
pub fn RateLimiting::reset(Self) -> Unit

Refill everyone to a full burst, as if no one had called yet.

struct
pub(all) struct Span { operation : Operation name : String duration_us : Double failed : Bool }

One served request, as the telemetry layer saw it.

fn
pub fn Span::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub struct Telemetry {

Timing and counting for every request that passes through. The last capacity spans are kept in memory and every one is handed to sink, so a program can print them, write them to its logger, or forward them to a tracing system of its own. A span is recorded whether the request was answered or raised, so a failure is counted where it happened rather than where the client noticed.

fn
pub fn Telemetry::clear(Self) -> Unit

Forget every span and counter recorded so far.

fn
pub fn Telemetry::count(Self, Operation) -> Int32

How many requests of operation were served.

fn
pub fn Telemetry::failures(Self) -> Int32

How many of them ended in an error.

fn
pub fn Telemetry::layer(Self) -> Layer

The layer this recorder installs on a server.

fn
pub fn Telemetry::new(capacity? : Int32, sink? : (Span) -> Unit) -> Self

A recorder of the last 128 spans, keeping nothing else.

fn
pub fn Telemetry::spans(Self) -> Array[Span]

The spans kept so far, oldest first.

fn
pub fn Telemetry::total(Self) -> Int32

How many requests were served, all operations together.

Wire types

The JSON-RPC and MCP data shapes, method constants and protocol-version helpers shared with the wire.

fn
pub fn cache_scope_of_wire(String) -> CacheScope?

The cache scope a wire string names, or None for one this revision does not define.

let
pub let client_capabilities_meta_key : String

The _meta key a request says what the client can do under.

let
pub let client_info_meta_key : String

The _meta key a request says who is calling under.

fn
pub fn client_request_frame(RequestId, ClientRequest) -> @json.Json

Wrap a client request into a wire frame.

fn
pub fn core_result_types() -> Array[String]

Result type names that may appear as the resultType of a discover reply.

fn
pub fn handshake_protocol_versions() -> Array[String]

The revisions a client may name in initialize, newest first. The stateless revision is not among them: it has no handshake.

let
pub let internal_error : Int32

The JSON-RPC code for a failure the server did not plan for.

let
pub let invalid_params : Int32

The JSON-RPC code for arguments the method cannot use.

let
pub let invalid_request : Int32

The JSON-RPC code for a message that is not a request at all.

let
pub let latest_protocol_version : String

The protocol version this implementation speaks.

fn
pub fn logging_level_from_wire(String) -> LoggingLevel?

The severity a notifications/message names, or None for a level the specification does not define.

let
pub let method_completion_complete : String

The wire name of the completion/complete request.

let
pub let method_elicitation_create : String

The wire name of the elicitation/create request.

let
pub let method_elicitation_create_form : String

The wire name of the elicitation/createForm request.

let
pub let method_initialize : String

Canonical JSON-RPC method and notification names.

let
pub let method_input_response : String

The wire name of the input/response request.

let
pub let method_logging_set_level : String

The wire name of the logging/setLevel request.

let
pub let method_not_found : Int32

The JSON-RPC code for a method this revision does not define.

let
pub let method_ping : String

The wire name of the ping request.

let
pub let method_prompts_get : String

The wire name of the prompts/get request.

let
pub let method_prompts_list : String

The wire name of the prompts/list request.

let
pub let method_resources_list : String

The wire name of the resources/list request.

let
pub let method_resources_read : String

The wire name of the resources/read request.

let
pub let method_resources_subscribe : String

The wire name of the resources/subscribe request.

let
pub let method_resources_unsubscribe : String

The wire name of the resources/unsubscribe request.

let
pub let method_roots_list : String

The wire name of the roots/list request.

let
pub let method_sampling_create_message : String

The wire name of the sampling/createMessage request.

let
pub let method_server_discover : String

The wire name of the server/discover request.

let
pub let method_subscriptions_listen : String

The wire name of the subscriptions/listen request.

let
pub let method_tools_call : String

The wire name of the tools/call request.

let
pub let method_tools_list : String

The wire name of the tools/list request.

fn
pub fn modern_protocol_versions() -> Array[String]

Protocol versions with modern semantics (used for capability gating).

let
pub let notification_cancelled : String

The wire name of the notifications/cancelled notification.

let
pub let notification_initialized : String

The wire name of the notifications/initialized notification.

let
pub let notification_message : String

The wire name of the notifications/message notification.

let
pub let notification_progress : String

The wire name of the notifications/progress notification.

let
pub let notification_prompt_list_changed : String

The wire name of the notifications/prompts/list_changed notification.

let
pub let notification_resource_list_changed : String

The wire name of the notifications/resources/list_changed notification.

let
pub let notification_resource_updated : String

The wire name of the notifications/resources/updated notification.

let
pub let notification_roots_list_changed : String

The wire name of the notifications/roots/list_changed notification.

let
pub let notification_subscriptions_acknowledged : String

The wire name of the notifications/subscriptions/acknowledged notification.

let
pub let notification_tool_list_changed : String

The wire name of the notifications/tools/list_changed notification.

fn
pub fn parse_client_request(@json.Json) -> ClientRequest raise @json.JsonDecodeError

Decode a request frame into a typed ClientRequest.

let
pub let parse_error : Int32

JSON-RPC error codes defined by the MCP specification.

fn
pub fn parse_message(@json.Json) -> JSONRPCMessage raise @json.JsonDecodeError

Parse one wire frame.

fn
pub fn parse_server_request(@json.Json) -> ServerRequest raise @json.JsonDecodeError

Decode a request frame into a typed ServerRequest.

let
pub let protocol_version_meta_key : String

The _meta key a stateless request names its protocol revision under.

fn
pub fn role_from_wire(String) -> Role?

The author a message names, or None for one that is neither the client nor the server.

let
pub let server_info_meta_key : String

The _meta keys a 2026-07-28 request and reply carry their session facts under. The prefix is the one the specification reserves for itself, so a request from another revision is told apart by the presence of one of these alone.

fn
pub fn server_request_frame(RequestId, ServerRequest) -> @json.Json

Wrap a server request into a wire frame.

fn
pub fn server_request_verb(ServerRequest) -> String

The method name a typed server request goes out under.

let
pub let subscription_id_meta_key : String

The _meta key a subscription's messages carry the id of the stream that opened it under.

fn
pub fn text_block(String) -> ContentBlock

Shorthand for a plain text block without annotations.

struct
pub(all) struct Annotations { audience : Array[String]? priority : Double? }

Audience and priority hints attached to content.

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

Equality with another value of the same type.

fn
pub fn Annotations::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Annotations::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Annotations::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Annotations::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Annotations

The FromJson implementation for Annotations.

item
pub impl @json.ToJson for Annotations

The ToJson implementation for Annotations.

enum
pub(all) enum CacheScope { Public Private }

The scope of a cacheable result, the cacheScope a list or a read carries: who may keep the reply. Public says it holds nothing tied to one caller; Private says a cache must belong to the authorisation context it was fetched in.

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

Equality with another value of the same type.

fn
pub fn CacheScope::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CacheScope::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn CacheScope::to_wire(Self) -> String

Encode this value to its wire string.

struct
pub(all) struct CallToolRequestParams { name : String arguments : Map[String, @json.Json]? meta : Map[String, @json.Json]? }

tools/call request parameters.

fn
pub fn CallToolRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CallToolRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CallToolRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CallToolRequestParams::progress_token(Self) -> String?

The progress token carried in the request meta.

fn
pub fn CallToolRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CallToolRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CallToolRequestParams

The FromJson implementation for CallToolRequestParams.

item
pub impl @json.ToJson for CallToolRequestParams

The ToJson implementation for CallToolRequestParams.

struct
pub(all) struct CallToolResult { content : Array[ContentBlock] structured_content : Map[String, @json.Json]? is_error : Bool meta : Map[String, @json.Json]? }

The result of a tools/call call.

fn
pub fn CallToolResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CallToolResult::error(String) -> Self

Build an error result with the given message.

fn
pub fn CallToolResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CallToolResult::new(Array[ContentBlock]) -> Self

Construct a value with the given fields.

fn
pub fn CallToolResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CallToolResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CallToolResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CallToolResult

The FromJson implementation for CallToolResult.

item
pub impl @json.ToJson for CallToolResult

The ToJson implementation for CallToolResult.

struct
pub(all) struct CancelledNotificationParams { request_id : RequestId reason : String? }

A cancelled request, sent by the side that issued it.

fn
pub fn CancelledNotificationParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CancelledNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CancelledNotificationParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CancelledNotificationParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CancelledNotificationParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CancelledNotificationParams

The FromJson implementation for CancelledNotificationParams.

item
pub impl @json.ToJson for CancelledNotificationParams

The ToJson implementation for CancelledNotificationParams.

struct
pub(all) struct ClientCapabilities { experimental : Map[String, @json.Json]? extensions : Map[String, @json.Json]? roots_list_changed : Bool? sampling : Bool? elicitation : Bool? tasks : Bool? }

What a client supports.

fn
pub fn ClientCapabilities::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ClientCapabilities::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ClientCapabilities::new() -> Self

A client that asks for nothing beyond the core protocol.

fn
pub fn ClientCapabilities::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ClientCapabilities::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ClientCapabilities::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ClientCapabilities

The FromJson implementation for ClientCapabilities.

item
pub impl @json.ToJson for ClientCapabilities

The ToJson implementation for ClientCapabilities.

enum
pub(all) enum ClientRequest { Initialize(InitializeRequestParams) Ping(meta~ : Map[String, @json.Json]?) ListTools(PaginatedRequestParams) CallTool(CallToolRequestParams) ListResources(PaginatedRequestParams) ReadResource(ReadResourceRequestParams) Subscribe(SubscribeRequestParams) Unsubscribe(SubscribeRequestParams) ListPrompts(PaginatedRequestParams) GetPrompt(GetPromptRequestParams) Complete(CompleteRequestParams) SetLevel(SetLevelRequestParams) InputResponse(InputResponseRequestParams) }

A typed request a client can send to a server.

fn
pub fn ClientRequest::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ClientRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ClientRequest::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ClientRequest::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn ClientRequest::verb(Self) -> String

The method name a typed request will be sent under.

item
pub impl @json.FromJson for ClientRequest

The FromJson implementation for ClientRequest.

struct
pub(all) struct CompleteRequestParams { reference : Reference argument : CompletionArgument arguments : Map[String, String]? meta : Map[String, @json.Json]? }

completion/complete request parameters.

fn
pub fn CompleteRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CompleteRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CompleteRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CompleteRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CompleteRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CompleteRequestParams

The FromJson implementation for CompleteRequestParams.

item
pub impl @json.ToJson for CompleteRequestParams

The ToJson implementation for CompleteRequestParams.

struct
pub(all) struct CompleteResult { completion : Completion meta : Map[String, @json.Json]? }

The result of a completion/complete call.

fn
pub fn CompleteResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CompleteResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CompleteResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CompleteResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CompleteResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CompleteResult

The FromJson implementation for CompleteResult.

item
pub impl @json.ToJson for CompleteResult

The ToJson implementation for CompleteResult.

struct
pub(all) struct Completion { values : Array[String] total : Int32? has_more : Bool? }

Completion values returned by completion/complete.

fn
pub fn Completion::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Completion::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Completion::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Completion::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Completion::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Completion

The FromJson implementation for Completion.

item
pub impl @json.ToJson for Completion

The ToJson implementation for Completion.

struct
pub(all) struct CompletionArgument { name : String value : String }

One argument offered for completion: which argument it is, and the value to complete.

fn
pub fn CompletionArgument::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CompletionArgument::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CompletionArgument::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CompletionArgument::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CompletionArgument::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CompletionArgument

The FromJson implementation for CompletionArgument.

item
pub impl @json.ToJson for CompletionArgument

The ToJson implementation for CompletionArgument.

enum
pub(all) enum ContentBlock { Text(text~ : String, annotations~ : Annotations?, meta~ : Map[String, @json.Json]?) Image(data~ : String, mime_type~ : String, annotations~ : Annotations?, meta~ : Map[String, @json.Json]?) Audio(data~ : String, mime_type~ : String, annotations~ : Annotations?, meta~ : Map[String, @json.Json]?) ResourceLink(uri~ : String, name~ : String, title~ : String?, description~ : String?, mime_type~ : String?, size~ : Int32?, annotations~ : Annotations?, meta~ : Map[String, @json.Json]?) EmbeddedResource(resource~ : ResourceContents, annotations~ : Annotations?, meta~ : Map[String, @json.Json]?) }

A block of content in a tool result, sampling message or prompt message.

fn
pub fn ContentBlock::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ContentBlock::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ContentBlock::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ContentBlock::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ContentBlock::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ContentBlock

The FromJson implementation for ContentBlock.

item
pub impl @json.ToJson for ContentBlock

The ToJson implementation for ContentBlock.

struct
pub(all) struct CreateMessageRequestParams { messages : Array[SamplingMessage] system_message : String? include_context : String? max_tokens : Int32 temperature : Double? stop_sequences : Array[String]? model_preferences : ModelPreferences? meta : Map[String, @json.Json]? }

sampling/createMessage request parameters.

fn
pub fn CreateMessageRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CreateMessageRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CreateMessageRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CreateMessageRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CreateMessageRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CreateMessageRequestParams

The FromJson implementation for CreateMessageRequestParams.

item
pub impl @json.ToJson for CreateMessageRequestParams

The ToJson implementation for CreateMessageRequestParams.

struct
pub(all) struct CreateMessageResult { model : String stop_reason : String? role : Role content : ContentBlock meta : Map[String, @json.Json]? }

The result of a sampling/createMessage call.

fn
pub fn CreateMessageResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CreateMessageResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CreateMessageResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CreateMessageResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CreateMessageResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CreateMessageResult

The FromJson implementation for CreateMessageResult.

item
pub impl @json.ToJson for CreateMessageResult

The ToJson implementation for CreateMessageResult.

struct
pub(all) struct CreateTaskResult { task : @json.Json meta : Map[String, @json.Json]? }

A task handle minted for task-augmented execution (SEP-2663).

fn
pub fn CreateTaskResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CreateTaskResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn CreateTaskResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CreateTaskResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn CreateTaskResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for CreateTaskResult

The FromJson implementation for CreateTaskResult.

item
pub impl @json.ToJson for CreateTaskResult

The ToJson implementation for CreateTaskResult.

struct
pub(all) struct DiscoverResult { result_type : String result : @json.Json ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

A discovery reply wrapping any core result, tagged with its type.

fn
pub fn DiscoverResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn DiscoverResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn DiscoverResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn DiscoverResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn DiscoverResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for DiscoverResult

The FromJson implementation for DiscoverResult.

item
pub impl @json.ToJson for DiscoverResult

The ToJson implementation for DiscoverResult.

struct
pub(all) struct ElicitRequestParams { message : String requested_schema : Map[String, @json.Json]? url : String? meta : Map[String, @json.Json]? }

elicitation/create request parameters, covering both the form- and URL-based variants.

fn
pub fn ElicitRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ElicitRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ElicitRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ElicitRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ElicitRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ElicitRequestParams

The FromJson implementation for ElicitRequestParams.

item
pub impl @json.ToJson for ElicitRequestParams

The ToJson implementation for ElicitRequestParams.

struct
pub(all) struct ElicitResult { action : String content : Map[String, @json.Json]? meta : Map[String, @json.Json]? }

The result of an elicitation round trip.

fn
pub fn ElicitResult::accept(Map[String, @json.Json]) -> Self

Accept an elicitation with the given content.

fn
pub fn ElicitResult::cancel() -> Self

Cancel an elicitation.

fn
pub fn ElicitResult::decline() -> Self

Decline an elicitation.

fn
pub fn ElicitResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ElicitResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ElicitResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ElicitResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ElicitResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ElicitResult

The FromJson implementation for ElicitResult.

item
pub impl @json.ToJson for ElicitResult

The ToJson implementation for ElicitResult.

struct
pub(all) struct EmptyResult { meta : Map[String, @json.Json]? }

A bare result with no payload.

fn
pub fn EmptyResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn EmptyResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn EmptyResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn EmptyResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn EmptyResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for EmptyResult

The FromJson implementation for EmptyResult.

item
pub impl @json.ToJson for EmptyResult

The ToJson implementation for EmptyResult.

struct
pub(all) struct ErrorData { code : Int32 message : String data : @json.Json? }

Wire-format error payload carried by JSON-RPC error responses.

fn
pub fn ErrorData::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ErrorData::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ErrorData::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ErrorData::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ErrorData::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct GetPromptRequestParams { name : String arguments : Map[String, @json.Json]? meta : Map[String, @json.Json]? }

prompts/get request parameters.

fn
pub fn GetPromptRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn GetPromptRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn GetPromptRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn GetPromptRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn GetPromptRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for GetPromptRequestParams

The FromJson implementation for GetPromptRequestParams.

item
pub impl @json.ToJson for GetPromptRequestParams

The ToJson implementation for GetPromptRequestParams.

struct
pub(all) struct GetPromptResult { description : String? messages : Array[PromptMessage] meta : Map[String, @json.Json]? }

The result of a prompts/get call.

fn
pub fn GetPromptResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn GetPromptResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn GetPromptResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn GetPromptResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn GetPromptResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for GetPromptResult

The FromJson implementation for GetPromptResult.

item
pub impl @json.ToJson for GetPromptResult

The ToJson implementation for GetPromptResult.

struct
pub(all) struct Icon { src : String mime_type : String? sizes : Array[String]? }

An icon for display in user interfaces.

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

Equality with another value of the same type.

fn
pub fn Icon::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Icon::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Icon::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Icon::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Icon

The FromJson implementation for Icon.

item
pub impl @json.ToJson for Icon

The ToJson implementation for Icon.

struct
pub(all) struct Implementation { name : String title : String? version : String }

The name and version of an MCP implementation.

fn
pub fn Implementation::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Implementation::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Implementation::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Implementation::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Implementation::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Implementation

The FromJson implementation for Implementation.

item
pub impl @json.ToJson for Implementation

The ToJson implementation for Implementation.

struct
pub(all) struct InitializeRequestParams { protocol_version : String capabilities : ClientCapabilities client_info : Implementation meta : Map[String, @json.Json]? }

initialize request parameters.

fn
pub fn InitializeRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InitializeRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InitializeRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InitializeRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InitializeRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InitializeRequestParams

The FromJson implementation for InitializeRequestParams.

item
pub impl @json.ToJson for InitializeRequestParams

The ToJson implementation for InitializeRequestParams.

struct
pub(all) struct InitializeResult { protocol_version : String capabilities : ServerCapabilities server_info : Implementation instructions : String? meta : Map[String, @json.Json]? }

initialize result: capabilities and server description.

fn
pub fn InitializeResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InitializeResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InitializeResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InitializeResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InitializeResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InitializeResult

The FromJson implementation for InitializeResult.

item
pub impl @json.ToJson for InitializeResult

The ToJson implementation for InitializeResult.

struct
pub(all) struct InputRequest { id : String request : @json.Json }

One guard-channel request a client must answer (SEP-2322).

fn
pub fn InputRequest::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InputRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InputRequest::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InputRequest::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InputRequest::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InputRequest

The FromJson implementation for InputRequest.

item
pub impl @json.ToJson for InputRequest

The ToJson implementation for InputRequest.

struct
pub(all) struct InputRequiredResult { input_requests : Array[InputRequest] request_state : String? meta : Map[String, @json.Json]? }

Tells the client to answer the carried requests and re-issue the call.

fn
pub fn InputRequiredResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InputRequiredResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InputRequiredResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InputRequiredResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InputRequiredResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InputRequiredResult

The FromJson implementation for InputRequiredResult.

item
pub impl @json.ToJson for InputRequiredResult

The ToJson implementation for InputRequiredResult.

struct
pub(all) struct InputResponse { request_id : String action : String content : Map[String, @json.Json]? }

A client answer to a guard-channel input request (SEP-2322).

fn
pub fn InputResponse::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InputResponse::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InputResponse::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InputResponse::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InputResponse::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InputResponse

The FromJson implementation for InputResponse.

item
pub impl @json.ToJson for InputResponse

The ToJson implementation for InputResponse.

struct
pub(all) struct InputResponseRequestParams { input_responses : Map[String, @json.Json] request_state : String? meta : Map[String, @json.Json]? }

input/response request parameters: answers keyed by request id.

fn
pub fn InputResponseRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn InputResponseRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn InputResponseRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn InputResponseRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn InputResponseRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for InputResponseRequestParams

The FromJson implementation for InputResponseRequestParams.

item
pub impl @json.ToJson for InputResponseRequestParams

The ToJson implementation for InputResponseRequestParams.

enum
pub(all) enum JSONRPCMessage { Request(id~ : RequestId, verb~ : String, params~ : @json.Json?) Notification(verb~ : String, params~ : @json.Json?) Response(id~ : RequestId, result~ : @json.Json) Error(id~ : RequestId, error~ : ErrorData) }

Any message frame on the wire.

fn
pub fn JSONRPCMessage::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn JSONRPCMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn JSONRPCMessage::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn JSONRPCMessage::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn JSONRPCMessage::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for JSONRPCMessage

The FromJson implementation for JSONRPCMessage.

item
pub impl @json.ToJson for JSONRPCMessage

The ToJson implementation for JSONRPCMessage.

struct
pub(all) struct ListPromptsResult { prompts : Array[Prompt] next_cursor : String? ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

The result of a prompts/list call.

fn
pub fn ListPromptsResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ListPromptsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ListPromptsResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ListPromptsResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ListPromptsResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ListPromptsResult

The FromJson implementation for ListPromptsResult.

item
pub impl @json.ToJson for ListPromptsResult

The ToJson implementation for ListPromptsResult.

struct
pub(all) struct ListResourceTemplatesResult { resource_templates : Array[ResourceTemplate] next_cursor : String? ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

The result of a resources/templates/list call.

fn
pub fn ListResourceTemplatesResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ListResourceTemplatesResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ListResourceTemplatesResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ListResourceTemplatesResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ListResourceTemplatesResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ListResourceTemplatesResult

The FromJson implementation for ListResourceTemplatesResult.

item
pub impl @json.ToJson for ListResourceTemplatesResult

The ToJson implementation for ListResourceTemplatesResult.

struct
pub(all) struct ListResourcesResult { resources : Array[Resource] next_cursor : String? ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

The result of a resources/list call.

fn
pub fn ListResourcesResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ListResourcesResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ListResourcesResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ListResourcesResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ListResourcesResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ListResourcesResult

The FromJson implementation for ListResourcesResult.

item
pub impl @json.ToJson for ListResourcesResult

The ToJson implementation for ListResourcesResult.

struct
pub(all) struct ListRootsResult { roots : Array[Root] meta : Map[String, @json.Json]? }

The result of a roots/list call.

fn
pub fn ListRootsResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ListRootsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ListRootsResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ListRootsResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ListRootsResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ListRootsResult

The FromJson implementation for ListRootsResult.

item
pub impl @json.ToJson for ListRootsResult

The ToJson implementation for ListRootsResult.

struct
pub(all) struct ListToolsResult { tools : Array[Tool] next_cursor : String? ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

The result of a tools/list call.

fn
pub fn ListToolsResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ListToolsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ListToolsResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ListToolsResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ListToolsResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ListToolsResult

The FromJson implementation for ListToolsResult.

item
pub impl @json.ToJson for ListToolsResult

The ToJson implementation for ListToolsResult.

enum
pub(all) enum LoggingLevel { Debug Info Notice Warning Error Critical Alert Emergency }

Verbosity levels for notifications/message, ordered debug → emergency.

fn
pub fn LoggingLevel::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn LoggingLevel::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn LoggingLevel::rank(Self) -> Int32

How severe a level is, for comparing two: RFC 5424's order, least severe first.

fn
pub fn LoggingLevel::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn LoggingLevel::to_wire(Self) -> String

Encode this value to its wire string.

struct
pub(all) struct LoggingMessageNotificationParams { level : LoggingLevel logger : String? data : @json.Json }

A log entry streamed by the server.

fn
pub fn LoggingMessageNotificationParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn LoggingMessageNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn LoggingMessageNotificationParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn LoggingMessageNotificationParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn LoggingMessageNotificationParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for LoggingMessageNotificationParams

The FromJson implementation for LoggingMessageNotificationParams.

item
pub impl @json.ToJson for LoggingMessageNotificationParams

The ToJson implementation for LoggingMessageNotificationParams.

struct
pub(all) struct ModelHint { name : String }

Client hints steering server-side model selection.

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

Equality with another value of the same type.

fn
pub fn ModelHint::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ModelHint::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ModelHint::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ModelHint::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ModelHint

The FromJson implementation for ModelHint.

item
pub impl @json.ToJson for ModelHint

The ToJson implementation for ModelHint.

struct
pub(all) struct ModelPreferences { hints : Array[ModelHint]? cost_priority : Double? speed_priority : Double? intelligence_priority : Double? }

What a client prefers of a model: named hints, and the weight it gives cost and speed.

fn
pub fn ModelPreferences::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ModelPreferences::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ModelPreferences::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ModelPreferences::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ModelPreferences::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ModelPreferences

The FromJson implementation for ModelPreferences.

item
pub impl @json.ToJson for ModelPreferences

The ToJson implementation for ModelPreferences.

struct
pub(all) struct PaginatedRequestParams { cursor : String? meta : Map[String, @json.Json]? }

List requests with cursor-based pagination.

fn
pub fn PaginatedRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn PaginatedRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn PaginatedRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn PaginatedRequestParams::progress_token(Self) -> String?

The progress token carried in the request meta.

fn
pub fn PaginatedRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn PaginatedRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for PaginatedRequestParams

The FromJson implementation for PaginatedRequestParams.

item
pub impl @json.ToJson for PaginatedRequestParams

The ToJson implementation for PaginatedRequestParams.

struct
pub(all) struct ProgressNotificationParams { progress_token : String progress : Double message : String? total : Double? }

Progress reported for an in-flight request.

fn
pub fn ProgressNotificationParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ProgressNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ProgressNotificationParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ProgressNotificationParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ProgressNotificationParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ProgressNotificationParams

The FromJson implementation for ProgressNotificationParams.

item
pub impl @json.ToJson for ProgressNotificationParams

The ToJson implementation for ProgressNotificationParams.

struct
pub(all) struct Prompt { name : String title : String? description : String? arguments : Array[PromptArgument]? meta : Map[String, @json.Json]? }

A prompt template exposed to the client.

fn
pub fn Prompt::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Prompt::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Prompt::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Prompt::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Prompt::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Prompt

The FromJson implementation for Prompt.

item
pub impl @json.ToJson for Prompt

The ToJson implementation for Prompt.

struct
pub(all) struct PromptArgument { name : String title : String? description : String? required : Bool? }

One argument of a prompt template.

fn
pub fn PromptArgument::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn PromptArgument::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn PromptArgument::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn PromptArgument::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn PromptArgument::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for PromptArgument

The FromJson implementation for PromptArgument.

item
pub impl @json.ToJson for PromptArgument

The ToJson implementation for PromptArgument.

struct
pub(all) struct PromptMessage { role : Role content : ContentBlock }

One message in a rendered prompt.

fn
pub fn PromptMessage::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn PromptMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn PromptMessage::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn PromptMessage::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn PromptMessage::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for PromptMessage

The FromJson implementation for PromptMessage.

item
pub impl @json.ToJson for PromptMessage

The ToJson implementation for PromptMessage.

struct
pub(all) struct PromptsCapabilities { list_changed : Bool? }

Prompt listings only need list-change notifications.

fn
pub fn PromptsCapabilities::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn PromptsCapabilities::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn PromptsCapabilities::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct ReadResourceRequestParams { uri : String meta : Map[String, @json.Json]? }

resources/read request parameters.

fn
pub fn ReadResourceRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ReadResourceRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ReadResourceRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ReadResourceRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ReadResourceRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ReadResourceRequestParams

The FromJson implementation for ReadResourceRequestParams.

item
pub impl @json.ToJson for ReadResourceRequestParams

The ToJson implementation for ReadResourceRequestParams.

struct
pub(all) struct ReadResourceResult { contents : Array[ResourceContents] ttl_ms : Int32? cache_scope : CacheScope? meta : Map[String, @json.Json]? }

The result of a resources/read call.

fn
pub fn ReadResourceResult::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ReadResourceResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ReadResourceResult::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ReadResourceResult::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ReadResourceResult::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ReadResourceResult

The FromJson implementation for ReadResourceResult.

item
pub impl @json.ToJson for ReadResourceResult

The ToJson implementation for ReadResourceResult.

enum
pub(all) enum Reference { PromptReference(name~ : String) ResourceTemplateReference(uri~ : String) }

A prompt reference used for completion.

fn
pub fn Reference::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Reference::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Reference::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Reference::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Reference::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Reference

The FromJson implementation for Reference.

item
pub impl @json.ToJson for Reference

The ToJson implementation for Reference.

enum
pub(all) enum RequestId { Number(id~ : Int32) Text(id~ : String) }

A JSON-RPC request id: either a number or a string.

fn
pub fn RequestId::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn RequestId::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn RequestId::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn RequestId::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn RequestId::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for RequestId

The FromJson implementation for RequestId.

item
pub impl @json.ToJson for RequestId

The ToJson implementation for RequestId.

struct
pub(all) struct RequestParamsMeta { meta : Map[String, @json.Json]? }

Parameters common to every request; _meta.progressToken drives progress.

fn
pub fn RequestParamsMeta::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn RequestParamsMeta::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn RequestParamsMeta::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn RequestParamsMeta::progress_token(Self) -> String?

The progress token carried in the request meta.

fn
pub fn RequestParamsMeta::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn RequestParamsMeta::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for RequestParamsMeta

The FromJson implementation for RequestParamsMeta.

item
pub impl @json.ToJson for RequestParamsMeta

The ToJson implementation for RequestParamsMeta.

struct
pub(all) struct Resource { uri : String name : String title : String? description : String? mime_type : String? size : Int32? annotations : Annotations? meta : Map[String, @json.Json]? }

A resource exposed for reading.

fn
pub fn Resource::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Resource::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Resource::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Resource::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Resource::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Resource

The FromJson implementation for Resource.

item
pub impl @json.ToJson for Resource

The ToJson implementation for Resource.

enum
pub(all) enum ResourceContents { Text(uri~ : String, mime_type~ : String?, text~ : String) Blob(uri~ : String, mime_type~ : String?, blob~ : String) }

The contents of a resource, either inline text or base64-encoded bytes.

fn
pub fn ResourceContents::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceContents::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ResourceContents::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceContents::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ResourceContents::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn ResourceContents::uri(Self) -> String

The URI this content or reference points at.

item
pub impl @json.FromJson for ResourceContents

The FromJson implementation for ResourceContents.

item
pub impl @json.ToJson for ResourceContents

The ToJson implementation for ResourceContents.

struct
pub(all) struct ResourceTemplate { uri_template : String name : String title : String? description : String? mime_type : String? annotations : Annotations? meta : Map[String, @json.Json]? }

A parameterised resource address pattern.

fn
pub fn ResourceTemplate::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourceTemplate::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ResourceTemplate::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourceTemplate::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ResourceTemplate::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ResourceTemplate

The FromJson implementation for ResourceTemplate.

item
pub impl @json.ToJson for ResourceTemplate

The ToJson implementation for ResourceTemplate.

struct
pub(all) struct ResourcesCapabilities { subscribe : Bool? list_changed : Bool? }

Resource capability flags.

fn
pub fn ResourcesCapabilities::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ResourcesCapabilities::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ResourcesCapabilities::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum Role { User Assistant }

One message in a sampling round trip.

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

Equality with another value of the same type.

fn
pub fn Role::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Role::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn Role::to_wire(Self) -> String

Encode this value to its wire string.

struct
pub(all) struct Root { uri : String name : String? }

A filesystem root the client exposes to the server.

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

Equality with another value of the same type.

fn
pub fn Root::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Root::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Root::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Root::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Root

The FromJson implementation for Root.

item
pub impl @json.ToJson for Root

The ToJson implementation for Root.

struct
pub(all) struct SamplingMessage { role : Role content : ContentBlock }

One message of a sampling conversation, as the client's model is shown it.

fn
pub fn SamplingMessage::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn SamplingMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn SamplingMessage::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn SamplingMessage::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn SamplingMessage::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for SamplingMessage

The FromJson implementation for SamplingMessage.

item
pub impl @json.ToJson for SamplingMessage

The ToJson implementation for SamplingMessage.

struct
pub(all) struct ServerCapabilities { experimental : Map[String, @json.Json]? extensions : Map[String, @json.Json]? logging : Bool? completions : Bool? prompts : PromptsCapabilities? resources : ResourcesCapabilities? tools : ToolCapabilities? tasks : Bool? }

What a server supports; absent groups mean the feature is off.

fn
pub fn ServerCapabilities::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ServerCapabilities::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ServerCapabilities::new() -> Self

Construct a value with the given fields.

fn
pub fn ServerCapabilities::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ServerCapabilities::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ServerCapabilities::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ServerCapabilities

The FromJson implementation for ServerCapabilities.

item
pub impl @json.ToJson for ServerCapabilities

The ToJson implementation for ServerCapabilities.

enum
pub(all) enum ServerNotification { Cancelled(CancelledNotificationParams) Progress(ProgressNotificationParams) Message(LoggingMessageNotificationParams) ResourceUpdated(uri~ : String) ResourceListChanged ToolListChanged PromptListChanged Initialized RootsListChanged }

A notification frame the server can send to a client.

fn
pub fn ServerNotification::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ServerNotification::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ServerNotification::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ServerNotification::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.ToJson for ServerNotification

The ToJson implementation for ServerNotification.

enum
pub(all) enum ServerRequest { Ping(meta~ : Map[String, @json.Json]?) CreateMessage(CreateMessageRequestParams) Elicit(ElicitRequestParams) ListRoots(meta~ : Map[String, @json.Json]?) }

A typed request a server can send to a client.

fn
pub fn ServerRequest::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ServerRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ServerRequest::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ServerRequest::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ServerRequest

The FromJson implementation for ServerRequest.

struct
pub(all) struct SetLevelRequestParams { level : LoggingLevel meta : Map[String, @json.Json]? }

logging/setLevel request parameters.

fn
pub fn SetLevelRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn SetLevelRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn SetLevelRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn SetLevelRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn SetLevelRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for SetLevelRequestParams

The FromJson implementation for SetLevelRequestParams.

item
pub impl @json.ToJson for SetLevelRequestParams

The ToJson implementation for SetLevelRequestParams.

struct
pub(all) struct SubscribeRequestParams { uri : String meta : Map[String, @json.Json]? }

resources/subscribe request parameters.

fn
pub fn SubscribeRequestParams::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn SubscribeRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn SubscribeRequestParams::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn SubscribeRequestParams::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn SubscribeRequestParams::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for SubscribeRequestParams

The FromJson implementation for SubscribeRequestParams.

item
pub impl @json.ToJson for SubscribeRequestParams

The ToJson implementation for SubscribeRequestParams.

struct
pub(all) struct SubscriptionFilter { tools_list_changed : Bool? prompts_list_changed : Bool? resources_list_changed : Bool? resource_subscriptions : Array[String]? }

The notifications a client opts in to on a subscriptions/listen stream. Every field is off unless asked for, so a server that honours this sends only what the client named.

fn
pub fn SubscriptionFilter::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn SubscriptionFilter::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn SubscriptionFilter::new() -> Self

A filter that asks for nothing, which is what an empty object decodes to.

fn
pub fn SubscriptionFilter::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn SubscriptionFilter::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn SubscriptionFilter::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn SubscriptionFilter::wants(Self, String) -> Bool

Whether the client asked for the notification that a list changed.

item
pub impl @json.FromJson for SubscriptionFilter

The FromJson implementation for SubscriptionFilter.

item
pub impl @json.ToJson for SubscriptionFilter

The ToJson implementation for SubscriptionFilter.

struct
pub(all) struct Tool { name : String title : String? description : String? input_schema : @json.Json output_schema : @json.Json? icons : Array[Icon]? annotations : ToolAnnotations? execution : ToolExecution? meta : Map[String, @json.Json]? }

A tool exposed to the client.

fn
pub fn Tool::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Tool::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn Tool::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Tool::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn Tool::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for Tool

The FromJson implementation for Tool.

item
pub impl @json.ToJson for Tool

The ToJson implementation for Tool.

struct
pub(all) struct ToolAnnotations { title : String? read_only_hint : Bool? destructive_hint : Bool? idempotent_hint : Bool? open_world_hint : Bool? }

UI hints for a tool.

fn
pub fn ToolAnnotations::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ToolAnnotations::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ToolAnnotations::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ToolAnnotations::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ToolAnnotations::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ToolAnnotations

The FromJson implementation for ToolAnnotations.

item
pub impl @json.ToJson for ToolAnnotations

The ToJson implementation for ToolAnnotations.

struct
pub(all) struct ToolCapabilities { list_changed : Bool? }

Tool listings only need list-change notifications.

fn
pub fn ToolCapabilities::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ToolCapabilities::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ToolCapabilities::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct ToolExecution { task_support : @tasks.TaskMode }

Task execution configuration advertised on a tool (SEP-1686).

fn
pub fn ToolExecution::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ToolExecution::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn ToolExecution::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ToolExecution::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn ToolExecution::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for ToolExecution

The FromJson implementation for ToolExecution.

item
pub impl @json.ToJson for ToolExecution

The ToJson implementation for ToolExecution.

Errors

The error type the handlers raise, and how it maps onto JSON-RPC error codes.

fn
pub fn insufficient_scope(Array[String]) -> FastMCPError

Construct an InsufficientScope error with the standard message.

fn
pub fn to_mcp_error(FastMCPError, default_code? : Int32) -> @types.ErrorData

Translate a moonmcp error into a wire-format error payload. NotFound, Disabled and Validation map to invalid_params (-32602); an existing Mcp payload is returned unchanged so an explicit code chosen upstream survives translation; everything else falls back to default_code (internal_error by default).

error
pub(all) suberror FastMCPError { Mcp(@types.ErrorData) Validation(String) Resource(String) Tool(String) Prompt(String) InvalidSignature(String) Client(String) NotFound(String) Disabled(String) ResourceSecurity(String) Authorisation(String) InsufficientScope(required_scopes~ : Array[String], message~ : String) }

Custom errors for moonmcp, mirroring fastmcp/exceptions.py.

fn
pub fn FastMCPError::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn FastMCPError::message(Self) -> String

Render the human-readable message carried by the error.

fn
pub fn FastMCPError::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn FastMCPError::output(Self, &Logger) -> Unit

The message alone, as a person reads it.

fn
pub fn FastMCPError::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn FastMCPError::to_string(Self) -> String

Render the error as a string.

item
pub impl Show for FastMCPError

The Show implementation for MCPError.

Component

The shared metadata every capability carries: name, title, description, tags and icons.

fn
pub fn coerce_version(@json.Json?) -> String? raise @exceptions.FastMCPError

Coerce a JSON scalar to a version string. Raises Validation for non-scalar values or versions containing @ (used as the key delimiter).

fn
pub fn get_fastmcp_metadata(Map[String, @json.Json]?) -> FastMCPMeta

Extract moonmcp metadata from a component's meta object. Handles both the current fastmcp namespace and the legacy _fastmcp namespace for compatibility with older servers.

fn
pub fn public_result_meta(Map[String, @json.Json]?) -> Map[String, @json.Json]?

Strip moonmcp's internal bookkeeping out of component meta. Returns None when nothing public remains, so components without user metadata keep an absent _meta rather than an empty object.

struct
pub(all) struct ComponentBase { key_prefix : String name : String version : String? title : String? description : String? icons : Array[@types.Icon]? tags : @set.Set[String] meta : Map[String, @json.Json]? task_config : @tasks.TaskConfig }

Common state shared by all moonmcp components.

fn
pub fn ComponentBase::get_meta(Self) -> Map[String, @json.Json]

The public meta information about the component. Always includes a fastmcp key containing the sorted tags list and the version (when set); internal keys (prefixed with _) are stripped from the fastmcp namespace.

fn
pub fn ComponentBase::key(Self, String) -> String

The globally unique lookup key for a component. Format: "{key_prefix}:{identifier}@{version}"; the @ delimiter is always present so keys parse unambiguously even when the identifier itself contains @.

fn
pub fn ComponentBase::make_key(String, String) -> String

Construct the lookup key for a component type, e.g. "tool:name".

fn
pub fn ComponentBase::new(String, String, version? : String, title? : String, description? : String, icons? : Array[@types.Icon], tags? : @set.Set[String], meta? : Map[String, @json.Json], task_config? : @tasks.TaskConfig) -> Self

Construct a value with the given fields.

struct
pub(all) struct FastMCPMeta { tags : Array[String] version : String? versions : Array[String] }

Namespaced metadata carried in a component's _meta.

fn
pub fn FastMCPMeta::empty() -> Self

No tags and no versions: what a component without metadata of its own carries.

fn
pub fn FastMCPMeta::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn FastMCPMeta::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn FastMCPMeta::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub(open) trait Component { fn base(Self) -> ComponentBase fn identifier(Self) -> String = _ fn key(Self) -> String = _ fn get_meta(Self) -> Map[String, @json.Json] = _ }

The shared component metadata.

Tasks

Configuration for tools that hand long work to a task and answer later.

let
pub let default_poll_interval_ms : Int32

How often a task is polled when the caller says nothing: five seconds.

let
pub let default_ttl_ms : Int32

How long a task's result is kept when the caller says nothing: one minute.

fn
pub fn task_mode_from_wire(String) -> TaskMode?

The task mode a wire string names, or None for one this library does not offer.

let
pub let tasks_extension_id : String

Reverse-DNS identifier of the SEP-2663 tasks extension.

struct
pub(all) struct TaskConfig { mode : TaskMode poll_interval_ms : Int32 }

Configuration for MCP background task execution.

fn
pub fn TaskConfig::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn TaskConfig::from_bool(Bool) -> Self

Convert a boolean task flag to a TaskConfig.

fn
pub fn TaskConfig::new(mode? : TaskMode, poll_interval_ms? : Int32) -> Self

Construct a value with the given fields.

fn
pub fn TaskConfig::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn TaskConfig::supports_tasks(Self) -> Bool

Whether this component supports task execution.

fn
pub fn TaskConfig::to_repr(Self) -> @debug.Repr

Debug representation of this value.

struct
pub(all) struct TaskMeta { ttl : Int32? fn_key : String? }

Metadata for task-augmented execution requests.

fn
pub fn TaskMeta::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn TaskMeta::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn TaskMeta::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum TaskMode { Forbidden Optional Required }

How a component handles task-augmented execution requests.

fn
pub fn TaskMode::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn TaskMode::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn TaskMode::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn TaskMode::to_wire(Self) -> String

Encode this value to its wire string.

Settings

Build-time settings surfaced to the running server.

fn
pub fn log_level_from_wire(String) -> LogLevel?

The log level a settings file names, or None for an unknown one.

fn
pub fn session_idle_timeout_from_wire(String) -> SessionIdleTimeout?

The idle timeout a settings file names: a number of seconds, or the words this library knows.

fn
pub fn telemetry_mode_from_wire(String) -> TelemetryMode?

The telemetry mode a settings file names, or None for an unknown one.

let
pub let ten_mb_in_bytes : Int32

The largest inline content this library accepts: ten mebibytes.

fn
pub fn transport_kind_from_wire(String) -> TransportKind?

The transport a settings file or a client configuration names, or None for one this library does not speak.

enum
pub(all) enum CheckForUpdates { Stable Prerelease Off }

When the tool looks for a newer version of itself.

fn
pub fn CheckForUpdates::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn CheckForUpdates::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn CheckForUpdates::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum LogLevel { Debug Info Warning Error Critical }

How much a server says about its own work, from debug to critical.

fn
pub fn LogLevel::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn LogLevel::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn LogLevel::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn LogLevel::to_wire(Self) -> String

Encode this value to its wire string.

enum
pub(all) enum SessionIdleTimeout { Auto Never Seconds(Double) }

How long an idle session is kept: the server's choice, never, or a number of seconds.

fn
pub fn SessionIdleTimeout::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn SessionIdleTimeout::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn SessionIdleTimeout::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn SessionIdleTimeout::to_wire(Self) -> String

The http_session_idle_timeout wire forms: "auto", "none", or a number.

struct
pub(all) struct Settings { home : String oauth_encryption_key : String? test_mode : Bool log_enabled : Bool log_level : LogLevel enable_rich_logging : Bool enable_rich_tracebacks : Bool deprecation_warnings : Bool telemetry_mode : TelemetryMode client_init_timeout : Double? client_disconnect_timeout : Double transport : TransportKind host : String port : Int32 sse_path : String message_path : String streamable_http_path : String debug : Bool mask_error_details : Bool client_log_level : @types.LoggingLevel? strict_input_validation : Bool ssrf_trust_proxy : Bool server_dependencies : Array[String] json_response : Bool stateless_http : Bool http_host_origin_protection : Bool http_allowed_hosts : Array[String]? http_allowed_origins : Array[String]? http_session_idle_timeout : SessionIdleTimeout mounted_components_raise_on_load_error : Bool show_server_banner : Bool check_for_updates : CheckForUpdates }

Everything the framework reads from FASTMCP_* environment variables.

fn
pub fn Settings::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn Settings::from_env() -> Self

Load settings, applying FASTMCP_* environment overrides.

fn
pub fn Settings::new() -> Self

Construct a value with the given fields.

fn
pub fn Settings::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn Settings::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum TelemetryMode { Native PropagationOnly Off }

How moonmcp's native telemetry behaves.

fn
pub fn TelemetryMode::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn TelemetryMode::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn TelemetryMode::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn TelemetryMode::to_wire(Self) -> String

Encode this value to its wire string.

enum
pub(all) enum TransportKind { Stdio Http Sse StreamableHttp }

The transport a client configuration names for a server.

fn
pub fn TransportKind::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn TransportKind::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn TransportKind::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn TransportKind::to_wire(Self) -> String

Encode this value to its wire string.

Config

Default ports and other knobs the server reads at start.

fn
pub fn config_from_json(@json.Json) -> MCPConfig raise @json.JsonDecodeError

Parse MCP configuration from a JSON document.

fn
pub fn infer_transport_type_from_url(String) -> Result[String, String]

Infer "sse" or "http" from a remote server URL.

struct
pub(all) struct MCPConfig { mcp_servers : Map[String, MCPServerEntry] }

A configuration object for MCP servers.

fn
pub fn MCPConfig::add_server(Self, String, MCPServerEntry) -> Unit

Add or update a server in the configuration.

fn
pub fn MCPConfig::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn MCPConfig::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn MCPConfig::new() -> Self

Construct a value with the given fields.

fn
pub fn MCPConfig::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn MCPConfig::to_json(Self) -> @json.Json

Convert the configuration to a JSON document, omitting empty fields.

fn
pub fn MCPConfig::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for MCPConfig

The FromJson implementation for MCPConfig.

struct
pub(all) struct MCPServerEntry { kind : MCPServerKind timeout : Int32? description : String? icon : String? authentication : Map[String, @json.Json]? transform : ServerTransform? }

One server in a client configuration: how to reach it, and what to hand it when it starts.

fn
pub fn MCPServerEntry::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn MCPServerEntry::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError

Decode this shape from JSON.

fn
pub fn MCPServerEntry::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn MCPServerEntry::to_json(Self) -> @json.Json

Encode this shape to JSON.

fn
pub fn MCPServerEntry::to_repr(Self) -> @debug.Repr

Debug representation of this value.

item
pub impl @json.FromJson for MCPServerEntry

The FromJson implementation for MCPServerEntry.

item
pub impl @json.ToJson for MCPServerEntry

The ToJson implementation for MCPServerEntry.

enum
pub(all) enum MCPServerKind { Stdio(command~ : String, args~ : Array[String], env~ : Map[String, @json.Json], cwd~ : String?, keep_alive~ : Bool?) Remote(url~ : String, transport~ : RemoteTransport?, headers~ : Map[String, String], auth~ : String?, sse_read_timeout_ms~ : Int32?) }

One server entry: either a stdio command or a remote URL.

fn
pub fn MCPServerKind::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn MCPServerKind::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn MCPServerKind::to_repr(Self) -> @debug.Repr

Debug representation of this value.

enum
pub(all) enum RemoteTransport { Http StreamableHttp Sse }

The HTTP transports a client configuration may name.

fn
pub fn RemoteTransport::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn RemoteTransport::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn RemoteTransport::to_repr(Self) -> @debug.Repr

Debug representation of this value.

fn
pub fn RemoteTransport::to_wire(Self) -> String

Encode this value to its wire string.

struct
pub(all) struct ServerTransform { tools : Map[String, @json.Json] include_tags : @set.Set[String]? exclude_tags : @set.Set[String]? }

Tool transforms and tag filters for a proxied server.

fn
pub fn ServerTransform::equal(Self, Self) -> Bool

Equality with another value of the same type.

fn
pub fn ServerTransform::not_equal(Self, Self) -> Bool

Inequality with another value of the same type.

fn
pub fn ServerTransform::to_repr(Self) -> @debug.Repr

Debug representation of this value.

Utilities

Small helpers, chiefly media-type handling for binary content.

fn
pub fn encode_base64(Bytes) -> String

Base64-encode raw bytes for wire transport.

struct
pub(all) struct Audio { path : String? data : Bytes? format : String? mime_type : String annotations : @types.Annotations? }

A helper for returning audio from tools.

fn
pub fn Audio::new(path? : String, data? : Bytes, format? : String, annotations? : @types.Annotations) -> Self raise @exceptions.FastMCPError

Create an audio clip from a file path or raw data, not both.

fn
pub fn Audio::to_audio_content(Self, mime_type? : String, annotations? : @types.Annotations) -> @types.ContentBlock raise @exceptions.FastMCPError

Convert to an audio content block.

struct
pub(all) struct File { path : String? data : Bytes? format : String? name : String? mime_type : String annotations : @types.Annotations? }

A helper for returning file data from tools.

fn
pub fn File::new(path? : String, data? : Bytes, format? : String, name? : String, annotations? : @types.Annotations) -> Self raise @exceptions.FastMCPError

Create a file payload from a path or raw data, not both.

fn
pub fn File::to_resource_content(Self, mime_type? : String, annotations? : @types.Annotations) -> @types.ContentBlock raise @exceptions.FastMCPError

Convert to an embedded resource content block.

struct
pub(all) struct Image { path : String? data : Bytes? format : String? mime_type : String annotations : @types.Annotations? }

A helper for returning images from tools.

fn
pub fn Image::new(path? : String, data? : Bytes, format? : String, annotations? : @types.Annotations) -> Self raise @exceptions.FastMCPError

Create an image from a file path or raw data, not both.

fn
pub fn Image::to_data_uri(Self, mime_type? : String) -> String raise @exceptions.FastMCPError

Render as a data: URI.

fn
pub fn Image::to_image_content(Self, mime_type? : String, annotations? : @types.Annotations) -> @types.ContentBlock raise @exceptions.FastMCPError

Convert to an image content block.