mcp_types library

The MCP protocol types mcp_llm uses (generated from the specification schemas; the same shapes mcp_client and mcp_server carry). Import this next to package:mcp_llm/mcp_llm.dart to name the typed results of McpClientBridge and friends; it is kept separate so that importing mcp_llm beside mcp_client does not clash on names like Tool.

Classes

Annotated
Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed
AnnotatedAnnotations
Annotated.annotations.
Annotations
Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
AudioContent
Audio provided to or from an LLM.
BaseMetadata
Base interface for metadata with name (identifier) and title (display name) properties.
BlobResourceContents
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
BooleanSchema
Revisions: 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
CacheableResult
A result that supports a time-to-live (TTL) hint for client-side caching.
CacheableResultCacheScope
Values of CacheableResult.cacheScope.
CallToolRequest
Used by the client to invoke a tool provided by the server.
CallToolRequestParams
Parameters for a tools/call request.
CallToolResult
The result returned by the server for a CallToolRequesttools/call request.
CallToolResultResponse
A successful response from the server for a CallToolRequesttools/call request.
CancelledNotification
This notification is sent by the client to indicate that it is cancelling a request it previously issued.
CancelledNotificationParams
Parameters for a notifications/cancelled notification.
CancelledTask
Revisions: ext-tasks/2026-07-28.
CancelTaskRequest
Revisions: 2025-11-25, ext-tasks/2026-07-28.
CancelTaskRequestParams
CancelTaskRequest.params.
CancelTaskResult
Revisions: 2025-11-25, ext-tasks/2026-07-28.
ClientCapabilities
Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
ClientCapabilitiesElicitation
ClientCapabilities.elicitation.
ClientCapabilitiesRoots
ClientCapabilities.roots.
ClientCapabilitiesSampling
ClientCapabilities.sampling.
ClientCapabilitiesTasks
ClientCapabilities.tasks.
ClientCapabilitiesTasksRequests
ClientCapabilitiesTasks.requests.
ClientCapabilitiesTasksRequestsElicitation
ClientCapabilitiesTasksRequests.elicitation.
ClientCapabilitiesTasksRequestsSampling
ClientCapabilitiesTasksRequests.sampling.
ClientNotification
This notification is sent by the client to indicate that it is cancelling a request it previously issued.
ClientRequest
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
CompletedTask
Revisions: ext-tasks/2026-07-28.
CompleteRequest
A request from the client to the server, to ask for completion options.
CompleteRequestParams
Parameters for a completion/complete request.
CompleteRequestParamsArgument
CompleteRequestParams.argument.
CompleteRequestParamsRef
One of: PromptReference, ResourceTemplateReference.
CompleteResult
The result returned by the server for a CompleteRequestcompletion/complete request.
CompleteResultCompletion
CompleteResult.completion.
CompleteResultResponse
A successful response from the server for a CompleteRequestcompletion/complete request.
ContentBlock
Revisions: 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
CreateMessageRequest
A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
CreateMessageRequestParams
Parameters for a sampling/createMessage request.
CreateMessageRequestParamsIncludeContext
Values of CreateMessageRequestParams.includeContext.
CreateMessageRequestParamsMeta
CreateMessageRequestParams._meta.
CreateMessageResult
The result returned by the client for a CreateMessageRequestsampling/createMessage request. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
CreateTaskResult
Revisions: 2025-11-25, ext-tasks/2026-07-28.
DetailedTask
Revisions: ext-tasks/2026-07-28.
DiscoverRequest
A request from the client asking the server to advertise its supported protocol versions, capabilities, and other metadata. Servers MUST implement server/discover. Clients MAY call it but are not required to — version negotiation can also happen inline via per-request _meta.
DiscoverResult
The result returned by the server for a DiscoverRequestserver/discover request.
DiscoverResultCacheScope
Values of DiscoverResult.cacheScope.
DiscoverResultResponse
A successful response from the server for a DiscoverRequestserver/discover request.
ElicitationCompleteNotification
An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
ElicitationCompleteNotificationParams
ElicitationCompleteNotification.params.
ElicitRequest
A request from the server to elicit additional information from the user via the client.
ElicitRequestFormParams
The parameters for a request to elicit non-sensitive information from the user via a form in the client.
ElicitRequestFormParamsMeta
ElicitRequestFormParams._meta.
ElicitRequestParams
The parameters for a request to elicit additional information from the user via the client.
ElicitRequestURLParams
The parameters for a request to elicit information from the user via a URL in the client.
ElicitRequestURLParamsMeta
ElicitRequestURLParams._meta.
ElicitResult
The result returned by the client for an ElicitRequestelicitation/create request.
ElicitResultAction
Values of ElicitResult.action.
EmbeddedResource
The contents of a resource, embedded into a prompt or tool call result.
EnumSchema
Revisions: 2025-06-18, 2025-11-25, 2026-07-28.
ErrorObject
Revisions: 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
FailedTask
Revisions: ext-tasks/2026-07-28.
GetPromptRequest
Used by the client to get a prompt provided by the server.
GetPromptRequestParams
Parameters for a prompts/get request.
GetPromptResult
The result returned by the server for a GetPromptRequestprompts/get request.
GetPromptResultResponse
A successful response from the server for a GetPromptRequestprompts/get request.
GetTaskPayloadRequest
A request to retrieve the result of a completed task.
GetTaskPayloadRequestParams
GetTaskPayloadRequest.params.
GetTaskPayloadResult
The response to a tasks/result request. The structure matches the result type of the original request. For example, a tools/call task would return the CallToolResult structure.
GetTaskRequest
Revisions: 2025-11-25, ext-tasks/2026-07-28.
GetTaskRequestParams
GetTaskRequest.params.
GetTaskResult
Revisions: 2025-11-25, ext-tasks/2026-07-28.
HeaderMismatchError
Returned when a server rejects a request because the values in the HTTP headers do not match the corresponding values in the request body, or because required headers are missing or malformed. For HTTP, the response status code MUST be 400 Bad Request.
HeaderMismatchErrorError
HeaderMismatchError.error.
ImageContent
An image provided to or from an LLM.
Implementation
Describes the MCP implementation.
InitializedNotification
This notification is sent from the client to the server after initialization has finished.
InitializeRequest
This request is sent from the client to the server when it first connects, asking it to begin initialization.
InitializeRequestParams
Parameters for an initialize request.
InitializeRequestParamsMeta
InitializeRequestParams._meta.
InitializeResult
After receiving an initialize request from the client, the server sends this response.
InputRequest
Revisions: 2026-07-28, ext-tasks/2026-07-28.
InputRequiredResult
An InputRequiredResult sent by the server to indicate that additional input is needed before the request can be completed.
InputRequiredTask
Revisions: ext-tasks/2026-07-28.
InputResponseRequestParams
Revisions: 2026-07-28.
InternalError
A JSON-RPC error indicating that an internal error occurred on the receiver. This error is returned when the receiver encounters an unexpected condition that prevents it from fulfilling the request.
InvalidParamsError
A JSON-RPC error indicating that the method parameters are invalid or malformed.
InvalidRequestError
A JSON-RPC error indicating that the request is not a valid request object. This error is returned when the message structure does not conform to the JSON-RPC 2.0 specification requirements for a request (e.g., missing required fields like jsonrpc or method, or using invalid types for these fields).
JSONRPCErrorResponse
A response to a request that indicates an error occurred.
JSONRPCNotification
A notification which does not expect a response.
JSONRPCRequest
A request that expects a response.
JSONRPCResponse
A response to a request, containing either the result or error.
JSONRPCResultResponse
A successful (non-error) response to a request.
JsonSchemaError
One failed assertion.
JsonSchemaLimits
Bounds on one evaluation.
JsonSchemaResult
The outcome of JsonSchemaValidator.validate.
JsonSchemaValidator
Validates instances against one schema.
LegacyTitledEnumSchema
Use TitledSingleSelectEnumSchema instead. This interface will be removed in a future version.
ListPromptsRequest
Sent from the client to request a list of prompts and prompt templates the server has.
ListPromptsResult
The result returned by the server for a ListPromptsRequestprompts/list request.
ListPromptsResultCacheScope
Values of ListPromptsResult.cacheScope.
ListPromptsResultResponse
A successful response from the server for a ListPromptsRequestprompts/list request.
ListResourcesRequest
Sent from the client to request a list of resources the server has.
ListResourcesResult
The result returned by the server for a ListResourcesRequestresources/list request.
ListResourcesResultCacheScope
Values of ListResourcesResult.cacheScope.
ListResourcesResultResponse
A successful response from the server for a ListResourcesRequestresources/list request.
ListResourceTemplatesRequest
Sent from the client to request a list of resource templates the server has.
ListResourceTemplatesResult
The result returned by the server for a ListResourceTemplatesRequestresources/templates/list request.
ListResourceTemplatesResultCacheScope
Values of ListResourceTemplatesResult.cacheScope.
ListResourceTemplatesResultResponse
A successful response from the server for a ListResourceTemplatesRequestresources/templates/list request.
ListRootsRequest
Sent from the server to request a list of root URIs from the client. Roots allow servers to ask for specific directories or files to operate on. A common example for roots is providing a set of repositories or directories a server should operate on.
ListRootsRequestParams
ListRootsRequest.params.
ListRootsResult
The result returned by the client for a ListRootsRequestroots/list request. This result contains an array of Root objects, each representing a root directory or file that the server can operate on.
ListTasksRequest
A request to retrieve a list of tasks.
ListTasksResult
The response to a tasks/list request.
ListToolsRequest
Sent from the client to request a list of tools the server has.
ListToolsResult
The result returned by the server for a ListToolsRequesttools/list request.
ListToolsResultCacheScope
Values of ListToolsResult.cacheScope.
ListToolsResultResponse
A successful response from the server for a ListToolsRequesttools/list request.
LoggingLevel
The severity of a log message.
LoggingMessageNotification
JSONRPCNotification of a log message passed from server to client. The client opts in by setting "io.modelcontextprotocol/logLevel" in a request's _meta.
LoggingMessageNotificationParams
Parameters for a notifications/message notification.
McpEnum
Base of every generated string-valued enumeration. Values outside the schema's set are kept, so a newer peer's value is passed through rather than rejected.
McpIcon
An optionally-sized icon that can be displayed in a user interface.
McpIcons
Base interface to add icons property.
McpIconTheme
Values of McpIcon.theme.
McpJson
A value that serialises to JSON.
McpMethodSpec
One MCP method as the schema defines it.
McpNotification
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
McpObject
Base of every generated object type.
McpResult
Common result fields.
McpTaskRecord
One task.
McpTaskStatus
Task statuses (identical in both specifications).
McpTaskStore
The receiver's tasks.
MethodNotFoundError
A JSON-RPC error indicating that the requested method does not exist or is not available.
MissingRequiredClientCapabilityError
Returned when processing a request requires a capability the client did not declare in clientCapabilities. For HTTP, the response status code MUST be 400 Bad Request.
MissingRequiredClientCapabilityErrorError
MissingRequiredClientCapabilityError.error.
MissingRequiredClientCapabilityErrorErrorData
MissingRequiredClientCapabilityErrorError.data.
ModelHint
Hints to use for model selection.
ModelPreferences
The server's preferences for model selection, requested of the client during sampling.
MultiSelectEnumSchema
Revisions: 2025-11-25, 2026-07-28.
NotificationMetaObject
Extends MetaObject with additional notification-specific fields. All key naming rules from MetaObject apply.
NotificationParams
Common params for any notification.
NumberSchema
Revisions: 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
NumberSchemaType
Values of NumberSchema.type.
PaginatedRequest
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
PaginatedRequestParams
Common params for paginated requests.
PaginatedResult
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
ParseError
A JSON-RPC error indicating that invalid JSON was received by the server. This error is returned when the server cannot parse the JSON text of a message.
PingRequest
A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
PrimitiveSchemaDefinition
Restricted schema definitions that only allow primitive types without nested objects or arrays.
ProgressNotification
An out-of-band notification used to inform the receiver of a progress update for a long-running request.
ProgressNotificationParams
Parameters for a ProgressNotificationnotifications/progress notification.
Prompt
A prompt or prompt template that the server offers.
PromptArgument
Describes an argument that a prompt can accept.
PromptListChangedNotification
An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This is only delivered on a SubscriptionsListenRequestsubscriptions/listen stream when the client requested it via the promptsListChanged filter field.
PromptMessage
Describes a message returned as part of a prompt.
PromptReference
Identifies a prompt.
ReadResourceRequest
Sent from the client to the server, to read a specific resource URI.
ReadResourceRequestParams
Parameters for a resources/read request.
ReadResourceResult
The result returned by the server for a ReadResourceRequestresources/read request.
ReadResourceResultCacheScope
Values of ReadResourceResult.cacheScope.
ReadResourceResultResponse
A successful response from the server for a ReadResourceRequestresources/read request.
RelatedTaskMetadata
Metadata for associating messages with a task. Include this in the _meta field under the key io.modelcontextprotocol/related-task.
Request
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
RequestMetaObject
Extends MetaObject with additional request-specific fields. All key naming rules from MetaObject apply.
RequestParams
Common params for any request.
Resource
A known resource that the server is capable of reading.
ResourceContents
One of: TextResourceContents, BlobResourceContents.
A resource that the server is capable of reading, included in a prompt or tool call result.
ResourceListChangedNotification
An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This is only delivered on a SubscriptionsListenRequestsubscriptions/listen stream when the client requested it via the resourcesListChanged filter field.
ResourceReference
A reference to a resource or resource template definition.
ResourceRequestParams
Common params for resource-related requests.
ResourceTemplate
A template description for resources available on the server.
ResourceTemplateReference
A reference to a resource or resource template definition.
ResourceUpdatedNotification
A notification from the server to the client, informing it that a resource has changed and may need to be read again. This is only sent for resources the client opted in to via the resourceSubscriptions field of a SubscriptionsListenRequestsubscriptions/listen request.
ResourceUpdatedNotificationParams
Parameters for a notifications/resources/updated notification.
ResultMetaObject
Extends MetaObject with additional result-specific fields. All key naming rules from MetaObject apply.
Role
The sender or recipient of messages and data in a conversation.
Root
Represents a root directory or file that the server can operate on.
RootsListChangedNotification
A notification from the client to the server, informing it that the list of roots has changed. This notification should be sent whenever the client adds, removes, or modifies any root. The server should then request an updated list of roots using the ListRootsRequest.
SamplingMessage
Describes a message issued to or received from an LLM API.
SamplingMessageContentBlock
Revisions: 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
ServerCapabilities
Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
ServerCapabilitiesPrompts
ServerCapabilities.prompts.
ServerCapabilitiesResources
ServerCapabilities.resources.
ServerCapabilitiesTasks
ServerCapabilities.tasks.
ServerCapabilitiesTasksRequests
ServerCapabilitiesTasks.requests.
ServerCapabilitiesTasksRequestsTools
ServerCapabilitiesTasksRequests.tools.
ServerCapabilitiesTools
ServerCapabilities.tools.
ServerNotification
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
ServerRequest
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25.
SetLevelRequest
A request from the client to the server, to enable or adjust logging.
SetLevelRequestParams
Parameters for a logging/setLevel request.
SetLevelRequestParamsMeta
SetLevelRequestParams._meta.
SingleSelectEnumSchema
Revisions: 2025-11-25, 2026-07-28.
StringSchema
Revisions: 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
StringSchemaFormat
Values of StringSchema.format.
SubscribeRequest
Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
SubscribeRequestParams
Parameters for a resources/subscribe request.
SubscribeRequestParamsMeta
SubscribeRequestParams._meta.
SubscriptionFilter
The set of notification types a client may opt in to on a SubscriptionsListenRequestsubscriptions/listen request.
SubscriptionsAcknowledgedNotification
Sent by the server to acknowledge that a SubscriptionsListenRequestsubscriptions/listen subscription has been established and to report which notification types it agreed to honor.
SubscriptionsAcknowledgedNotificationParams
Parameters for a SubscriptionsAcknowledgedNotificationnotifications/subscriptions/acknowledged notification.
SubscriptionsListenRequest
Sent from the client to open a long-lived channel for receiving notifications outside the context of a specific request. Replaces the previous HTTP GET endpoint and ensures consistent behavior between HTTP and STDIO.
SubscriptionsListenRequestParams
Parameters for a SubscriptionsListenRequestsubscriptions/listen request.
SubscriptionsListenResult
The response to a SubscriptionsListenRequestsubscriptions/listen request, signalling that the subscription has ended gracefully (for example, during server shutdown). Because the listen stream is long-lived, this result is sent only when the server tears the subscription down; an abrupt transport close carries no response. The result body is otherwise empty.
SubscriptionsListenResultMetaObject
Extends ResultMetaObject with the subscription-stream identifier carried by a SubscriptionsListenResult. All key naming rules from MetaObject apply.
SubscriptionsListenResultResponse
A successful response from the server for a SubscriptionsListenRequestsubscriptions/listen request, sent when the server tears the subscription down gracefully.
Task
Revisions: 2025-11-25, ext-tasks/2026-07-28.
TaskAugmentedRequestParams
Common params for any task-augmented request.
TaskAugmentedRequestParamsMeta
TaskAugmentedRequestParams._meta.
TaskMetadata
Metadata for augmenting a request with task execution. Include this in the task field of the request parameters.
TaskStatus
Revisions: 2025-11-25, ext-tasks/2026-07-28.
TaskStatusNotification
Revisions: 2025-11-25, ext-tasks/2026-07-28.
TaskStatusNotificationParams
Revisions: 2025-11-25, ext-tasks/2026-07-28.
TaskSubscriptionAcknowledgedNotifications
Revisions: ext-tasks/2026-07-28.
TaskSubscriptionNotifications
Revisions: ext-tasks/2026-07-28.
TextContent
Text provided to or from an LLM.
TextResourceContents
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.
TitledMultiSelectEnumSchema
Schema for multiple-selection enumeration with display titles for each option.
TitledMultiSelectEnumSchemaItems
TitledMultiSelectEnumSchema.items.
TitledMultiSelectEnumSchemaItemsAnyOfItem
TitledMultiSelectEnumSchemaItems.anyOfItem.
TitledSingleSelectEnumSchema
Schema for single-selection enumeration with display titles for each option.
TitledSingleSelectEnumSchemaOneOfItem
TitledSingleSelectEnumSchema.oneOfItem.
Tool
Definition for a tool the client can call.
ToolAnnotations
Additional properties describing a Tool to clients.
ToolChoice
Controls tool selection behavior for sampling requests.
ToolChoiceMode
Values of ToolChoice.mode.
ToolExecution
Execution-related properties for a tool.
ToolExecutionTaskSupport
Values of ToolExecution.taskSupport.
ToolListChangedNotification
An optional notification from the server to the client, informing it that the list of tools it offers has changed. This is only delivered on a SubscriptionsListenRequestsubscriptions/listen stream when the client requested it via the toolsListChanged filter field.
ToolResultContent
The result of a tool use, provided by the user back to the assistant.
ToolUseContent
A request from the assistant to call a tool.
UnknownClientNotification
A ClientNotification whose kind this revision set does not define, kept intact.
UnknownClientRequest
A ClientRequest whose kind this revision set does not define, kept intact.
UnknownCompleteRequestParamsRef
A CompleteRequestParamsRef whose kind this revision set does not define, kept intact.
UnknownContentBlock
A ContentBlock whose kind this revision set does not define, kept intact.
UnknownElicitRequestParams
A ElicitRequestParams whose kind this revision set does not define, kept intact.
UnknownEnumSchema
A EnumSchema whose kind this revision set does not define, kept intact.
UnknownInputRequest
A InputRequest whose kind this revision set does not define, kept intact.
UnknownJSONRPCResponse
A JSONRPCResponse whose kind this revision set does not define, kept intact.
UnknownMultiSelectEnumSchema
A MultiSelectEnumSchema whose kind this revision set does not define, kept intact.
UnknownPrimitiveSchemaDefinition
A PrimitiveSchemaDefinition whose kind this revision set does not define, kept intact.
UnknownResourceContents
A ResourceContents whose kind this revision set does not define, kept intact.
UnknownSamplingMessageContentBlock
A SamplingMessageContentBlock whose kind this revision set does not define, kept intact.
UnknownServerNotification
A ServerNotification whose kind this revision set does not define, kept intact.
UnknownServerRequest
A ServerRequest whose kind this revision set does not define, kept intact.
UnknownSingleSelectEnumSchema
A SingleSelectEnumSchema whose kind this revision set does not define, kept intact.
UnsubscribeRequest
Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
UnsubscribeRequestParams
Parameters for a resources/unsubscribe request.
UnsubscribeRequestParamsMeta
UnsubscribeRequestParams._meta.
UnsupportedProtocolVersionError
Returned when the request's protocol version is unknown to the server or unsupported (e.g., a known experimental or draft version the server has chosen not to implement). For HTTP, the response status code MUST be 400 Bad Request.
UnsupportedProtocolVersionErrorError
UnsupportedProtocolVersionError.error.
UnsupportedProtocolVersionErrorErrorData
UnsupportedProtocolVersionErrorError.data.
UntitledMultiSelectEnumSchema
Schema for multiple-selection enumeration without display titles for options.
UntitledMultiSelectEnumSchemaItems
UntitledMultiSelectEnumSchema.items.
UntitledSingleSelectEnumSchema
Schema for single-selection enumeration without display titles for options.
UpdateTaskRequest
Revisions: ext-tasks/2026-07-28.
UpdateTaskRequestParams
UpdateTaskRequest.params.
UpdateTaskResult
Revisions: ext-tasks/2026-07-28.
URLElicitationRequiredError
An error response that indicates that the server requires the client to provide additional information via an elicitation request.
URLElicitationRequiredErrorError
URLElicitationRequiredError.error.
URLElicitationRequiredErrorErrorData
URLElicitationRequiredErrorError.data.
WorkingTask
Revisions: ext-tasks/2026-07-28.

Enums

JsonSchemaDialect
JSON Schema dialects this validator implements.
McpDirection
Direction of an MCP message.
McpTaskFlavor
Which task specification a task follows; it decides the wire shape.

Constants

absent → const Object
Marker for "leave this key out" in constructors of properties whose schema allows an explicit null (where null and absent mean different things).
mcpMethods → const List<McpMethodSpec>
Every method in every supported source.
mcpSchemaUnionBranches → const Map<String, List<String>>
Branches of every discriminated union, by schema name (for tests and tools).

Properties

mcpSchemaReaders → Map<String, McpJson Function(Map<String, Object?>)>
Reader for every object and union definition, by schema name.
final

Functions

$any(Object? v, String path) → Object?
Reads any JSON value as is (copied).
$bool(Object? v, String path) → bool
Reads a boolean.
$encode(Object? v) → Object?
Encodes a typed value back to JSON.
$enum<T>(T of(String)) → T Function(Object?, String)
Reads an enumeration value with of.
$int(Object? v, String path) → int
Reads an integer (an integral num is accepted).
$list<T>(T item(Object? value, String path)) → List<T> Function(Object?, String)
Reads a list, converting each element with item.
$map<T>(T item(Object? value, String path)) → Map<String, T> Function(Object?, String)
Reads a map, converting each value with item.
$model<T>(T fromJson(Map<String, Object?>)) → T Function(Object?, String)
Reads a JSON object with fromJson.
$num(Object? v, String path) → num
Reads a number.
$object(Object? v, String path) → Map<String, Object?>
Reads a JSON object as a map (copied).
$oneOrList<T>(T item(Object? value, String path)) → List<T> Function(Object?, String)
Reads one value or a list of them as a list.
$string(Object? v, String path) → String
Reads a string.
decodeMcpHeaderValue(String header) → String?
The value a header carries (sentinel decoded), or null when the header value has characters a header may not hold or a malformed sentinel.
elicitationRequestProblem(Map params) → String?
Why the params of an elicitation/create request are not what their mode requires, or null (client/elicitation, 2025-11-25+): every request has a message; form mode (or no mode) has a requestedSchema that is a flat object of primitive properties; URL mode has a valid url and an elicitationId.
encodeMcpHeaderValue(String value) → String
A header value as Streamable HTTP carries it: as-is when it is plain visible ASCII without surrounding whitespace, otherwise (or when it looks like the sentinel) =?base64?…?= of its UTF-8 bytes.
isAbsoluteUri(String value) → bool
Whether value is an absolute URI under RFC 3986's generic syntax (scheme ":" hier-part …) — the check the uri format uses. Unlike Uri.tryParse, it does not treat data: (or any scheme) specially, so data://config and other custom-scheme resource URIs are accepted.
mcpMethodDefined(String method, McpDirection direction, String revision, {Set<String> extensions = const {}}) → bool?
Whether method is a protocol method of revision in direction — defined by the core revision, or by an extension in extensions (ids such as io.modelcontextprotocol/tasks). Null when the method is not a protocol method of any supported revision (an application method).
mcpParamHeaders(Object? inputSchema) → ({List<McpParamHeader> headers, String? problem})
The x-mcp-header annotations of inputSchema (2026-07-28 Streamable HTTP, custom headers from tool parameters), or the reason the tool definition is invalid: an empty or non-token name, a name repeated (case-insensitively), a parameter that is not integer / string / boolean, or one not reachable through properties alone.
mcpParamHeaderValues(List<McpParamHeader> headers, Map arguments) → Map<String, String>
The Mcp-Param-{name} values for a call with arguments (absent and null values omitted), encoded for the header; throws ArgumentError for a value of the wrong type or an integer outside the safe range.
samplingMessagesProblem(Object? messages) → String?
Why the messages of a sampling/createMessage request break the sampling rules, or null (specification, client/sampling: message content constraints, 2025-11-25+):
uriTemplateMatches(String template, String uri) → bool
Whether uri is an expansion of the RFC 6570 URI template template (resource templates: uriTemplate). Every operator is understood: simple {x} (unreserved characters only, so a / is not part of the value), reserved {+x}, fragment {#x}, label {.x}, path {/x}, path parameters {;x}, query {?x} and continuation {&x}; prefix (:n) and explode (*) modifiers are accepted. An undefined variable may expand to nothing.
uriTemplateValid(String template) → bool
Whether template is a well-formed RFC 6570 URI template.
uriTemplateVariables(String template, String uri) → Map<String, String>?
The values of the simple and reserved variables of template in uri, or null when it does not match.

Typedefs

ClientResult = McpResult
Common result fields.
Cursor = String
An opaque token used to represent a cursor for pagination.
EmptyResult = McpResult
Common result fields.
InputRequests = Map<String, InputRequest>
A map of server-initiated requests that the client must fulfill. Keys are server-assigned identifiers; values are the request objects.
InputResponse = Map<String, Object?>
Revisions: 2026-07-28, ext-tasks/2026-07-28.
InputResponses = Map<String, Map<String, Object?>>
A map of client responses to server-initiated requests. Keys correspond to the keys in the InputRequests map; values are the client's result for each request.
JSONArray = List<Object?>
Revisions: 2026-07-28.
JSONObject = Map<String, Object?>
Revisions: 2026-07-28, ext-tasks/2026-07-28.
JSONRPCBatchRequest = List<Object?>
A JSON-RPC batch request, as described in https://www.jsonrpc.org/specification#batch.
JSONRPCBatchResponse = List<Object?>
A JSON-RPC batch response, as described in https://www.jsonrpc.org/specification#batch.
JSONRPCError = JSONRPCErrorResponse
Revisions: 2025-06-18.
JSONRPCMessage = Map<String, Object?>
Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
JSONValue = Object?
Revisions: 2026-07-28, ext-tasks/2026-07-28.
McpParamHeader = ({String name, List<String> path, String type})
One x-mcp-header annotation of a tool's inputSchema: the header name part, the property path to the value, and the property's type.
MetaObject = Map<String, Object?>
Represents the contents of a _meta field, which clients and servers use to attach additional metadata to their interactions.
ProgressToken = Object
A progress token, used to associate progress notifications with the original request.
RequestId = Object
A uniquely identifying ID for a request in JSON-RPC.
ResultType = String
Indicates the type of a Result object, allowing the client to determine how to parse the response.
ServerResult = Map<String, Object?>
Revisions: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25, 2026-07-28.
TasksExtensionCapability = Map<String, Object?>
Revisions: ext-tasks/2026-07-28.

Exceptions / Errors

JsonSchemaException
A schema that cannot be used: unsupported dialect, unresolvable reference, malformed keyword, or a limit exceeded while evaluating.