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.
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.
pub let theme : Theme
The look page and Server::to_asgi use unless told otherwise: the one the moonmcp website wears.
pub(all) enum Theme { Site Plain }
The two looks the page comes in.
pub fn Theme::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Theme::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
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.
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.
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.
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.
pub fn list_changed_notification(String) -> @json.Json
The notification that a server's tools, prompts or resources changed.
pub fn method_of(@json.Json) -> String?
The method a message names, if it is a JSON-RPC one at all.
pub fn params_of(@json.Json) -> Map[String, @json.Json]
The parameters a message carries, empty when it carries none.
pub fn request_id_of(@json.Json) -> @json.Json?
The id a request carries; None on a notification.
pub fn resource_updated_notification(String) -> @json.Json
The notification that one resource was rewritten.
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.
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.
pub fn Cancellations::add(Self, @json.Json) -> Unit
Record that the client no longer wants the answer to request id.
pub fn Cancellations::has(Self, @json.Json) -> Bool
Whether the client has withdrawn request id.
pub fn Cancellations::new() -> Self
Nothing withdrawn yet.
pub fn Cancellations::unwatch(Self, @json.Json) -> Unit
Stop waiting to be told: the request is over.
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.
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.
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.
pub fn Channel::quiet() -> Self
A channel with nowhere to send and no caller to lose.
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).
pub fn Scope::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Scope::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Scope::to_cache_scope(Self) -> @types.CacheScope
The same scope as the wire names it.
pub fn Scope::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Server::add_prompt(Self, @prompts.Prompt) -> Unit
Offer prompt. A second prompt under the same name replaces the first.
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.
pub fn Server::add_resource(Self, @resources.Resource) -> Unit
Offer resource at its URI. A second resource at the same URI replaces the first.
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.
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.
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.
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.
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.
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.
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.
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.
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.
pub fn Server::notify_prompts_changed(Self) -> Unit
Tell every subscription that the prompts changed.
pub fn Server::notify_resource_updated(Self, String) -> Unit
Tell the subscriptions that asked for uri that it was rewritten.
pub fn Server::notify_resources_changed(Self) -> Unit
Tell every subscription that the resources changed.
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.
pub fn Server::offered_prompts(Self) -> Array[@prompts.Prompt]
The prompts a client is offered, after the transforms.
pub fn Server::offered_resources(Self) -> Array[@resources.Resource]
The resources a client is offered, after the transforms.
pub fn Server::offered_templates(Self) -> Array[@resources.ResourceTemplate]
The resource templates a client is offered, after the transforms.
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.
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).
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.
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)).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
pub fn notification(String, Map[String, @json.Json]) -> @json.Json
One notification message, framed as the wire carries it.
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.
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.
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.
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.
pub async fn Context::debug(Self, String) -> Unit
A log message at debug.
pub async fn Context::error(Self, String) -> Unit
A log message at error.
pub fn Context::facts(Self) -> Facts
The facts this request was served with.
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.
pub fn Context::headers(Self) -> Map[String, String]
Every header the request carried, keyed in lower case.
pub async fn Context::info(Self, String) -> Unit
A log message at info.
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.
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.
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.
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.
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.
pub fn Context::operation(Self) -> String
The method that reached this handler, for example tools/call.
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.
pub fn Context::protocol_version(Self) -> String
The protocol revision the request was sent under.
pub fn Context::quiet() -> Self
A context for a call made without a connection: reports are dropped and the caller is always there.
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.
pub fn Context::request_id(Self) -> @json.Json
The JSON-RPC id of the request, which a progress notification or a subscription echoes back.
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.
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.
pub async fn Context::warning(Self, String) -> Unit
A log message at warning.
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.
pub fn Facts::equal(Self, Self) -> Bool
Equality with another value of the same type.
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.
pub fn Facts::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
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.
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.
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.
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.
pub async fn Client::close(Self) -> Unit
Stop asking for anything on this connection.
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.
pub async fn Client::discover(Self) -> Map[String, @json.Json]
What the server supports and which revisions it speaks.
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.
pub async fn Client::get_prompt(Self, String, arguments? : Map[String, @json.Json]) -> @types.GetPromptResult
Render the prompt name with arguments.
pub async fn Client::list_prompts(Self) -> Array[@types.Prompt]
The prompts the server offers.
pub async fn Client::list_resources(Self) -> Array[@types.Resource]
The resources the server offers.
pub async fn Client::list_tools(Self) -> Array[@types.Tool]
The tools the server offers.
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.
pub async fn Client::notify(Self, String, params? : Map[String, @json.Json]) -> Unit
Send a message that gets no reply.
pub async fn Client::ping(Self) -> Unit
A bare result with no payload.
pub fn Client::protocol_version(Self) -> String
The revision in force on this connection.
pub async fn Client::read_resource(Self, String) -> @types.ReadResourceResult
Read the resource at uri.
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.
pub fn Client::server_capabilities(Self) -> @types.ServerCapabilities?
What the server says it can do.
pub fn Client::server_info(Self) -> @types.Implementation?
Who the server says it is, once it has said.
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.
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.
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.
pub fn Handlers::none() -> Self
A client that answers nothing.
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.
pub fn Lines::answer_with(Self, async (@json.Json) -> @json.Json?) -> Unit
Keep answer as the place the server's questions go.
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.
pub async fn Lines::close(Self) -> Unit
Nothing to let go: the streams belong to whoever made them.
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.
pub fn Lines::new(read~ : async () -> String?, write~ : async (String) -> Unit) -> Self
Speak newline-delimited JSON-RPC over read and write.
pub async fn Lines::tell(Self, @json.Json) -> Unit
Write one notification; nothing is read back.
pub impl Transport for Lines
The Transport implementation for Lines.
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.
pub fn Memory::answer_with(Self, async (@json.Json) -> @json.Json?) -> Unit
Keep answer as the place the server's questions go.
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.
pub async fn Memory::close(Self) -> Unit
Nothing to let go: the server is in this process.
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.
pub fn Memory::new(@server.Server) -> Self
Reach server directly. Its handlers see no headers and no client identity, since nothing carried the message.
pub async fn Memory::tell(Self, @json.Json) -> Unit
Hand a notification to the server; nothing comes back.
pub impl Transport for Memory
The Transport implementation for Memory.
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.
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.
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.
pub fn client_credentials_form(resource? : String, scope? : String) -> Array[(String, String)]
The body of a client-credentials request (RFC 6749 §4.4).
pub fn form_encode(Array[(String, String)]) -> String
pairs as an application/x-www-form-urlencoded body.
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.
pub fn origin_of(String) -> String
Everything in url before its path: scheme, authority, and nothing else.
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.
pub fn percent_encode(StringView) -> String
Percent-encode everything but the unreserved characters, which is what a form body and an OAuth parameter take.
pub fn query_of(String) -> String
The query of url, without the ?.
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.
pub fn refresh_form(refresh_token~ : String, resource? : String, scope? : String) -> Array[(String, String)]
The body of a refresh (RFC 6749 §6).
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.
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.
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).
pub fn target_of(String) -> String
The whole of url as a request line carries it: path and query.
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.
pub fn widen_scope(String?, String?) -> String?
The union of two scope strings, the current one first, without repeats.
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.
pub fn with_query(String, Array[(String, String)]) -> String
url with query as its query, replacing one it had.
pub(all) suberror Refused { Refused(message~ : String) }
Why an OAuth client could not go on, in words a person reads.
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.
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.
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.
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.
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.
pub fn Challenge::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Challenge::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
pub fn Challenge::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum Credentials { Basic Post Public }
How the token endpoint is asked to authenticate the client.
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.
pub fn Credentials::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Credentials::form(Self, Registration) -> Array[(String, String)]
The fields this method puts in the token request's body.
pub fn Credentials::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
pub fn Credentials::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Grant::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Grant::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Grant::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Metadata::body(Self) -> Map[String, @json.Json]
The body of a registration request.
pub fn Metadata::equal(Self, Self) -> Bool
Equality with another value of the same type.
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.
pub fn Metadata::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Metadata::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Pkce::equal(Self, Self) -> Bool
Equality with another value of the same type.
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.
pub fn Pkce::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Pkce::of(String) -> Self
The pair for a verifier already chosen: the challenge is its SHA-256 digest in base64url, without padding.
pub fn Pkce::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Principal::equal(Self, Self) -> Bool
Equality with another value of the same type.
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.
pub fn Principal::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Principal::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct Redirect { code : String state : String? }
The code and state a redirect carried, or why there is none.
pub fn Redirect::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Redirect::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
pub fn Redirect::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Registration::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Registration::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Registration::parse(@json.Json) -> Self raise Refused
Read a registration response.
pub fn Registration::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Resource::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Resource::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Resource::parse(@json.Json) -> Self raise Refused
Read protected resource metadata.
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.
pub fn Resource::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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".
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).
pub fn Server::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Server::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Server::offers(Self, String) -> Bool
Whether this server offers the grant.
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.
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.
pub fn Server::serves_authorization_code(Self) -> Bool
Whether this server can run an authorization-code flow with PKCE.
pub fn Server::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct Tokens { access_token : String token_type : String expires_in : Int64? refresh_token : String? scope : String? }
What the token endpoint answered.
pub fn Tokens::equal(Self, Self) -> Bool
Equality with another value of the same type.
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".
pub fn Tokens::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
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.
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.
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.
pub fn convert_to_content(@json.Json) -> Array[@types.ContentBlock] raise @json.JsonDecodeError
Convert a raw result to a sequence of content blocks.
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.
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.
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.
pub fn Tool::base(Self) -> @component.ComponentBase
The shared component metadata.
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.
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.
pub fn Tool::get_meta(Self) -> Map[String, @json.Json]
Arbitrary metadata carried with the component.
pub fn Tool::identifier(Self) -> String
The stable identifier used in listings.
pub fn Tool::key(Self) -> String
The de-duplication key used in the registry.
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.
pub async fn Tool::run(Self, Map[String, @json.Json]) -> ToolResult raise @exceptions.FastMCPError
Run the tool with arguments.
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.
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.
pub impl @component.Component for Tool
The Component implementation for Tool.
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.
pub fn ToolResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ToolResult::from_mcp_result(@types.CallToolResult) -> Self
Wrap a protocol result while preserving its exact wire representation.
pub fn ToolResult::input_required(@types.InputRequiredResult) -> Self
Wrap a client-input ask (SEP-2322) as an ordinary tool result.
pub fn ToolResult::is_input_required(Self) -> Bool
Whether this result carries a client-input ask (SEP-2322).
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.
pub fn ToolResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ToolResult::to_mcp_result(Self) -> @types.CallToolResult
Convert to the protocol result, keeping the original wire representation when one was preserved.
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.
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.
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.
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.
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.
pub fn extract_exploded_query_params(String) -> Array[String]
Extract query parameter names declared with the explode modifier: {?tags*} marks tags as repeatable.
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.
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.
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.
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.
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.
pub fn parse_template_params(String) -> @set.Set[String]
All parameter names a template declares, hyphens normalised to underscores, path and query parameters combined.
pub fn pct_encode(String, safe? : String) -> String
Percent-encode text, keeping unreserved characters plus safe.
pub fn resolve_security(ResourceSecuritySetting, ResourceSecurity?) -> ResourceSecurity?
Resolve the effective policy for a component.
pub(all) enum ContentPayload { Text(String) Blob(Bytes) }
The payload of a resource content item: inline text or raw bytes.
pub fn ContentPayload::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ContentPayload::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ContentPayload::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum RawResourceValue { Text(String) Blob(Bytes) Ready(ResourceResult) }
What a resource read function may return: text, bytes or a full result.
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.
pub fn Resource::base(Self) -> @component.ComponentBase
The shared component metadata.
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.
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.
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.
pub fn Resource::get_meta(Self) -> Map[String, @json.Json]
Arbitrary metadata carried with the component.
pub fn Resource::identifier(Self) -> String
The stable identifier used in listings.
pub fn Resource::key(Self) -> String
The de-duplication key used in the registry.
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.
pub async fn Resource::read(Self) -> RawResourceValue raise @exceptions.FastMCPError
Read the resource content.
pub async fn Resource::read_result(Self) -> ResourceResult raise @exceptions.FastMCPError
Server entry point for resource reads.
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.
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.
pub fn Resource::to_mcp_resource(Self) -> @types.Resource
Convert the resource to its wire representation.
pub impl @component.Component for Resource
The Component implementation for Resource.
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.
pub fn ResourceContent::equal(Self, Self) -> Bool
Equality with another value of the same type.
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.
pub fn ResourceContent::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceContent::to_mcp_resource_contents(Self, String) -> @types.ResourceContents
Convert to the wire resource contents type; bytes are base64-encoded.
pub fn ResourceContent::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct ResourceResult { contents : Array[ResourceContent] meta : Map[String, @json.Json]? input_required : @types.InputRequiredResult? }
The canonical result of a resource read.
pub fn ResourceResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourceResult::input_required(@types.InputRequiredResult) -> Self
Wrap a client-input ask (SEP-2322) as an ordinary resource result.
pub fn ResourceResult::is_input_required(Self) -> Bool
Whether this result carries a client-input ask (SEP-2322).
pub fn ResourceResult::new(Array[ResourceContent], meta? : Map[String, @json.Json]) -> Self
Create a resource result from content items.
pub fn ResourceResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceResult::to_mcp_result(Self, String) -> @types.ReadResourceResult
Convert to the wire read-resource result.
pub fn ResourceResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn ResourceSecurity::default() -> Self
Secure-by-default policy: traversal, absolute paths and null bytes all rejected.
pub fn ResourceSecurity::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourceSecurity::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceSecurity::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub(all) enum ResourceSecuritySetting { Inherit Explicit(ResourceSecurity) Disabled }
Per-component security setting: inherit the server-wide default, apply an explicit policy, or disable screening.
pub fn ResourceSecuritySetting::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourceSecuritySetting::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceSecuritySetting::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn ResourceTemplate::base(Self) -> @component.ComponentBase
The shared component metadata.
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.
pub fn ResourceTemplate::create_resource(Self, String, Map[String, @json.Json]) -> Resource
Create a concrete resource from the template for the given parameters.
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.
pub fn ResourceTemplate::get_meta(Self) -> Map[String, @json.Json]
Arbitrary metadata carried with the component.
pub fn ResourceTemplate::identifier(Self) -> String
The stable identifier used in listings.
pub fn ResourceTemplate::key(Self) -> String
The de-duplication key used in the registry.
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.
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.
pub async fn ResourceTemplate::read(Self, Map[String, @json.Json]) -> RawResourceValue raise @exceptions.FastMCPError
Read the resource content with the matched parameters.
pub async fn ResourceTemplate::read_result(Self, String, Map[String, @json.Json]) -> ResourceResult raise @exceptions.FastMCPError
Server entry point for template reads.
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.
pub fn ResourceTemplate::resolve_security(Self, ResourceSecurity?) -> ResourceSecurity?
Resolve the effective security policy for this template.
pub fn ResourceTemplate::to_mcp_template(Self) -> @types.ResourceTemplate
Convert the template to its wire representation.
pub impl @component.Component for ResourceTemplate
The Component implementation for ResourceTemplate.
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.
pub(all) struct Message { role : @types.Role content : @types.ContentBlock }
A wrapper for a prompt message with a role.
pub fn Message::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Message::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Message::of_content(@types.ContentBlock, role? : @types.Role) -> Self
Create a message from an existing content block, user role by default.
pub fn Message::text(String, role? : @types.Role) -> Self
Create a message from plain text, user role by default.
pub fn Message::to_mcp_prompt_message(Self) -> @types.PromptMessage
Convert to the wire prompt message.
pub fn Message::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Prompt::base(Self) -> @component.ComponentBase
The shared component metadata.
pub fn Prompt::convert_result(Self, RenderedPrompt) -> PromptResult
Convert a rendered value to a canonical result.
pub fn Prompt::get_meta(Self) -> Map[String, @json.Json]
Arbitrary metadata carried with the component.
pub fn Prompt::identifier(Self) -> String
The stable identifier used in listings.
pub fn Prompt::key(Self) -> String
The de-duplication key used in the registry.
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.
pub async fn Prompt::render(Self, Map[String, @json.Json]) -> RenderedPrompt raise @exceptions.FastMCPError
Render the prompt with arguments.
pub async fn Prompt::render_result(Self, Map[String, @json.Json]) -> PromptResult raise @exceptions.FastMCPError
Server entry point for prompt rendering.
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.
pub fn Prompt::to_mcp_prompt(Self) -> @types.Prompt
Convert the prompt to its wire representation.
pub impl @component.Component for Prompt
The Component implementation for Prompt.
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.
pub fn PromptResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn PromptResult::input_required(@types.InputRequiredResult) -> Self
Wrap a client-input ask (SEP-2322) as an ordinary prompt result.
pub fn PromptResult::is_input_required(Self) -> Bool
Whether this result carries a client-input ask (SEP-2322).
pub fn PromptResult::new(Array[Message], description? : String, meta? : Map[String, @json.Json]) -> Self
Create a prompt result from a list of messages.
pub fn PromptResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn PromptResult::to_mcp_prompt_result(Self) -> @types.GetPromptResult
Convert to the wire get-prompt result.
pub fn PromptResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
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.
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.
pub fn Listing::prompts(Self) -> Array[@prompts.Prompt]
The prompts this value supplies or lets through.
pub fn Listing::resources(Self) -> Array[@resources.Resource]
The resources this value supplies or lets through.
pub fn Listing::templates(Self) -> Array[@resources.ResourceTemplate]
The resource templates this value supplies or lets through.
pub fn Listing::tools(Self) -> Array[@tools.Tool]
The tools this value supplies or lets through.
pub impl Provider for Listing
The Provider implementation for Listing.
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.
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.
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.
pub fn Hidden::hides(Self, String) -> Bool
Whether name is hidden.
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.
pub fn Hidden::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]
The prompts this value supplies or lets through.
pub fn Hidden::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]
The resources this value supplies or lets through.
pub fn Hidden::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]
The resource templates this value supplies or lets through.
pub fn Hidden::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]
The tools this value supplies or lets through.
pub impl Transform for Hidden
The Transform implementation for Hidden.
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.
pub fn Namespace::new(String) -> Self
A namespace under prefix.
pub fn Namespace::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]
The prompts this value supplies or lets through.
pub fn Namespace::rename(Self, String) -> String
The name name takes inside the namespace.
pub fn Namespace::rename_uri(Self, String) -> String
The URI uri takes inside the namespace.
pub fn Namespace::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]
The resources this value supplies or lets through.
pub fn Namespace::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]
The resource templates this value supplies or lets through.
pub fn Namespace::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]
The tools this value supplies or lets through.
pub impl Transform for Namespace
The Transform implementation for Namespace.
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.
pub fn Tagged::keeps(Self, @set.Set[String]) -> Bool
Whether a component carrying tags passes.
pub fn Tagged::new(any_of~ : Array[String]) -> Self
Keep the components tagged with any of any_of.
pub fn Tagged::prompts(Self, Array[@prompts.Prompt]) -> Array[@prompts.Prompt]
The prompts this value supplies or lets through.
pub fn Tagged::resources(Self, Array[@resources.Resource]) -> Array[@resources.Resource]
The resources this value supplies or lets through.
pub fn Tagged::templates(Self, Array[@resources.ResourceTemplate]) -> Array[@resources.ResourceTemplate]
The resource templates this value supplies or lets through.
pub fn Tagged::tools(Self, Array[@tools.Tool]) -> Array[@tools.Tool]
The tools this value supplies or lets through.
pub impl Transform for Tagged
The Transform implementation for Tagged.
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.
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.
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.
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.
pub fn Caching::clear(Self) -> Unit
Forget everything.
pub fn Caching::hits(Self) -> Int32
How many calls were answered without asking the server.
pub fn Caching::layer(Self) -> Layer
The layer this cache installs on a server.
pub fn Caching::misses(Self) -> Int32
How many went through.
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.
pub fn Caching::size(Self) -> Int32
How many answers are held right now.
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.
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.
pub fn Call::new(operation~ : Operation, name~ : String, arguments? : Map[String, @json.Json], context~ : @context.Context) -> Self
The call a request makes.
pub fn Call::subject(Self) -> String
Who is calling, as the authorisation check named them; empty when the request carried no identity.
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.
pub fn Layer::new(name? : String, run~ : async (Call, Next) -> @json.Json raise @exceptions.FastMCPError) -> Self
A layer made of a function.
pub async fn Layer::serve(Self, Call, Next) -> @json.Json raise @exceptions.FastMCPError
Serve the call through this layer alone, with next behind it.
pub(all) struct Next {
The rest of the chain, as a layer is handed it.
pub async fn Next::then(Self, Call) -> @json.Json raise @exceptions.FastMCPError
Serve the call with everything behind this point in the chain.
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.
pub fn Operation::code(Self) -> String
The JSON-RPC method an operation answers.
pub fn Operation::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Operation::is_list(Self) -> Bool
Whether the operation lists components rather than running one.
pub fn Operation::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Operation::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn RateLimiting::callers(Self) -> Int32
How many callers are being counted.
pub fn RateLimiting::layer(Self) -> Layer
The layer this limiter installs on a server.
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.
pub fn RateLimiting::refused(Self) -> Int32
How many calls were refused.
pub fn RateLimiting::reset(Self) -> Unit
Refill everyone to a full burst, as if no one had called yet.
pub(all) struct Span { operation : Operation name : String duration_us : Double failed : Bool }
One served request, as the telemetry layer saw it.
pub fn Span::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn Telemetry::clear(Self) -> Unit
Forget every span and counter recorded so far.
pub fn Telemetry::count(Self, Operation) -> Int32
How many requests of operation were served.
pub fn Telemetry::failures(Self) -> Int32
How many of them ended in an error.
pub fn Telemetry::layer(Self) -> Layer
The layer this recorder installs on a server.
pub fn Telemetry::new(capacity? : Int32, sink? : (Span) -> Unit) -> Self
A recorder of the last 128 spans, keeping nothing else.
pub fn Telemetry::spans(Self) -> Array[Span]
The spans kept so far, oldest first.
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.
pub fn cache_scope_of_wire(String) -> CacheScope?
The cache scope a wire string names, or None for one this revision does not define.
pub let client_capabilities_meta_key : String
The _meta key a request says what the client can do under.
pub let client_info_meta_key : String
The _meta key a request says who is calling under.
pub fn client_request_frame(RequestId, ClientRequest) -> @json.Json
Wrap a client request into a wire frame.
pub fn core_result_types() -> Array[String]
Result type names that may appear as the resultType of a discover reply.
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.
pub let internal_error : Int32
The JSON-RPC code for a failure the server did not plan for.
pub let invalid_params : Int32
The JSON-RPC code for arguments the method cannot use.
pub let invalid_request : Int32
The JSON-RPC code for a message that is not a request at all.
pub let latest_protocol_version : String
The protocol version this implementation speaks.
pub fn logging_level_from_wire(String) -> LoggingLevel?
The severity a notifications/message names, or None for a level the specification does not define.
pub let method_completion_complete : String
The wire name of the completion/complete request.
pub let method_elicitation_create : String
The wire name of the elicitation/create request.
pub let method_elicitation_create_form : String
The wire name of the elicitation/createForm request.
pub let method_initialize : String
Canonical JSON-RPC method and notification names.
pub let method_input_response : String
The wire name of the input/response request.
pub let method_logging_set_level : String
The wire name of the logging/setLevel request.
pub let method_not_found : Int32
The JSON-RPC code for a method this revision does not define.
pub let method_ping : String
The wire name of the ping request.
pub let method_prompts_get : String
The wire name of the prompts/get request.
pub let method_prompts_list : String
The wire name of the prompts/list request.
pub let method_resources_list : String
The wire name of the resources/list request.
pub let method_resources_read : String
The wire name of the resources/read request.
pub let method_resources_subscribe : String
The wire name of the resources/subscribe request.
pub let method_resources_unsubscribe : String
The wire name of the resources/unsubscribe request.
pub let method_roots_list : String
The wire name of the roots/list request.
pub let method_sampling_create_message : String
The wire name of the sampling/createMessage request.
pub let method_server_discover : String
The wire name of the server/discover request.
pub let method_subscriptions_listen : String
The wire name of the subscriptions/listen request.
pub let method_tools_call : String
The wire name of the tools/call request.
pub let method_tools_list : String
The wire name of the tools/list request.
pub fn modern_protocol_versions() -> Array[String]
Protocol versions with modern semantics (used for capability gating).
pub let notification_cancelled : String
The wire name of the notifications/cancelled notification.
pub let notification_initialized : String
The wire name of the notifications/initialized notification.
pub let notification_message : String
The wire name of the notifications/message notification.
pub let notification_progress : String
The wire name of the notifications/progress notification.
pub let notification_prompt_list_changed : String
The wire name of the notifications/prompts/list_changed notification.
pub let notification_resource_list_changed : String
The wire name of the notifications/resources/list_changed notification.
pub let notification_resource_updated : String
The wire name of the notifications/resources/updated notification.
pub let notification_roots_list_changed : String
The wire name of the notifications/roots/list_changed notification.
pub let notification_subscriptions_acknowledged : String
The wire name of the notifications/subscriptions/acknowledged notification.
pub let notification_tool_list_changed : String
The wire name of the notifications/tools/list_changed notification.
pub fn parse_client_request(@json.Json) -> ClientRequest raise @json.JsonDecodeError
Decode a request frame into a typed ClientRequest.
pub let parse_error : Int32
JSON-RPC error codes defined by the MCP specification.
pub fn parse_message(@json.Json) -> JSONRPCMessage raise @json.JsonDecodeError
Parse one wire frame.
pub fn parse_server_request(@json.Json) -> ServerRequest raise @json.JsonDecodeError
Decode a request frame into a typed ServerRequest.
pub let protocol_version_meta_key : String
The _meta key a stateless request names its protocol revision under.
pub fn role_from_wire(String) -> Role?
The author a message names, or None for one that is neither the client nor the server.
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.
pub fn server_request_frame(RequestId, ServerRequest) -> @json.Json
Wrap a server request into a wire frame.
pub fn server_request_verb(ServerRequest) -> String
The method name a typed server request goes out under.
pub let subscription_id_meta_key : String
The _meta key a subscription's messages carry the id of the stream that opened it under.
pub fn text_block(String) -> ContentBlock
Shorthand for a plain text block without annotations.
pub(all) struct Annotations { audience : Array[String]? priority : Double? }
Audience and priority hints attached to content.
pub fn Annotations::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Annotations::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Annotations::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Annotations::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Annotations::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Annotations
The FromJson implementation for Annotations.
pub impl @json.ToJson for Annotations
The ToJson implementation for Annotations.
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.
pub fn CacheScope::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CacheScope::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CacheScope::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn CacheScope::to_wire(Self) -> String
Encode this value to its wire string.
pub(all) struct CallToolRequestParams { name : String arguments : Map[String, @json.Json]? meta : Map[String, @json.Json]? }
tools/call request parameters.
pub fn CallToolRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CallToolRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CallToolRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CallToolRequestParams::progress_token(Self) -> String?
The progress token carried in the request meta.
pub fn CallToolRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CallToolRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CallToolRequestParams
The FromJson implementation for CallToolRequestParams.
pub impl @json.ToJson for CallToolRequestParams
The ToJson implementation for CallToolRequestParams.
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.
pub fn CallToolResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CallToolResult::error(String) -> Self
Build an error result with the given message.
pub fn CallToolResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CallToolResult::new(Array[ContentBlock]) -> Self
Construct a value with the given fields.
pub fn CallToolResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CallToolResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CallToolResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CallToolResult
The FromJson implementation for CallToolResult.
pub impl @json.ToJson for CallToolResult
The ToJson implementation for CallToolResult.
pub(all) struct CancelledNotificationParams { request_id : RequestId reason : String? }
A cancelled request, sent by the side that issued it.
pub fn CancelledNotificationParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CancelledNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CancelledNotificationParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CancelledNotificationParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CancelledNotificationParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CancelledNotificationParams
The FromJson implementation for CancelledNotificationParams.
pub impl @json.ToJson for CancelledNotificationParams
The ToJson implementation for CancelledNotificationParams.
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.
pub fn ClientCapabilities::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ClientCapabilities::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ClientCapabilities::new() -> Self
A client that asks for nothing beyond the core protocol.
pub fn ClientCapabilities::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ClientCapabilities::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ClientCapabilities::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ClientCapabilities
The FromJson implementation for ClientCapabilities.
pub impl @json.ToJson for ClientCapabilities
The ToJson implementation for ClientCapabilities.
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.
pub fn ClientRequest::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ClientRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ClientRequest::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ClientRequest::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn ClientRequest::verb(Self) -> String
The method name a typed request will be sent under.
pub impl @json.FromJson for ClientRequest
The FromJson implementation for ClientRequest.
pub(all) struct CompleteRequestParams { reference : Reference argument : CompletionArgument arguments : Map[String, String]? meta : Map[String, @json.Json]? }
completion/complete request parameters.
pub fn CompleteRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CompleteRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CompleteRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CompleteRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CompleteRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CompleteRequestParams
The FromJson implementation for CompleteRequestParams.
pub impl @json.ToJson for CompleteRequestParams
The ToJson implementation for CompleteRequestParams.
pub(all) struct CompleteResult { completion : Completion meta : Map[String, @json.Json]? }
The result of a completion/complete call.
pub fn CompleteResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CompleteResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CompleteResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CompleteResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CompleteResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CompleteResult
The FromJson implementation for CompleteResult.
pub impl @json.ToJson for CompleteResult
The ToJson implementation for CompleteResult.
pub(all) struct Completion { values : Array[String] total : Int32? has_more : Bool? }
Completion values returned by completion/complete.
pub fn Completion::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Completion::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Completion::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Completion::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Completion::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Completion
The FromJson implementation for Completion.
pub impl @json.ToJson for Completion
The ToJson implementation for Completion.
pub(all) struct CompletionArgument { name : String value : String }
One argument offered for completion: which argument it is, and the value to complete.
pub fn CompletionArgument::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CompletionArgument::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CompletionArgument::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CompletionArgument::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CompletionArgument::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CompletionArgument
The FromJson implementation for CompletionArgument.
pub impl @json.ToJson for CompletionArgument
The ToJson implementation for CompletionArgument.
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.
pub fn ContentBlock::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ContentBlock::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ContentBlock::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ContentBlock::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ContentBlock::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ContentBlock
The FromJson implementation for ContentBlock.
pub impl @json.ToJson for ContentBlock
The ToJson implementation for ContentBlock.
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.
pub fn CreateMessageRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CreateMessageRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CreateMessageRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CreateMessageRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CreateMessageRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CreateMessageRequestParams
The FromJson implementation for CreateMessageRequestParams.
pub impl @json.ToJson for CreateMessageRequestParams
The ToJson implementation for CreateMessageRequestParams.
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.
pub fn CreateMessageResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CreateMessageResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CreateMessageResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CreateMessageResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CreateMessageResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CreateMessageResult
The FromJson implementation for CreateMessageResult.
pub impl @json.ToJson for CreateMessageResult
The ToJson implementation for CreateMessageResult.
pub(all) struct CreateTaskResult { task : @json.Json meta : Map[String, @json.Json]? }
A task handle minted for task-augmented execution (SEP-2663).
pub fn CreateTaskResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CreateTaskResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn CreateTaskResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CreateTaskResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn CreateTaskResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for CreateTaskResult
The FromJson implementation for CreateTaskResult.
pub impl @json.ToJson for CreateTaskResult
The ToJson implementation for CreateTaskResult.
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.
pub fn DiscoverResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn DiscoverResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn DiscoverResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn DiscoverResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn DiscoverResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for DiscoverResult
The FromJson implementation for DiscoverResult.
pub impl @json.ToJson for DiscoverResult
The ToJson implementation for DiscoverResult.
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.
pub fn ElicitRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ElicitRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ElicitRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ElicitRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ElicitRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ElicitRequestParams
The FromJson implementation for ElicitRequestParams.
pub impl @json.ToJson for ElicitRequestParams
The ToJson implementation for ElicitRequestParams.
pub(all) struct ElicitResult { action : String content : Map[String, @json.Json]? meta : Map[String, @json.Json]? }
The result of an elicitation round trip.
pub fn ElicitResult::accept(Map[String, @json.Json]) -> Self
Accept an elicitation with the given content.
pub fn ElicitResult::cancel() -> Self
Cancel an elicitation.
pub fn ElicitResult::decline() -> Self
Decline an elicitation.
pub fn ElicitResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ElicitResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ElicitResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ElicitResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ElicitResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ElicitResult
The FromJson implementation for ElicitResult.
pub impl @json.ToJson for ElicitResult
The ToJson implementation for ElicitResult.
pub(all) struct EmptyResult { meta : Map[String, @json.Json]? }
A bare result with no payload.
pub fn EmptyResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn EmptyResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn EmptyResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn EmptyResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn EmptyResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for EmptyResult
The FromJson implementation for EmptyResult.
pub impl @json.ToJson for EmptyResult
The ToJson implementation for EmptyResult.
pub(all) struct ErrorData { code : Int32 message : String data : @json.Json? }
Wire-format error payload carried by JSON-RPC error responses.
pub fn ErrorData::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ErrorData::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ErrorData::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ErrorData::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ErrorData::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct GetPromptRequestParams { name : String arguments : Map[String, @json.Json]? meta : Map[String, @json.Json]? }
prompts/get request parameters.
pub fn GetPromptRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn GetPromptRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn GetPromptRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn GetPromptRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn GetPromptRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for GetPromptRequestParams
The FromJson implementation for GetPromptRequestParams.
pub impl @json.ToJson for GetPromptRequestParams
The ToJson implementation for GetPromptRequestParams.
pub(all) struct GetPromptResult { description : String? messages : Array[PromptMessage] meta : Map[String, @json.Json]? }
The result of a prompts/get call.
pub fn GetPromptResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn GetPromptResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn GetPromptResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn GetPromptResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn GetPromptResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for GetPromptResult
The FromJson implementation for GetPromptResult.
pub impl @json.ToJson for GetPromptResult
The ToJson implementation for GetPromptResult.
pub(all) struct Icon { src : String mime_type : String? sizes : Array[String]? }
An icon for display in user interfaces.
pub fn Icon::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Icon::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Icon::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Icon::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Icon::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Icon
The FromJson implementation for Icon.
pub impl @json.ToJson for Icon
The ToJson implementation for Icon.
pub(all) struct Implementation { name : String title : String? version : String }
The name and version of an MCP implementation.
pub fn Implementation::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Implementation::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Implementation::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Implementation::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Implementation::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Implementation
The FromJson implementation for Implementation.
pub impl @json.ToJson for Implementation
The ToJson implementation for Implementation.
pub(all) struct InitializeRequestParams { protocol_version : String capabilities : ClientCapabilities client_info : Implementation meta : Map[String, @json.Json]? }
initialize request parameters.
pub fn InitializeRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InitializeRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InitializeRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InitializeRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InitializeRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InitializeRequestParams
The FromJson implementation for InitializeRequestParams.
pub impl @json.ToJson for InitializeRequestParams
The ToJson implementation for InitializeRequestParams.
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.
pub fn InitializeResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InitializeResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InitializeResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InitializeResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InitializeResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InitializeResult
The FromJson implementation for InitializeResult.
pub impl @json.ToJson for InitializeResult
The ToJson implementation for InitializeResult.
pub(all) struct InputRequest { id : String request : @json.Json }
One guard-channel request a client must answer (SEP-2322).
pub fn InputRequest::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InputRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InputRequest::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InputRequest::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InputRequest::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InputRequest
The FromJson implementation for InputRequest.
pub impl @json.ToJson for InputRequest
The ToJson implementation for InputRequest.
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.
pub fn InputRequiredResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InputRequiredResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InputRequiredResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InputRequiredResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InputRequiredResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InputRequiredResult
The FromJson implementation for InputRequiredResult.
pub impl @json.ToJson for InputRequiredResult
The ToJson implementation for InputRequiredResult.
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).
pub fn InputResponse::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InputResponse::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InputResponse::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InputResponse::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InputResponse::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InputResponse
The FromJson implementation for InputResponse.
pub impl @json.ToJson for InputResponse
The ToJson implementation for InputResponse.
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.
pub fn InputResponseRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn InputResponseRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn InputResponseRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn InputResponseRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn InputResponseRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for InputResponseRequestParams
The FromJson implementation for InputResponseRequestParams.
pub impl @json.ToJson for InputResponseRequestParams
The ToJson implementation for InputResponseRequestParams.
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.
pub fn JSONRPCMessage::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn JSONRPCMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn JSONRPCMessage::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn JSONRPCMessage::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn JSONRPCMessage::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for JSONRPCMessage
The FromJson implementation for JSONRPCMessage.
pub impl @json.ToJson for JSONRPCMessage
The ToJson implementation for JSONRPCMessage.
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.
pub fn ListPromptsResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ListPromptsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ListPromptsResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ListPromptsResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ListPromptsResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ListPromptsResult
The FromJson implementation for ListPromptsResult.
pub impl @json.ToJson for ListPromptsResult
The ToJson implementation for ListPromptsResult.
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.
pub fn ListResourceTemplatesResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ListResourceTemplatesResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ListResourceTemplatesResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ListResourceTemplatesResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ListResourceTemplatesResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ListResourceTemplatesResult
The FromJson implementation for ListResourceTemplatesResult.
pub impl @json.ToJson for ListResourceTemplatesResult
The ToJson implementation for ListResourceTemplatesResult.
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.
pub fn ListResourcesResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ListResourcesResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ListResourcesResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ListResourcesResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ListResourcesResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ListResourcesResult
The FromJson implementation for ListResourcesResult.
pub impl @json.ToJson for ListResourcesResult
The ToJson implementation for ListResourcesResult.
pub(all) struct ListRootsResult { roots : Array[Root] meta : Map[String, @json.Json]? }
The result of a roots/list call.
pub fn ListRootsResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ListRootsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ListRootsResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ListRootsResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ListRootsResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ListRootsResult
The FromJson implementation for ListRootsResult.
pub impl @json.ToJson for ListRootsResult
The ToJson implementation for ListRootsResult.
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.
pub fn ListToolsResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ListToolsResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ListToolsResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ListToolsResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ListToolsResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ListToolsResult
The FromJson implementation for ListToolsResult.
pub impl @json.ToJson for ListToolsResult
The ToJson implementation for ListToolsResult.
pub(all) enum LoggingLevel { Debug Info Notice Warning Error Critical Alert Emergency }
Verbosity levels for notifications/message, ordered debug → emergency.
pub fn LoggingLevel::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn LoggingLevel::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn LoggingLevel::rank(Self) -> Int32
How severe a level is, for comparing two: RFC 5424's order, least severe first.
pub fn LoggingLevel::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn LoggingLevel::to_wire(Self) -> String
Encode this value to its wire string.
pub(all) struct LoggingMessageNotificationParams { level : LoggingLevel logger : String? data : @json.Json }
A log entry streamed by the server.
pub fn LoggingMessageNotificationParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn LoggingMessageNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn LoggingMessageNotificationParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn LoggingMessageNotificationParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn LoggingMessageNotificationParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for LoggingMessageNotificationParams
The FromJson implementation for LoggingMessageNotificationParams.
pub impl @json.ToJson for LoggingMessageNotificationParams
The ToJson implementation for LoggingMessageNotificationParams.
pub(all) struct ModelHint { name : String }
Client hints steering server-side model selection.
pub fn ModelHint::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ModelHint::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ModelHint::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ModelHint::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ModelHint::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ModelHint
The FromJson implementation for ModelHint.
pub impl @json.ToJson for ModelHint
The ToJson implementation for ModelHint.
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.
pub fn ModelPreferences::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ModelPreferences::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ModelPreferences::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ModelPreferences::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ModelPreferences::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ModelPreferences
The FromJson implementation for ModelPreferences.
pub impl @json.ToJson for ModelPreferences
The ToJson implementation for ModelPreferences.
pub(all) struct PaginatedRequestParams { cursor : String? meta : Map[String, @json.Json]? }
List requests with cursor-based pagination.
pub fn PaginatedRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn PaginatedRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn PaginatedRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn PaginatedRequestParams::progress_token(Self) -> String?
The progress token carried in the request meta.
pub fn PaginatedRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn PaginatedRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for PaginatedRequestParams
The FromJson implementation for PaginatedRequestParams.
pub impl @json.ToJson for PaginatedRequestParams
The ToJson implementation for PaginatedRequestParams.
pub(all) struct ProgressNotificationParams { progress_token : String progress : Double message : String? total : Double? }
Progress reported for an in-flight request.
pub fn ProgressNotificationParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ProgressNotificationParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ProgressNotificationParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ProgressNotificationParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ProgressNotificationParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ProgressNotificationParams
The FromJson implementation for ProgressNotificationParams.
pub impl @json.ToJson for ProgressNotificationParams
The ToJson implementation for ProgressNotificationParams.
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.
pub fn Prompt::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Prompt::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Prompt::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Prompt::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Prompt::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Prompt
The FromJson implementation for Prompt.
pub impl @json.ToJson for Prompt
The ToJson implementation for Prompt.
pub(all) struct PromptArgument { name : String title : String? description : String? required : Bool? }
One argument of a prompt template.
pub fn PromptArgument::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn PromptArgument::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn PromptArgument::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn PromptArgument::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn PromptArgument::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for PromptArgument
The FromJson implementation for PromptArgument.
pub impl @json.ToJson for PromptArgument
The ToJson implementation for PromptArgument.
pub(all) struct PromptMessage { role : Role content : ContentBlock }
One message in a rendered prompt.
pub fn PromptMessage::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn PromptMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn PromptMessage::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn PromptMessage::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn PromptMessage::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for PromptMessage
The FromJson implementation for PromptMessage.
pub impl @json.ToJson for PromptMessage
The ToJson implementation for PromptMessage.
pub(all) struct PromptsCapabilities { list_changed : Bool? }
Prompt listings only need list-change notifications.
pub fn PromptsCapabilities::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn PromptsCapabilities::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn PromptsCapabilities::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct ReadResourceRequestParams { uri : String meta : Map[String, @json.Json]? }
resources/read request parameters.
pub fn ReadResourceRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ReadResourceRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ReadResourceRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ReadResourceRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ReadResourceRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ReadResourceRequestParams
The FromJson implementation for ReadResourceRequestParams.
pub impl @json.ToJson for ReadResourceRequestParams
The ToJson implementation for ReadResourceRequestParams.
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.
pub fn ReadResourceResult::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ReadResourceResult::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ReadResourceResult::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ReadResourceResult::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ReadResourceResult::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ReadResourceResult
The FromJson implementation for ReadResourceResult.
pub impl @json.ToJson for ReadResourceResult
The ToJson implementation for ReadResourceResult.
pub(all) enum Reference { PromptReference(name~ : String) ResourceTemplateReference(uri~ : String) }
A prompt reference used for completion.
pub fn Reference::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Reference::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Reference::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Reference::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Reference::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Reference
The FromJson implementation for Reference.
pub impl @json.ToJson for Reference
The ToJson implementation for Reference.
pub(all) enum RequestId { Number(id~ : Int32) Text(id~ : String) }
A JSON-RPC request id: either a number or a string.
pub fn RequestId::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn RequestId::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn RequestId::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn RequestId::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn RequestId::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for RequestId
The FromJson implementation for RequestId.
pub impl @json.ToJson for RequestId
The ToJson implementation for RequestId.
pub(all) struct RequestParamsMeta { meta : Map[String, @json.Json]? }
Parameters common to every request; _meta.progressToken drives progress.
pub fn RequestParamsMeta::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn RequestParamsMeta::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn RequestParamsMeta::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn RequestParamsMeta::progress_token(Self) -> String?
The progress token carried in the request meta.
pub fn RequestParamsMeta::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn RequestParamsMeta::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for RequestParamsMeta
The FromJson implementation for RequestParamsMeta.
pub impl @json.ToJson for RequestParamsMeta
The ToJson implementation for RequestParamsMeta.
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.
pub fn Resource::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Resource::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Resource::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Resource::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Resource::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Resource
The FromJson implementation for Resource.
pub impl @json.ToJson for Resource
The ToJson implementation for Resource.
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.
pub fn ResourceContents::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourceContents::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ResourceContents::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceContents::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ResourceContents::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn ResourceContents::uri(Self) -> String
The URI this content or reference points at.
pub impl @json.FromJson for ResourceContents
The FromJson implementation for ResourceContents.
pub impl @json.ToJson for ResourceContents
The ToJson implementation for ResourceContents.
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.
pub fn ResourceTemplate::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourceTemplate::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ResourceTemplate::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourceTemplate::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ResourceTemplate::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ResourceTemplate
The FromJson implementation for ResourceTemplate.
pub impl @json.ToJson for ResourceTemplate
The ToJson implementation for ResourceTemplate.
pub(all) struct ResourcesCapabilities { subscribe : Bool? list_changed : Bool? }
Resource capability flags.
pub fn ResourcesCapabilities::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ResourcesCapabilities::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ResourcesCapabilities::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum Role { User Assistant }
One message in a sampling round trip.
pub fn Role::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Role::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Role::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn Role::to_wire(Self) -> String
Encode this value to its wire string.
pub(all) struct Root { uri : String name : String? }
A filesystem root the client exposes to the server.
pub fn Root::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Root::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Root::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Root::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Root::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Root
The FromJson implementation for Root.
pub impl @json.ToJson for Root
The ToJson implementation for Root.
pub(all) struct SamplingMessage { role : Role content : ContentBlock }
One message of a sampling conversation, as the client's model is shown it.
pub fn SamplingMessage::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn SamplingMessage::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn SamplingMessage::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn SamplingMessage::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn SamplingMessage::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for SamplingMessage
The FromJson implementation for SamplingMessage.
pub impl @json.ToJson for SamplingMessage
The ToJson implementation for SamplingMessage.
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.
pub fn ServerCapabilities::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ServerCapabilities::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ServerCapabilities::new() -> Self
Construct a value with the given fields.
pub fn ServerCapabilities::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ServerCapabilities::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ServerCapabilities::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ServerCapabilities
The FromJson implementation for ServerCapabilities.
pub impl @json.ToJson for ServerCapabilities
The ToJson implementation for ServerCapabilities.
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.
pub fn ServerNotification::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ServerNotification::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ServerNotification::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ServerNotification::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.ToJson for ServerNotification
The ToJson implementation for ServerNotification.
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.
pub fn ServerRequest::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ServerRequest::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ServerRequest::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ServerRequest::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ServerRequest
The FromJson implementation for ServerRequest.
pub(all) struct SetLevelRequestParams { level : LoggingLevel meta : Map[String, @json.Json]? }
logging/setLevel request parameters.
pub fn SetLevelRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn SetLevelRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn SetLevelRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn SetLevelRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn SetLevelRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for SetLevelRequestParams
The FromJson implementation for SetLevelRequestParams.
pub impl @json.ToJson for SetLevelRequestParams
The ToJson implementation for SetLevelRequestParams.
pub(all) struct SubscribeRequestParams { uri : String meta : Map[String, @json.Json]? }
resources/subscribe request parameters.
pub fn SubscribeRequestParams::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn SubscribeRequestParams::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn SubscribeRequestParams::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn SubscribeRequestParams::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn SubscribeRequestParams::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for SubscribeRequestParams
The FromJson implementation for SubscribeRequestParams.
pub impl @json.ToJson for SubscribeRequestParams
The ToJson implementation for SubscribeRequestParams.
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.
pub fn SubscriptionFilter::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn SubscriptionFilter::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn SubscriptionFilter::new() -> Self
A filter that asks for nothing, which is what an empty object decodes to.
pub fn SubscriptionFilter::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn SubscriptionFilter::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn SubscriptionFilter::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn SubscriptionFilter::wants(Self, String) -> Bool
Whether the client asked for the notification that a list changed.
pub impl @json.FromJson for SubscriptionFilter
The FromJson implementation for SubscriptionFilter.
pub impl @json.ToJson for SubscriptionFilter
The ToJson implementation for SubscriptionFilter.
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.
pub fn Tool::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Tool::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn Tool::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Tool::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn Tool::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for Tool
The FromJson implementation for Tool.
pub impl @json.ToJson for Tool
The ToJson implementation for Tool.
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.
pub fn ToolAnnotations::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ToolAnnotations::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ToolAnnotations::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ToolAnnotations::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ToolAnnotations::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ToolAnnotations
The FromJson implementation for ToolAnnotations.
pub impl @json.ToJson for ToolAnnotations
The ToJson implementation for ToolAnnotations.
pub(all) struct ToolCapabilities { list_changed : Bool? }
Tool listings only need list-change notifications.
pub fn ToolCapabilities::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ToolCapabilities::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ToolCapabilities::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct ToolExecution { task_support : @tasks.TaskMode }
Task execution configuration advertised on a tool (SEP-1686).
pub fn ToolExecution::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ToolExecution::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn ToolExecution::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ToolExecution::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn ToolExecution::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for ToolExecution
The FromJson implementation for ToolExecution.
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.
pub fn insufficient_scope(Array[String]) -> FastMCPError
Construct an InsufficientScope error with the standard message.
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).
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.
pub fn FastMCPError::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn FastMCPError::message(Self) -> String
Render the human-readable message carried by the error.
pub fn FastMCPError::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn FastMCPError::output(Self, &Logger) -> Unit
The message alone, as a person reads it.
pub fn FastMCPError::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn FastMCPError::to_string(Self) -> String
Render the error as a string.
pub impl Show for FastMCPError
The Show implementation for MCPError.
Component
The shared metadata every capability carries: name, title, description, tags and icons.
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).
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.
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.
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.
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.
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 @.
pub fn ComponentBase::make_key(String, String) -> String
Construct the lookup key for a component type, e.g. "tool:name".
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.
pub(all) struct FastMCPMeta { tags : Array[String] version : String? versions : Array[String] }
Namespaced metadata carried in a component's _meta.
pub fn FastMCPMeta::empty() -> Self
No tags and no versions: what a component without metadata of its own carries.
pub fn FastMCPMeta::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn FastMCPMeta::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn FastMCPMeta::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub let default_poll_interval_ms : Int32
How often a task is polled when the caller says nothing: five seconds.
pub let default_ttl_ms : Int32
How long a task's result is kept when the caller says nothing: one minute.
pub fn task_mode_from_wire(String) -> TaskMode?
The task mode a wire string names, or None for one this library does not offer.
pub let tasks_extension_id : String
Reverse-DNS identifier of the SEP-2663 tasks extension.
pub(all) struct TaskConfig { mode : TaskMode poll_interval_ms : Int32 }
Configuration for MCP background task execution.
pub fn TaskConfig::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn TaskConfig::from_bool(Bool) -> Self
Convert a boolean task flag to a TaskConfig.
pub fn TaskConfig::new(mode? : TaskMode, poll_interval_ms? : Int32) -> Self
Construct a value with the given fields.
pub fn TaskConfig::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn TaskConfig::supports_tasks(Self) -> Bool
Whether this component supports task execution.
pub fn TaskConfig::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) struct TaskMeta { ttl : Int32? fn_key : String? }
Metadata for task-augmented execution requests.
pub fn TaskMeta::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn TaskMeta::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn TaskMeta::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum TaskMode { Forbidden Optional Required }
How a component handles task-augmented execution requests.
pub fn TaskMode::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn TaskMode::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn TaskMode::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn TaskMode::to_wire(Self) -> String
Encode this value to its wire string.
Settings
Build-time settings surfaced to the running server.
pub fn log_level_from_wire(String) -> LogLevel?
The log level a settings file names, or None for an unknown one.
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.
pub fn telemetry_mode_from_wire(String) -> TelemetryMode?
The telemetry mode a settings file names, or None for an unknown one.
pub let ten_mb_in_bytes : Int32
The largest inline content this library accepts: ten mebibytes.
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.
pub(all) enum CheckForUpdates { Stable Prerelease Off }
When the tool looks for a newer version of itself.
pub fn CheckForUpdates::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn CheckForUpdates::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn CheckForUpdates::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum LogLevel { Debug Info Warning Error Critical }
How much a server says about its own work, from debug to critical.
pub fn LogLevel::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn LogLevel::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn LogLevel::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn LogLevel::to_wire(Self) -> String
Encode this value to its wire string.
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.
pub fn SessionIdleTimeout::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn SessionIdleTimeout::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn SessionIdleTimeout::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn SessionIdleTimeout::to_wire(Self) -> String
The http_session_idle_timeout wire forms: "auto", "none", or a number.
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.
pub fn Settings::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn Settings::from_env() -> Self
Load settings, applying FASTMCP_* environment overrides.
pub fn Settings::new() -> Self
Construct a value with the given fields.
pub fn Settings::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn Settings::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum TelemetryMode { Native PropagationOnly Off }
How moonmcp's native telemetry behaves.
pub fn TelemetryMode::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn TelemetryMode::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn TelemetryMode::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn TelemetryMode::to_wire(Self) -> String
Encode this value to its wire string.
pub(all) enum TransportKind { Stdio Http Sse StreamableHttp }
The transport a client configuration names for a server.
pub fn TransportKind::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn TransportKind::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn TransportKind::to_repr(Self) -> @debug.Repr
Debug representation of this value.
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.
pub fn config_from_json(@json.Json) -> MCPConfig raise @json.JsonDecodeError
Parse MCP configuration from a JSON document.
pub fn infer_transport_type_from_url(String) -> Result[String, String]
Infer "sse" or "http" from a remote server URL.
pub(all) struct MCPConfig { mcp_servers : Map[String, MCPServerEntry] }
A configuration object for MCP servers.
pub fn MCPConfig::add_server(Self, String, MCPServerEntry) -> Unit
Add or update a server in the configuration.
pub fn MCPConfig::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn MCPConfig::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn MCPConfig::new() -> Self
Construct a value with the given fields.
pub fn MCPConfig::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn MCPConfig::to_json(Self) -> @json.Json
Convert the configuration to a JSON document, omitting empty fields.
pub fn MCPConfig::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for MCPConfig
The FromJson implementation for MCPConfig.
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.
pub fn MCPServerEntry::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn MCPServerEntry::from_json(@json.Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
Decode this shape from JSON.
pub fn MCPServerEntry::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn MCPServerEntry::to_json(Self) -> @json.Json
Encode this shape to JSON.
pub fn MCPServerEntry::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub impl @json.FromJson for MCPServerEntry
The FromJson implementation for MCPServerEntry.
pub impl @json.ToJson for MCPServerEntry
The ToJson implementation for MCPServerEntry.
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.
pub fn MCPServerKind::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn MCPServerKind::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn MCPServerKind::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub(all) enum RemoteTransport { Http StreamableHttp Sse }
The HTTP transports a client configuration may name.
pub fn RemoteTransport::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn RemoteTransport::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn RemoteTransport::to_repr(Self) -> @debug.Repr
Debug representation of this value.
pub fn RemoteTransport::to_wire(Self) -> String
Encode this value to its wire string.
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.
pub fn ServerTransform::equal(Self, Self) -> Bool
Equality with another value of the same type.
pub fn ServerTransform::not_equal(Self, Self) -> Bool
Inequality with another value of the same type.
pub fn ServerTransform::to_repr(Self) -> @debug.Repr
Debug representation of this value.
Utilities
Small helpers, chiefly media-type handling for binary content.
pub fn encode_base64(Bytes) -> String
Base64-encode raw bytes for wire transport.
pub(all) struct Audio { path : String? data : Bytes? format : String? mime_type : String annotations : @types.Annotations? }
A helper for returning audio from tools.
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.
pub fn Audio::to_audio_content(Self, mime_type? : String, annotations? : @types.Annotations) -> @types.ContentBlock raise @exceptions.FastMCPError
Convert to an audio content block.
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.
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.
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.
pub(all) struct Image { path : String? data : Bytes? format : String? mime_type : String annotations : @types.Annotations? }
A helper for returning images from tools.
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.
pub fn Image::to_data_uri(Self, mime_type? : String) -> String raise @exceptions.FastMCPError
Render as a data: URI.
pub fn Image::to_image_content(Self, mime_type? : String, annotations? : @types.Annotations) -> @types.ContentBlock raise @exceptions.FastMCPError
Convert to an image content block.