mcp.protocol.types

Undocumented in source.

Members

Enums

ContentKind
enum ContentKind

The kind of a content block.

ElicitAction
enum ElicitAction

The user's decision on an elicitation request.

LogLevel
enum LogLevel

The severity of a notifications/message, per server/utilities/logging. The eight levels follow the syslog severities (RFC 5424); ordered most verbose (debug) to most severe (emergency).

Functions

asNumber
double asNumber(Json j)

Read a JSON number as a double, widening an integer-encoded value. vibe.d serializes a whole-valued double (e.g. 5.0) as a JSON integer, so a value the producer intended as a number can arrive as Json.Type.int_; clients that expect a double would otherwise have to re-derive this widening themselves. Returns j.get!double for a float, cast(double) j.get!long for an integer, and throws for any non-numeric Json.

emptyObjectSchema
Json emptyObjectSchema()

An empty JSON Schema object: {"type":"object"}.

Mixin templates

ContentMetaFields
mixintemplate ContentMetaFields()

Shared optional fields carried by every content kind in the MCP schema: an _meta object and annotations (audience/priority/lastModified). Mixed into each per-kind content struct so the fields live exactly once, with no per-kind duplication or "meaningless on this kind" footgun.

MetaField
mixintemplate MetaField()

The lone _meta object carried by non-content structs (results, descriptors). Mixed in so the _meta field and its emit/parse guards live once. Names are distinct from ContentMetaFields' emitMeta/parseMeta to avoid clashes in structs that could mix both.

Structs

Annotations
struct Annotations

Optional annotations attached to resources, resource templates, and content blocks, per the MCP spec's Annotations shape. All fields are optional and advisory; a field left unset is omitted from the serialized form.

AudioContent
struct AudioContent

audio content block (AudioContent): base64 data + mimeType.

CallToolResult
struct CallToolResult

Result of tools/call.

CompleteRequest
struct CompleteRequest

A parsed completion/complete request, as received by a server. Per server/utilities/completion §"Data Types > CompleteRequest" a client sends a ref (a ref/prompt or ref/resource reference), an argument ({name, value}) naming the argument being completed and its partial value, and an optional context.arguments map of previously-resolved argument values. Use fromJson to parse the raw params handed to a completion handler.

CompleteResult
struct CompleteResult

Result of completion/complete.

CompletionReference
struct CompletionReference

A completion/complete reference: the thing being completed. Per server/utilities/completion §"Requesting Completions", a client specifies either a prompt (ref/prompt, identified by name) or a resource template (ref/resource, identified by uri). Use forPrompt / forResource to construct one.

Content
struct Content

A content block as used in tool results, prompt messages, and sampling.

ElicitParams
struct ElicitParams

Params of the elicitation/create request (client/elicitation).

ElicitResult
struct ElicitResult

Result of the elicitation/create request (client/elicitation).

EmbeddedResource
struct EmbeddedResource

resource content block (EmbeddedResource): wraps a resource contents object under resource.

GetPromptResult
struct GetPromptResult

Result of prompts/get.

Icon (from mcp.protocol.capabilities)
struct Icon via public import mcp.protocol.capabilities : Icon;

An icon for display in user interfaces. Used by Implementation, Tool (and other definitions) per the MCP spec's icon shape: a required src and optional mimeType, sizes, and theme ("light"|"dark").

ImageContent
struct ImageContent

image content block (ImageContent): base64 data + mimeType.

InitializeParams
struct InitializeParams

Parameters of the initialize request.

InitializeResult
struct InitializeResult

Result of the initialize request.

ListPromptsResult
struct ListPromptsResult

Result of prompts/list.

ListResourceTemplatesResult
struct ListResourceTemplatesResult

Result of resources/templates/list.

ListResourcesResult
struct ListResourcesResult

Result of resources/list.

ListRootsResult
struct ListRootsResult

Result of the roots/list request (client/roots).

ListToolsResult
struct ListToolsResult

Result of tools/list (paginated).

LogMessageNotification
struct LogMessageNotification

A typed notifications/message payload, per server/utilities/logging: the notification carries params: {level, logger?, data}. level is one of the eight LogLevel severities, logger an optional name of the emitting component, and data an arbitrary JSON value (commonly a string or object). Parsed from an inbound notification's params so clients receive a structured value rather than hand-parsing raw JSON.

ProgressNotification
struct ProgressNotification

A typed notifications/progress payload, per basic/utilities/progress: the notification carries params: {progressToken, progress, total?, message?}. progressToken correlates the update to the request that supplied it (a string or integer; see ProgressToken), progress is the current amount (which "MUST increase with each notification"), total the optional final amount, and message an optional human-readable description. Parsed from an inbound notification's params so clients receive a structured value rather than hand-parsing raw JSON.

Prompt
struct Prompt

A prompt the server exposes.

PromptArgument
struct PromptArgument

A declared prompt argument.

PromptMessage
struct PromptMessage

A single message in a prompt result.

ReadResourceResult
struct ReadResourceResult

Result of resources/read.

Resource
struct Resource

A direct resource the server exposes.

ResourceContents
struct ResourceContents

The contents of a resource read: either UTF-8 text or base64 blob.

ResourceLink
struct ResourceLink

resource_link content block (ResourceLink, extends Resource).

ResourceTemplate
struct ResourceTemplate

A parameterized resource template (RFC 6570-style {var} placeholders).

ResourceUpdatedNotification
struct ResourceUpdatedNotification

A typed notifications/resources/updated payload, per server/resources/subscribe: when a client has subscribed to a resource, the server sends this notification with params: {uri, _meta?} so the client knows the resource at uri has changed and can re-read it. Parsed from an inbound notification's params so clients receive a structured value rather than hand-parsing raw JSON, mirroring ProgressNotification.fromJson.

Root
struct Root

A filesystem root exposed by the client (client/roots §Data Types).

TextContent
struct TextContent

text content block (TextContent).

Tool
struct Tool

A tool the server exposes for the model to call.

ToolAnnotations
struct ToolAnnotations

Optional properties describing a tool's behavior, per the MCP spec's ToolAnnotations. All hints are advisory and optional; a hint that is left null is omitted from the serialized form (and clients SHOULD treat its absence as "unspecified" rather than a particular default).

ToolExecution
struct ToolExecution

Per-tool task-augmented execution descriptor (Tool.execution), introduced in MCP 2025-11-25. Lets a tool declare whether it supports the tasks augmentation when invoked via tools/call.

ToolResultContent
struct ToolResultContent

tool_result content block (ToolResultContent, sampling only): the result of a tool call, answering the tool_use whose id is toolUseId.

ToolUseContent
struct ToolUseContent

tool_use content block (ToolUseContent, sampling only): the model's request to call a tool.

UnknownContent
struct UnknownContent

A content block whose type is not one this SDK models — a future or vendor-specific kind. The entire inbound block (including its original type) is stored verbatim so it round-trips losslessly through toJson/fromJson instead of being silently coerced into empty text.