From 41841f1622fbeefb5e69ba59cf3300147b940b5c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 14 Nov 2025 04:05:49 +0000 Subject: [PATCH] chore: update spec.types.ts from upstream --- src/spec.types.ts | 325 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 260 insertions(+), 65 deletions(-) diff --git a/src/spec.types.ts b/src/spec.types.ts index c58636350..307884fa0 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -3,7 +3,7 @@ * * Source: https://github.com/modelcontextprotocol/modelcontextprotocol * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts - * Last updated from commit: 11ad2a720d8e2f54881235f734121db0bda39052 + * Last updated from commit: 4528444698f76e6d0337e58d2941d5d3485d779d * * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. * To update this file, run: npm run fetch:spec-types @@ -12,7 +12,7 @@ /** * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent. * - * @internal + * @category JSON-RPC */ export type JSONRPCMessage = | JSONRPCRequest @@ -27,16 +27,22 @@ export const JSONRPC_VERSION = "2.0"; /** * A progress token, used to associate progress notifications with the original request. + * + * @category Common Types */ export type ProgressToken = string | number; /** * An opaque token used to represent a cursor for pagination. + * + * @category Common Types */ export type Cursor = string; /** * Common params for any request. + * + * @internal */ export interface RequestParams { /** @@ -75,6 +81,9 @@ export interface Notification { params?: { [key: string]: any }; } +/** + * @category Common Types + */ export interface Result { /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. @@ -83,6 +92,9 @@ export interface Result { [key: string]: unknown; } +/** + * @category Common Types + */ export interface Error { /** * The error type that occurred. @@ -100,11 +112,15 @@ export interface Error { /** * A uniquely identifying ID for a request in JSON-RPC. + * + * @category Common Types */ export type RequestId = string | number; /** * A request that expects a response. + * + * @category JSON-RPC */ export interface JSONRPCRequest extends Request { jsonrpc: typeof JSONRPC_VERSION; @@ -113,6 +129,8 @@ export interface JSONRPCRequest extends Request { /** * A notification which does not expect a response. + * + * @category JSON-RPC */ export interface JSONRPCNotification extends Notification { jsonrpc: typeof JSONRPC_VERSION; @@ -120,6 +138,8 @@ export interface JSONRPCNotification extends Notification { /** * A successful (non-error) response to a request. + * + * @category JSON-RPC */ export interface JSONRPCResponse { jsonrpc: typeof JSONRPC_VERSION; @@ -128,19 +148,20 @@ export interface JSONRPCResponse { } // Standard JSON-RPC error codes -/** @internal */ export const PARSE_ERROR = -32700; -/** @internal */ export const INVALID_REQUEST = -32600; -/** @internal */ export const METHOD_NOT_FOUND = -32601; -/** @internal */ export const INVALID_PARAMS = -32602; -/** @internal */ export const INTERNAL_ERROR = -32603; +// Implementation-specific JSON-RPC error codes [-32000, -32099] +/** @internal */ +export const URL_ELICITATION_REQUIRED = -32042; + /** * A response to a request that indicates an error occurred. + * + * @category JSON-RPC */ export interface JSONRPCError { jsonrpc: typeof JSONRPC_VERSION; @@ -148,9 +169,27 @@ export interface JSONRPCError { error: Error; } +/** + * An error response that indicates that the server requires the client to provide additional information via an elicitation request. + * + * @internal + */ +export interface URLElicitationRequiredError + extends Omit { + error: Error & { + code: typeof URL_ELICITATION_REQUIRED; + data: { + elicitations: ElicitRequestURLParams[]; + [key: string]: unknown; + }; + }; +} + /* Empty result */ /** * A response that indicates success but carries no data. + * + * @category Common Types */ export type EmptyResult = Result; @@ -158,7 +197,7 @@ export type EmptyResult = Result; /** * Parameters for a `notifications/cancelled` notification. * - * @category notifications/cancelled + * @category `notifications/cancelled` */ export interface CancelledNotificationParams extends NotificationParams { /** @@ -183,7 +222,7 @@ export interface CancelledNotificationParams extends NotificationParams { * * A client MUST NOT attempt to cancel its `initialize` request. * - * @category notifications/cancelled + * @category `notifications/cancelled` */ export interface CancelledNotification extends JSONRPCNotification { method: "notifications/cancelled"; @@ -194,7 +233,7 @@ export interface CancelledNotification extends JSONRPCNotification { /** * Parameters for an `initialize` request. * - * @category initialize + * @category `initialize` */ export interface InitializeRequestParams extends RequestParams { /** @@ -208,7 +247,7 @@ export interface InitializeRequestParams extends RequestParams { /** * This request is sent from the client to the server when it first connects, asking it to begin initialization. * - * @category initialize + * @category `initialize` */ export interface InitializeRequest extends JSONRPCRequest { method: "initialize"; @@ -218,7 +257,7 @@ export interface InitializeRequest extends JSONRPCRequest { /** * After receiving an initialize request from the client, the server sends this response. * - * @category initialize + * @category `initialize` */ export interface InitializeResult extends Result { /** @@ -239,7 +278,7 @@ export interface InitializeResult extends Result { /** * This notification is sent from the client to the server after initialization has finished. * - * @category notifications/initialized + * @category `notifications/initialized` */ export interface InitializedNotification extends JSONRPCNotification { method: "notifications/initialized"; @@ -248,6 +287,8 @@ export interface InitializedNotification extends JSONRPCNotification { /** * 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. + * + * @category `initialize` */ export interface ClientCapabilities { /** @@ -270,11 +311,13 @@ export interface ClientCapabilities { /** * Present if the client supports elicitation from the server. */ - elicitation?: object; + elicitation?: { form?: object; url?: object }; } /** * 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. + * + * @category `initialize` */ export interface ServerCapabilities { /** @@ -324,6 +367,8 @@ export interface ServerCapabilities { /** * An optionally-sized icon that can be displayed in a user interface. + * + * @category Common Types */ export interface Icon { /** @@ -407,7 +452,9 @@ export interface BaseMetadata { } /** - * Describes the MCP implementation + * Describes the MCP implementation. + * + * @category `initialize` */ export interface Implementation extends BaseMetadata, Icons { version: string; @@ -424,7 +471,7 @@ export interface Implementation extends BaseMetadata, Icons { /** * 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. * - * @category ping + * @category `ping` */ export interface PingRequest extends JSONRPCRequest { method: "ping"; @@ -436,7 +483,7 @@ export interface PingRequest extends JSONRPCRequest { /** * Parameters for a `notifications/progress` notification. * - * @category notifications/progress + * @category `notifications/progress` */ export interface ProgressNotificationParams extends NotificationParams { /** @@ -464,7 +511,7 @@ export interface ProgressNotificationParams extends NotificationParams { /** * An out-of-band notification used to inform the receiver of a progress update for a long-running request. * - * @category notifications/progress + * @category `notifications/progress` */ export interface ProgressNotification extends JSONRPCNotification { method: "notifications/progress"; @@ -474,6 +521,8 @@ export interface ProgressNotification extends JSONRPCNotification { /* Pagination */ /** * Common parameters for paginated requests. + * + * @internal */ export interface PaginatedRequestParams extends RequestParams { /** @@ -501,7 +550,7 @@ export interface PaginatedResult extends Result { /** * Sent from the client to request a list of resources the server has. * - * @category resources/list + * @category `resources/list` */ export interface ListResourcesRequest extends PaginatedRequest { method: "resources/list"; @@ -510,7 +559,7 @@ export interface ListResourcesRequest extends PaginatedRequest { /** * The server's response to a resources/list request from the client. * - * @category resources/list + * @category `resources/list` */ export interface ListResourcesResult extends PaginatedResult { resources: Resource[]; @@ -519,7 +568,7 @@ export interface ListResourcesResult extends PaginatedResult { /** * Sent from the client to request a list of resource templates the server has. * - * @category resources/templates/list + * @category `resources/templates/list` */ export interface ListResourceTemplatesRequest extends PaginatedRequest { method: "resources/templates/list"; @@ -528,7 +577,7 @@ export interface ListResourceTemplatesRequest extends PaginatedRequest { /** * The server's response to a resources/templates/list request from the client. * - * @category resources/templates/list + * @category `resources/templates/list` */ export interface ListResourceTemplatesResult extends PaginatedResult { resourceTemplates: ResourceTemplate[]; @@ -551,7 +600,7 @@ export interface ResourceRequestParams extends RequestParams { /** * Parameters for a `resources/read` request. * - * @category resources/read + * @category `resources/read` */ // eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface ReadResourceRequestParams extends ResourceRequestParams {} @@ -559,7 +608,7 @@ export interface ReadResourceRequestParams extends ResourceRequestParams {} /** * Sent from the client to the server, to read a specific resource URI. * - * @category resources/read + * @category `resources/read` */ export interface ReadResourceRequest extends JSONRPCRequest { method: "resources/read"; @@ -569,7 +618,7 @@ export interface ReadResourceRequest extends JSONRPCRequest { /** * The server's response to a resources/read request from the client. * - * @category resources/read + * @category `resources/read` */ export interface ReadResourceResult extends Result { contents: (TextResourceContents | BlobResourceContents)[]; @@ -578,7 +627,7 @@ export interface ReadResourceResult extends Result { /** * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. * - * @category notifications/resources/list_changed + * @category `notifications/resources/list_changed` */ export interface ResourceListChangedNotification extends JSONRPCNotification { method: "notifications/resources/list_changed"; @@ -588,7 +637,7 @@ export interface ResourceListChangedNotification extends JSONRPCNotification { /** * Parameters for a `resources/subscribe` request. * - * @category resources/subscribe + * @category `resources/subscribe` */ // eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface SubscribeRequestParams extends ResourceRequestParams {} @@ -596,7 +645,7 @@ export interface SubscribeRequestParams extends ResourceRequestParams {} /** * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. * - * @category resources/subscribe + * @category `resources/subscribe` */ export interface SubscribeRequest extends JSONRPCRequest { method: "resources/subscribe"; @@ -606,7 +655,7 @@ export interface SubscribeRequest extends JSONRPCRequest { /** * Parameters for a `resources/unsubscribe` request. * - * @category resources/unsubscribe + * @category `resources/unsubscribe` */ // eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface UnsubscribeRequestParams extends ResourceRequestParams {} @@ -614,7 +663,7 @@ export interface UnsubscribeRequestParams extends ResourceRequestParams {} /** * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. * - * @category resources/unsubscribe + * @category `resources/unsubscribe` */ export interface UnsubscribeRequest extends JSONRPCRequest { method: "resources/unsubscribe"; @@ -624,7 +673,7 @@ export interface UnsubscribeRequest extends JSONRPCRequest { /** * Parameters for a `notifications/resources/updated` notification. * - * @category notifications/resources/updated + * @category `notifications/resources/updated` */ export interface ResourceUpdatedNotificationParams extends NotificationParams { /** @@ -638,7 +687,7 @@ export interface ResourceUpdatedNotificationParams extends NotificationParams { /** * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. * - * @category notifications/resources/updated + * @category `notifications/resources/updated` */ export interface ResourceUpdatedNotification extends JSONRPCNotification { method: "notifications/resources/updated"; @@ -647,6 +696,8 @@ export interface ResourceUpdatedNotification extends JSONRPCNotification { /** * A known resource that the server is capable of reading. + * + * @category `resources/list` */ export interface Resource extends BaseMetadata, Icons { /** @@ -688,6 +739,8 @@ export interface Resource extends BaseMetadata, Icons { /** * A template description for resources available on the server. + * + * @category `resources/templates/list` */ export interface ResourceTemplate extends BaseMetadata, Icons { /** @@ -722,6 +775,8 @@ export interface ResourceTemplate extends BaseMetadata, Icons { /** * The contents of a specific resource or sub-resource. + * + * @internal */ export interface ResourceContents { /** @@ -741,6 +796,9 @@ export interface ResourceContents { _meta?: { [key: string]: unknown }; } +/** + * @category Content + */ export interface TextResourceContents extends ResourceContents { /** * The text of the item. This must only be set if the item can actually be represented as text (not binary data). @@ -748,6 +806,9 @@ export interface TextResourceContents extends ResourceContents { text: string; } +/** + * @category Content + */ export interface BlobResourceContents extends ResourceContents { /** * A base64-encoded string representing the binary data of the item. @@ -761,7 +822,7 @@ export interface BlobResourceContents extends ResourceContents { /** * Sent from the client to request a list of prompts and prompt templates the server has. * - * @category prompts/list + * @category `prompts/list` */ export interface ListPromptsRequest extends PaginatedRequest { method: "prompts/list"; @@ -770,7 +831,7 @@ export interface ListPromptsRequest extends PaginatedRequest { /** * The server's response to a prompts/list request from the client. * - * @category prompts/list + * @category `prompts/list` */ export interface ListPromptsResult extends PaginatedResult { prompts: Prompt[]; @@ -779,7 +840,7 @@ export interface ListPromptsResult extends PaginatedResult { /** * Parameters for a `prompts/get` request. * - * @category prompts/get + * @category `prompts/get` */ export interface GetPromptRequestParams extends RequestParams { /** @@ -795,7 +856,7 @@ export interface GetPromptRequestParams extends RequestParams { /** * Used by the client to get a prompt provided by the server. * - * @category prompts/get + * @category `prompts/get` */ export interface GetPromptRequest extends JSONRPCRequest { method: "prompts/get"; @@ -805,7 +866,7 @@ export interface GetPromptRequest extends JSONRPCRequest { /** * The server's response to a prompts/get request from the client. * - * @category prompts/get + * @category `prompts/get` */ export interface GetPromptResult extends Result { /** @@ -817,6 +878,8 @@ export interface GetPromptResult extends Result { /** * A prompt or prompt template that the server offers. + * + * @category `prompts/list` */ export interface Prompt extends BaseMetadata, Icons { /** @@ -837,6 +900,8 @@ export interface Prompt extends BaseMetadata, Icons { /** * Describes an argument that a prompt can accept. + * + * @category `prompts/list` */ export interface PromptArgument extends BaseMetadata { /** @@ -851,6 +916,8 @@ export interface PromptArgument extends BaseMetadata { /** * The sender or recipient of messages and data in a conversation. + * + * @category Common Types */ export type Role = "user" | "assistant"; @@ -859,6 +926,8 @@ export type Role = "user" | "assistant"; * * This is similar to `SamplingMessage`, but also supports the embedding of * resources from the MCP server. + * + * @category `prompts/get` */ export interface PromptMessage { role: Role; @@ -869,6 +938,8 @@ export interface PromptMessage { * A resource that the server is capable of reading, included in a prompt or tool call result. * * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. + * + * @category Content */ export interface ResourceLink extends Resource { type: "resource_link"; @@ -879,6 +950,8 @@ export interface ResourceLink extends Resource { * * It is up to the client how best to render embedded resources for the benefit * of the LLM and/or the user. + * + * @category Content */ export interface EmbeddedResource { type: "resource"; @@ -897,7 +970,7 @@ export interface EmbeddedResource { /** * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. * - * @category notifications/prompts/list_changed + * @category `notifications/prompts/list_changed` */ export interface PromptListChangedNotification extends JSONRPCNotification { method: "notifications/prompts/list_changed"; @@ -908,7 +981,7 @@ export interface PromptListChangedNotification extends JSONRPCNotification { /** * Sent from the client to request a list of tools the server has. * - * @category tools/list + * @category `tools/list` */ export interface ListToolsRequest extends PaginatedRequest { method: "tools/list"; @@ -917,7 +990,7 @@ export interface ListToolsRequest extends PaginatedRequest { /** * The server's response to a tools/list request from the client. * - * @category tools/list + * @category `tools/list` */ export interface ListToolsResult extends PaginatedResult { tools: Tool[]; @@ -926,7 +999,7 @@ export interface ListToolsResult extends PaginatedResult { /** * The server's response to a tool call. * - * @category tools/call + * @category `tools/call` */ export interface CallToolResult extends Result { /** @@ -959,7 +1032,7 @@ export interface CallToolResult extends Result { /** * Parameters for a `tools/call` request. * - * @category tools/call + * @category `tools/call` */ export interface CallToolRequestParams extends RequestParams { /** @@ -975,7 +1048,7 @@ export interface CallToolRequestParams extends RequestParams { /** * Used by the client to invoke a tool provided by the server. * - * @category tools/call + * @category `tools/call` */ export interface CallToolRequest extends JSONRPCRequest { method: "tools/call"; @@ -985,7 +1058,7 @@ export interface CallToolRequest extends JSONRPCRequest { /** * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. * - * @category notifications/tools/list_changed + * @category `notifications/tools/list_changed` */ export interface ToolListChangedNotification extends JSONRPCNotification { method: "notifications/tools/list_changed"; @@ -1001,6 +1074,8 @@ export interface ToolListChangedNotification extends JSONRPCNotification { * * Clients should never make tool use decisions based on ToolAnnotations * received from untrusted servers. + * + * @category `tools/list` */ export interface ToolAnnotations { /** @@ -1048,6 +1123,8 @@ export interface ToolAnnotations { /** * Definition for a tool the client can call. + * + * @category `tools/list` */ export interface Tool extends BaseMetadata, Icons { /** @@ -1094,7 +1171,7 @@ export interface Tool extends BaseMetadata, Icons { /** * Parameters for a `logging/setLevel` request. * - * @category logging/setLevel + * @category `logging/setLevel` */ export interface SetLevelRequestParams extends RequestParams { /** @@ -1106,7 +1183,7 @@ export interface SetLevelRequestParams extends RequestParams { /** * A request from the client to the server, to enable or adjust logging. * - * @category logging/setLevel + * @category `logging/setLevel` */ export interface SetLevelRequest extends JSONRPCRequest { method: "logging/setLevel"; @@ -1116,7 +1193,7 @@ export interface SetLevelRequest extends JSONRPCRequest { /** * Parameters for a `notifications/message` notification. * - * @category notifications/message + * @category `notifications/message` */ export interface LoggingMessageNotificationParams extends NotificationParams { /** @@ -1136,7 +1213,7 @@ export interface LoggingMessageNotificationParams extends NotificationParams { /** * JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. * - * @category notifications/message + * @category `notifications/message` */ export interface LoggingMessageNotification extends JSONRPCNotification { method: "notifications/message"; @@ -1148,6 +1225,8 @@ export interface LoggingMessageNotification extends JSONRPCNotification { * * These map to syslog message severities, as specified in RFC-5424: * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 + * + * @category Common Types */ export type LoggingLevel = | "debug" @@ -1163,7 +1242,7 @@ export type LoggingLevel = /** * Parameters for a `sampling/createMessage` request. * - * @category sampling/createMessage + * @category `sampling/createMessage` */ export interface CreateMessageRequestParams extends RequestParams { messages: SamplingMessage[]; @@ -1199,7 +1278,7 @@ export interface CreateMessageRequestParams extends RequestParams { /** * 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. * - * @category sampling/createMessage + * @category `sampling/createMessage` */ export interface CreateMessageRequest extends JSONRPCRequest { method: "sampling/createMessage"; @@ -1209,7 +1288,7 @@ export interface CreateMessageRequest extends JSONRPCRequest { /** * The client's response to a sampling/create_message request from the server. 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. * - * @category sampling/createMessage + * @category `sampling/createMessage` */ export interface CreateMessageResult extends Result, SamplingMessage { /** @@ -1224,6 +1303,8 @@ export interface CreateMessageResult extends Result, SamplingMessage { /** * Describes a message issued to or received from an LLM API. + * + * @category `sampling/createMessage` */ export interface SamplingMessage { role: Role; @@ -1232,6 +1313,8 @@ export interface SamplingMessage { /** * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed + * + * @category Common Types */ export interface Annotations { /** @@ -1265,6 +1348,9 @@ export interface Annotations { lastModified?: string; } +/** + * @category Content + */ export type ContentBlock = | TextContent | ImageContent @@ -1274,6 +1360,8 @@ export type ContentBlock = /** * Text provided to or from an LLM. + * + * @category Content */ export interface TextContent { type: "text"; @@ -1296,6 +1384,8 @@ export interface TextContent { /** * An image provided to or from an LLM. + * + * @category Content */ export interface ImageContent { type: "image"; @@ -1325,6 +1415,8 @@ export interface ImageContent { /** * Audio provided to or from an LLM. + * + * @category Content */ export interface AudioContent { type: "audio"; @@ -1364,6 +1456,8 @@ export interface AudioContent { * These preferences are always advisory. The client MAY ignore them. It is also * up to the client to decide how to interpret these preferences and how to * balance them against other considerations. + * + * @category `sampling/createMessage` */ export interface ModelPreferences { /** @@ -1416,6 +1510,8 @@ export interface ModelPreferences { * * Keys not declared here are currently left unspecified by the spec and are up * to the client to interpret. + * + * @category `sampling/createMessage` */ export interface ModelHint { /** @@ -1436,7 +1532,7 @@ export interface ModelHint { /** * Parameters for a `completion/complete` request. * - * @category completion/complete + * @category `completion/complete` */ export interface CompleteRequestParams extends RequestParams { ref: PromptReference | ResourceTemplateReference; @@ -1468,7 +1564,7 @@ export interface CompleteRequestParams extends RequestParams { /** * A request from the client to the server, to ask for completion options. * - * @category completion/complete + * @category `completion/complete` */ export interface CompleteRequest extends JSONRPCRequest { method: "completion/complete"; @@ -1478,7 +1574,7 @@ export interface CompleteRequest extends JSONRPCRequest { /** * The server's response to a completion/complete request * - * @category completion/complete + * @category `completion/complete` */ export interface CompleteResult extends Result { completion: { @@ -1499,6 +1595,8 @@ export interface CompleteResult extends Result { /** * A reference to a resource or resource template definition. + * + * @category `completion/complete` */ export interface ResourceTemplateReference { type: "ref/resource"; @@ -1512,6 +1610,8 @@ export interface ResourceTemplateReference { /** * Identifies a prompt. + * + * @category `completion/complete` */ export interface PromptReference extends BaseMetadata { type: "ref/prompt"; @@ -1527,7 +1627,7 @@ export interface PromptReference extends BaseMetadata { * This request is typically used when the server needs to understand the file system * structure or access specific locations that the client has permission to read from. * - * @category roots/list + * @category `roots/list` */ export interface ListRootsRequest extends JSONRPCRequest { method: "roots/list"; @@ -1539,7 +1639,7 @@ export interface ListRootsRequest extends JSONRPCRequest { * This result contains an array of Root objects, each representing a root directory * or file that the server can operate on. * - * @category roots/list + * @category `roots/list` */ export interface ListRootsResult extends Result { roots: Root[]; @@ -1547,6 +1647,8 @@ export interface ListRootsResult extends Result { /** * Represents a root directory or file that the server can operate on. + * + * @category `roots/list` */ export interface Root { /** @@ -1575,7 +1677,7 @@ export interface Root { * 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. * - * @category notifications/roots/list_changed + * @category `notifications/roots/list_changed` */ export interface RootsListChangedNotification extends JSONRPCNotification { method: "notifications/roots/list_changed"; @@ -1583,15 +1685,21 @@ export interface RootsListChangedNotification extends JSONRPCNotification { } /** - * Parameters for an `elicitation/create` request. + * The parameters for a request to elicit non-sensitive information from the user via a form in the client. * - * @category elicitation/create + * @category `elicitation/create` */ -export interface ElicitRequestParams extends RequestParams { +export interface ElicitRequestFormParams extends RequestParams { + /** + * The elicitation mode. + */ + mode: "form"; + /** - * The message to present to the user. + * The message to present to the user describing what information is being requested. */ message: string; + /** * A restricted subset of JSON Schema. * Only top-level properties are allowed, without nesting. @@ -1605,19 +1713,61 @@ export interface ElicitRequestParams extends RequestParams { }; } +/** + * The parameters for a request to elicit information from the user via a URL in the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequestURLParams extends RequestParams { + /** + * The elicitation mode. + */ + mode: "url"; + + /** + * The message to present to the user explaining why the interaction is needed. + */ + message: string; + + /** + * The ID of the elicitation, which must be unique within the context of the server. + * The client MUST treat this ID as an opaque value. + */ + elicitationId: string; + + /** + * The URL that the user should navigate to. + * + * @format uri + */ + url: string; +} + +/** + * The parameters for a request to elicit additional information from the user via the client. + * + * @category `elicitation/create` + */ +export type ElicitRequestParams = + | ElicitRequestFormParams + | ElicitRequestURLParams; + /** * A request from the server to elicit additional information from the user via the client. * - * @category elicitation/create + * @category `elicitation/create` */ export interface ElicitRequest extends JSONRPCRequest { method: "elicitation/create"; params: ElicitRequestParams; } +/** /** * Restricted schema definitions that only allow primitive types * without nested objects or arrays. + * + * @category `elicitation/create` */ export type PrimitiveSchemaDefinition = | StringSchema @@ -1625,6 +1775,9 @@ export type PrimitiveSchemaDefinition = | BooleanSchema | EnumSchema; +/** + * @category `elicitation/create` + */ export interface StringSchema { type: "string"; title?: string; @@ -1635,6 +1788,9 @@ export interface StringSchema { default?: string; } +/** + * @category `elicitation/create` + */ export interface NumberSchema { type: "number" | "integer"; title?: string; @@ -1644,6 +1800,9 @@ export interface NumberSchema { default?: number; } +/** + * @category `elicitation/create` + */ export interface BooleanSchema { type: "boolean"; title?: string; @@ -1653,6 +1812,8 @@ export interface BooleanSchema { /** * Schema for single-selection enumeration without display titles for options. + * + * @category `elicitation/create` */ export interface UntitledSingleSelectEnumSchema { type: "string"; @@ -1676,6 +1837,8 @@ export interface UntitledSingleSelectEnumSchema { /** * Schema for single-selection enumeration with display titles for each option. + * + * @category `elicitation/create` */ export interface TitledSingleSelectEnumSchema { type: "string"; @@ -1706,6 +1869,9 @@ export interface TitledSingleSelectEnumSchema { default?: string; } +/** + * @category `elicitation/create` + */ // Combined single selection enumeration export type SingleSelectEnumSchema = | UntitledSingleSelectEnumSchema @@ -1713,6 +1879,8 @@ export type SingleSelectEnumSchema = /** * Schema for multiple-selection enumeration without display titles for options. + * + * @category `elicitation/create` */ export interface UntitledMultiSelectEnumSchema { type: "array"; @@ -1750,6 +1918,8 @@ export interface UntitledMultiSelectEnumSchema { /** * Schema for multiple-selection enumeration with display titles for each option. + * + * @category `elicitation/create` */ export interface TitledMultiSelectEnumSchema { type: "array"; @@ -1793,6 +1963,9 @@ export interface TitledMultiSelectEnumSchema { default?: string[]; } +/** + * @category `elicitation/create` + */ // Combined multiple selection enumeration export type MultiSelectEnumSchema = | UntitledMultiSelectEnumSchema @@ -1801,6 +1974,8 @@ export type MultiSelectEnumSchema = /** * Use TitledSingleSelectEnumSchema instead. * This interface will be removed in a future version. + * + * @category `elicitation/create` */ export interface LegacyTitledEnumSchema { type: "string"; @@ -1815,6 +1990,9 @@ export interface LegacyTitledEnumSchema { default?: string; } +/** + * @category `elicitation/create` + */ // Union type for all enum schemas export type EnumSchema = | SingleSelectEnumSchema @@ -1824,7 +2002,7 @@ export type EnumSchema = /** * The client's response to an elicitation request. * - * @category elicitation/create + * @category `elicitation/create` */ export interface ElicitResult extends Result { /** @@ -1836,12 +2014,28 @@ export interface ElicitResult extends Result { action: "accept" | "decline" | "cancel"; /** - * The submitted form data, only present when action is "accept". + * The submitted form data, only present when action is "accept" and mode was "form". * Contains values matching the requested schema. + * Omitted for out-of-band mode responses. */ content?: { [key: string]: string | number | boolean | string[] }; } +/** + * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request. + * + * @category `notifications/elicitation/complete` + */ +export interface ElicitationCompleteNotification extends JSONRPCNotification { + method: "notifications/elicitation/complete"; + params: { + /** + * The ID of the elicitation that completed. + */ + elicitationId: string; + }; +} + /* Client messages */ /** @internal */ export type ClientRequest = @@ -1889,7 +2083,8 @@ export type ServerNotification = | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification - | PromptListChangedNotification; + | PromptListChangedNotification + | ElicitationCompleteNotification; /** @internal */ export type ServerResult =