Path: blob/main/extensions/copilot/src/extension/common/modelContextProtocol.ts
13394 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4/* eslint-disable local/code-no-unexternalized-strings */56//#region proposals7/**8* MCP protocol proposals.9* - Proposals here MUST have an MCP PR linked to them10* - Proposals here are subject to change and SHALL be removed when11* the upstream MCP PR is merged or closed.12*/13export namespace MCP {1415// Nothing, yet1617}1819//#endregion2021/**22* Schema updated from the Model Context Protocol repository at23* https://github.com/modelcontextprotocol/specification/tree/main/schema24*25* ⚠️ Do not edit within `namespace` manually except to update schema versions ⚠️26*/27export namespace MCP {28/* JSON-RPC types */2930/**31* Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.32*33* @category JSON-RPC34*/35export type JSONRPCMessage =36| JSONRPCRequest37| JSONRPCNotification38| JSONRPCResponse39| JSONRPCError;4041/** @internal */42export const LATEST_PROTOCOL_VERSION = "2025-11-25";43/** @internal */44export const JSONRPC_VERSION = "2.0";4546/**47* A progress token, used to associate progress notifications with the original request.48*49* @category Common Types50*/51export type ProgressToken = string | number;5253/**54* An opaque token used to represent a cursor for pagination.55*56* @category Common Types57*/58export type Cursor = string;5960/**61* Common params for any task-augmented request.62*63* @internal64*/65export interface TaskAugmentedRequestParams extends RequestParams {66/**67* If specified, the caller is requesting task-augmented execution for this request.68* The request will return a CreateTaskResult immediately, and the actual result can be69* retrieved later via tasks/result.70*71* Task augmentation is subject to capability negotiation - receivers MUST declare support72* for task augmentation of specific request types in their capabilities.73*/74task?: TaskMetadata;75}76/**77* Common params for any request.78*79* @internal80*/81export interface RequestParams {82/**83* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.84*/85_meta?: {86/**87* If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.88*/89progressToken?: ProgressToken;90[key: string]: unknown;91};92}9394/** @internal */95export interface Request {96method: string;97// Allow unofficial extensions of `Request.params` without impacting `RequestParams`.98// eslint-disable-next-line @typescript-eslint/no-explicit-any99params?: { [key: string]: any };100}101102/** @internal */103export interface NotificationParams {104/**105* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.106*/107_meta?: { [key: string]: unknown };108}109110/** @internal */111export interface Notification {112method: string;113// Allow unofficial extensions of `Notification.params` without impacting `NotificationParams`.114// eslint-disable-next-line @typescript-eslint/no-explicit-any115params?: { [key: string]: any };116}117118/**119* @category Common Types120*/121export interface Result {122/**123* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.124*/125_meta?: { [key: string]: unknown };126[key: string]: unknown;127}128129/**130* @category Common Types131*/132export interface Error {133/**134* The error type that occurred.135*/136code: number;137/**138* A short description of the error. The message SHOULD be limited to a concise single sentence.139*/140message: string;141/**142* Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).143*/144data?: unknown;145}146147/**148* A uniquely identifying ID for a request in JSON-RPC.149*150* @category Common Types151*/152export type RequestId = string | number;153154/**155* A request that expects a response.156*157* @category JSON-RPC158*/159export interface JSONRPCRequest extends Request {160jsonrpc: typeof JSONRPC_VERSION;161id: RequestId;162}163164/**165* A notification which does not expect a response.166*167* @category JSON-RPC168*/169export interface JSONRPCNotification extends Notification {170jsonrpc: typeof JSONRPC_VERSION;171}172173/**174* A successful (non-error) response to a request.175*176* @category JSON-RPC177*/178export interface JSONRPCResponse {179jsonrpc: typeof JSONRPC_VERSION;180id: RequestId;181result: Result;182}183184// Standard JSON-RPC error codes185export const PARSE_ERROR = -32700;186export const INVALID_REQUEST = -32600;187export const METHOD_NOT_FOUND = -32601;188export const INVALID_PARAMS = -32602;189export const INTERNAL_ERROR = -32603;190191// Implementation-specific JSON-RPC error codes [-32000, -32099]192/** @internal */193export const URL_ELICITATION_REQUIRED = -32042;194195/**196* A response to a request that indicates an error occurred.197*198* @category JSON-RPC199*/200export interface JSONRPCError {201jsonrpc: typeof JSONRPC_VERSION;202id: RequestId;203error: Error;204}205206/**207* An error response that indicates that the server requires the client to provide additional information via an elicitation request.208*209* @internal210*/211export interface URLElicitationRequiredError212extends Omit<JSONRPCError, "error"> {213error: Error & {214code: typeof URL_ELICITATION_REQUIRED;215data: {216elicitations: ElicitRequestURLParams[];217[key: string]: unknown;218};219};220}221222/* Empty result */223/**224* A response that indicates success but carries no data.225*226* @category Common Types227*/228export type EmptyResult = Result;229230/* Cancellation */231/**232* Parameters for a `notifications/cancelled` notification.233*234* @category `notifications/cancelled`235*/236export interface CancelledNotificationParams extends NotificationParams {237/**238* The ID of the request to cancel.239*240* This MUST correspond to the ID of a request previously issued in the same direction.241* This MUST be provided for cancelling non-task requests.242* This MUST NOT be used for cancelling tasks (use the `tasks/cancel` request instead).243*/244requestId?: RequestId;245246/**247* An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.248*/249reason?: string;250}251252/**253* This notification can be sent by either side to indicate that it is cancelling a previously-issued request.254*255* The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.256*257* This notification indicates that the result will be unused, so any associated processing SHOULD cease.258*259* A client MUST NOT attempt to cancel its `initialize` request.260*261* For task cancellation, use the `tasks/cancel` request instead of this notification.262*263* @category `notifications/cancelled`264*/265export interface CancelledNotification extends JSONRPCNotification {266method: "notifications/cancelled";267params: CancelledNotificationParams;268}269270/* Initialization */271/**272* Parameters for an `initialize` request.273*274* @category `initialize`275*/276export interface InitializeRequestParams extends RequestParams {277/**278* The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.279*/280protocolVersion: string;281capabilities: ClientCapabilities;282clientInfo: Implementation;283}284285/**286* This request is sent from the client to the server when it first connects, asking it to begin initialization.287*288* @category `initialize`289*/290export interface InitializeRequest extends JSONRPCRequest {291method: "initialize";292params: InitializeRequestParams;293}294295/**296* After receiving an initialize request from the client, the server sends this response.297*298* @category `initialize`299*/300export interface InitializeResult extends Result {301/**302* The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.303*/304protocolVersion: string;305capabilities: ServerCapabilities;306serverInfo: Implementation;307308/**309* Instructions describing how to use the server and its features.310*311* This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.312*/313instructions?: string;314}315316/**317* This notification is sent from the client to the server after initialization has finished.318*319* @category `notifications/initialized`320*/321export interface InitializedNotification extends JSONRPCNotification {322method: "notifications/initialized";323params?: NotificationParams;324}325326/**327* 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.328*329* @category `initialize`330*/331export interface ClientCapabilities {332/**333* Experimental, non-standard capabilities that the client supports.334*/335experimental?: { [key: string]: object };336/**337* Present if the client supports listing roots.338*/339roots?: {340/**341* Whether the client supports notifications for changes to the roots list.342*/343listChanged?: boolean;344};345/**346* Present if the client supports sampling from an LLM.347*/348sampling?: {349/**350* Whether the client supports context inclusion via includeContext parameter.351* If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).352*/353context?: object;354/**355* Whether the client supports tool use via tools and toolChoice parameters.356*/357tools?: object;358};359/**360* Present if the client supports elicitation from the server.361*/362elicitation?: { form?: object; url?: object };363364/**365* Present if the client supports task-augmented requests.366*/367tasks?: {368/**369* Whether this client supports tasks/list.370*/371list?: object;372/**373* Whether this client supports tasks/cancel.374*/375cancel?: object;376/**377* Specifies which request types can be augmented with tasks.378*/379requests?: {380/**381* Task support for sampling-related requests.382*/383sampling?: {384/**385* Whether the client supports task-augmented sampling/createMessage requests.386*/387createMessage?: object;388};389/**390* Task support for elicitation-related requests.391*/392elicitation?: {393/**394* Whether the client supports task-augmented elicitation/create requests.395*/396create?: object;397};398};399};400}401402/**403* 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.404*405* @category `initialize`406*/407export interface ServerCapabilities {408/**409* Experimental, non-standard capabilities that the server supports.410*/411experimental?: { [key: string]: object };412/**413* Present if the server supports sending log messages to the client.414*/415logging?: object;416/**417* Present if the server supports argument autocompletion suggestions.418*/419completions?: object;420/**421* Present if the server offers any prompt templates.422*/423prompts?: {424/**425* Whether this server supports notifications for changes to the prompt list.426*/427listChanged?: boolean;428};429/**430* Present if the server offers any resources to read.431*/432resources?: {433/**434* Whether this server supports subscribing to resource updates.435*/436subscribe?: boolean;437/**438* Whether this server supports notifications for changes to the resource list.439*/440listChanged?: boolean;441};442/**443* Present if the server offers any tools to call.444*/445tools?: {446/**447* Whether this server supports notifications for changes to the tool list.448*/449listChanged?: boolean;450};451/**452* Present if the server supports task-augmented requests.453*/454tasks?: {455/**456* Whether this server supports tasks/list.457*/458list?: object;459/**460* Whether this server supports tasks/cancel.461*/462cancel?: object;463/**464* Specifies which request types can be augmented with tasks.465*/466requests?: {467/**468* Task support for tool-related requests.469*/470tools?: {471/**472* Whether the server supports task-augmented tools/call requests.473*/474call?: object;475};476};477};478}479480/**481* An optionally-sized icon that can be displayed in a user interface.482*483* @category Common Types484*/485export interface Icon {486/**487* A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a488* `data:` URI with Base64-encoded image data.489*490* Consumers SHOULD takes steps to ensure URLs serving icons are from the491* same domain as the client/server or a trusted domain.492*493* Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain494* executable JavaScript.495*496* @format uri497*/498src: string;499500/**501* Optional MIME type override if the source MIME type is missing or generic.502* For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`.503*/504mimeType?: string;505506/**507* Optional array of strings that specify sizes at which the icon can be used.508* Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.509*510* If not provided, the client should assume that the icon can be used at any size.511*/512sizes?: string[];513514/**515* Optional specifier for the theme this icon is designed for. `light` indicates516* the icon is designed to be used with a light background, and `dark` indicates517* the icon is designed to be used with a dark background.518*519* If not provided, the client should assume the icon can be used with any theme.520*/521theme?: "light" | "dark";522}523524/**525* Base interface to add `icons` property.526*527* @internal528*/529export interface Icons {530/**531* Optional set of sized icons that the client can display in a user interface.532*533* Clients that support rendering icons MUST support at least the following MIME types:534* - `image/png` - PNG images (safe, universal compatibility)535* - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)536*537* Clients that support rendering icons SHOULD also support:538* - `image/svg+xml` - SVG images (scalable but requires security precautions)539* - `image/webp` - WebP images (modern, efficient format)540*/541icons?: Icon[];542}543544/**545* Base interface for metadata with name (identifier) and title (display name) properties.546*547* @internal548*/549export interface BaseMetadata {550/**551* Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).552*/553name: string;554555/**556* Intended for UI and end-user contexts - optimized to be human-readable and easily understood,557* even by those unfamiliar with domain-specific terminology.558*559* If not provided, the name should be used for display (except for Tool,560* where `annotations.title` should be given precedence over using `name`,561* if present).562*/563title?: string;564}565566/**567* Describes the MCP implementation.568*569* @category `initialize`570*/571export interface Implementation extends BaseMetadata, Icons {572version: string;573574/**575* An optional human-readable description of what this implementation does.576*577* This can be used by clients or servers to provide context about their purpose578* and capabilities. For example, a server might describe the types of resources579* or tools it provides, while a client might describe its intended use case.580*/581description?: string;582583/**584* An optional URL of the website for this implementation.585*586* @format uri587*/588websiteUrl?: string;589}590591/* Ping */592/**593* 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.594*595* @category `ping`596*/597export interface PingRequest extends JSONRPCRequest {598method: "ping";599params?: RequestParams;600}601602/* Progress notifications */603604/**605* Parameters for a `notifications/progress` notification.606*607* @category `notifications/progress`608*/609export interface ProgressNotificationParams extends NotificationParams {610/**611* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.612*/613progressToken: ProgressToken;614/**615* The progress thus far. This should increase every time progress is made, even if the total is unknown.616*617* @TJS-type number618*/619progress: number;620/**621* Total number of items to process (or total progress required), if known.622*623* @TJS-type number624*/625total?: number;626/**627* An optional message describing the current progress.628*/629message?: string;630}631632/**633* An out-of-band notification used to inform the receiver of a progress update for a long-running request.634*635* @category `notifications/progress`636*/637export interface ProgressNotification extends JSONRPCNotification {638method: "notifications/progress";639params: ProgressNotificationParams;640}641642/* Pagination */643/**644* Common parameters for paginated requests.645*646* @internal647*/648export interface PaginatedRequestParams extends RequestParams {649/**650* An opaque token representing the current pagination position.651* If provided, the server should return results starting after this cursor.652*/653cursor?: Cursor;654}655656/** @internal */657export interface PaginatedRequest extends JSONRPCRequest {658params?: PaginatedRequestParams;659}660661/** @internal */662export interface PaginatedResult extends Result {663/**664* An opaque token representing the pagination position after the last returned result.665* If present, there may be more results available.666*/667nextCursor?: Cursor;668}669670/* Resources */671/**672* Sent from the client to request a list of resources the server has.673*674* @category `resources/list`675*/676export interface ListResourcesRequest extends PaginatedRequest {677method: "resources/list";678}679680/**681* The server's response to a resources/list request from the client.682*683* @category `resources/list`684*/685export interface ListResourcesResult extends PaginatedResult {686resources: Resource[];687}688689/**690* Sent from the client to request a list of resource templates the server has.691*692* @category `resources/templates/list`693*/694export interface ListResourceTemplatesRequest extends PaginatedRequest {695method: "resources/templates/list";696}697698/**699* The server's response to a resources/templates/list request from the client.700*701* @category `resources/templates/list`702*/703export interface ListResourceTemplatesResult extends PaginatedResult {704resourceTemplates: ResourceTemplate[];705}706707/**708* Common parameters when working with resources.709*710* @internal711*/712export interface ResourceRequestParams extends RequestParams {713/**714* The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.715*716* @format uri717*/718uri: string;719}720721/**722* Parameters for a `resources/read` request.723*724* @category `resources/read`725*/726export interface ReadResourceRequestParams extends ResourceRequestParams { }727728/**729* Sent from the client to the server, to read a specific resource URI.730*731* @category `resources/read`732*/733export interface ReadResourceRequest extends JSONRPCRequest {734method: "resources/read";735params: ReadResourceRequestParams;736}737738/**739* The server's response to a resources/read request from the client.740*741* @category `resources/read`742*/743export interface ReadResourceResult extends Result {744contents: (TextResourceContents | BlobResourceContents)[];745}746747/**748* 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.749*750* @category `notifications/resources/list_changed`751*/752export interface ResourceListChangedNotification extends JSONRPCNotification {753method: "notifications/resources/list_changed";754params?: NotificationParams;755}756757/**758* Parameters for a `resources/subscribe` request.759*760* @category `resources/subscribe`761*/762export interface SubscribeRequestParams extends ResourceRequestParams { }763764/**765* Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.766*767* @category `resources/subscribe`768*/769export interface SubscribeRequest extends JSONRPCRequest {770method: "resources/subscribe";771params: SubscribeRequestParams;772}773774/**775* Parameters for a `resources/unsubscribe` request.776*777* @category `resources/unsubscribe`778*/779export interface UnsubscribeRequestParams extends ResourceRequestParams { }780781/**782* Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.783*784* @category `resources/unsubscribe`785*/786export interface UnsubscribeRequest extends JSONRPCRequest {787method: "resources/unsubscribe";788params: UnsubscribeRequestParams;789}790791/**792* Parameters for a `notifications/resources/updated` notification.793*794* @category `notifications/resources/updated`795*/796export interface ResourceUpdatedNotificationParams extends NotificationParams {797/**798* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.799*800* @format uri801*/802uri: string;803}804805/**806* 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.807*808* @category `notifications/resources/updated`809*/810export interface ResourceUpdatedNotification extends JSONRPCNotification {811method: "notifications/resources/updated";812params: ResourceUpdatedNotificationParams;813}814815/**816* A known resource that the server is capable of reading.817*818* @category `resources/list`819*/820export interface Resource extends BaseMetadata, Icons {821/**822* The URI of this resource.823*824* @format uri825*/826uri: string;827828/**829* A description of what this resource represents.830*831* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.832*/833description?: string;834835/**836* The MIME type of this resource, if known.837*/838mimeType?: string;839840/**841* Optional annotations for the client.842*/843annotations?: Annotations;844845/**846* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.847*848* This can be used by Hosts to display file sizes and estimate context window usage.849*/850size?: number;851852/**853* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.854*/855_meta?: { [key: string]: unknown };856}857858/**859* A template description for resources available on the server.860*861* @category `resources/templates/list`862*/863export interface ResourceTemplate extends BaseMetadata, Icons {864/**865* A URI template (according to RFC 6570) that can be used to construct resource URIs.866*867* @format uri-template868*/869uriTemplate: string;870871/**872* A description of what this template is for.873*874* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.875*/876description?: string;877878/**879* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.880*/881mimeType?: string;882883/**884* Optional annotations for the client.885*/886annotations?: Annotations;887888/**889* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.890*/891_meta?: { [key: string]: unknown };892}893894/**895* The contents of a specific resource or sub-resource.896*897* @internal898*/899export interface ResourceContents {900/**901* The URI of this resource.902*903* @format uri904*/905uri: string;906/**907* The MIME type of this resource, if known.908*/909mimeType?: string;910911/**912* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.913*/914_meta?: { [key: string]: unknown };915}916917/**918* @category Content919*/920export interface TextResourceContents extends ResourceContents {921/**922* The text of the item. This must only be set if the item can actually be represented as text (not binary data).923*/924text: string;925}926927/**928* @category Content929*/930export interface BlobResourceContents extends ResourceContents {931/**932* A base64-encoded string representing the binary data of the item.933*934* @format byte935*/936blob: string;937}938939/* Prompts */940/**941* Sent from the client to request a list of prompts and prompt templates the server has.942*943* @category `prompts/list`944*/945export interface ListPromptsRequest extends PaginatedRequest {946method: "prompts/list";947}948949/**950* The server's response to a prompts/list request from the client.951*952* @category `prompts/list`953*/954export interface ListPromptsResult extends PaginatedResult {955prompts: Prompt[];956}957958/**959* Parameters for a `prompts/get` request.960*961* @category `prompts/get`962*/963export interface GetPromptRequestParams extends RequestParams {964/**965* The name of the prompt or prompt template.966*/967name: string;968/**969* Arguments to use for templating the prompt.970*/971arguments?: { [key: string]: string };972}973974/**975* Used by the client to get a prompt provided by the server.976*977* @category `prompts/get`978*/979export interface GetPromptRequest extends JSONRPCRequest {980method: "prompts/get";981params: GetPromptRequestParams;982}983984/**985* The server's response to a prompts/get request from the client.986*987* @category `prompts/get`988*/989export interface GetPromptResult extends Result {990/**991* An optional description for the prompt.992*/993description?: string;994messages: PromptMessage[];995}996997/**998* A prompt or prompt template that the server offers.999*1000* @category `prompts/list`1001*/1002export interface Prompt extends BaseMetadata, Icons {1003/**1004* An optional description of what this prompt provides1005*/1006description?: string;10071008/**1009* A list of arguments to use for templating the prompt.1010*/1011arguments?: PromptArgument[];10121013/**1014* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1015*/1016_meta?: { [key: string]: unknown };1017}10181019/**1020* Describes an argument that a prompt can accept.1021*1022* @category `prompts/list`1023*/1024export interface PromptArgument extends BaseMetadata {1025/**1026* A human-readable description of the argument.1027*/1028description?: string;1029/**1030* Whether this argument must be provided.1031*/1032required?: boolean;1033}10341035/**1036* The sender or recipient of messages and data in a conversation.1037*1038* @category Common Types1039*/1040export type Role = "user" | "assistant";10411042/**1043* Describes a message returned as part of a prompt.1044*1045* This is similar to `SamplingMessage`, but also supports the embedding of1046* resources from the MCP server.1047*1048* @category `prompts/get`1049*/1050export interface PromptMessage {1051role: Role;1052content: ContentBlock;1053}10541055/**1056* A resource that the server is capable of reading, included in a prompt or tool call result.1057*1058* Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.1059*1060* @category Content1061*/1062export interface ResourceLink extends Resource {1063type: "resource_link";1064}10651066/**1067* The contents of a resource, embedded into a prompt or tool call result.1068*1069* It is up to the client how best to render embedded resources for the benefit1070* of the LLM and/or the user.1071*1072* @category Content1073*/1074export interface EmbeddedResource {1075type: "resource";1076resource: TextResourceContents | BlobResourceContents;10771078/**1079* Optional annotations for the client.1080*/1081annotations?: Annotations;10821083/**1084* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1085*/1086_meta?: { [key: string]: unknown };1087}1088/**1089* 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.1090*1091* @category `notifications/prompts/list_changed`1092*/1093export interface PromptListChangedNotification extends JSONRPCNotification {1094method: "notifications/prompts/list_changed";1095params?: NotificationParams;1096}10971098/* Tools */1099/**1100* Sent from the client to request a list of tools the server has.1101*1102* @category `tools/list`1103*/1104export interface ListToolsRequest extends PaginatedRequest {1105method: "tools/list";1106}11071108/**1109* The server's response to a tools/list request from the client.1110*1111* @category `tools/list`1112*/1113export interface ListToolsResult extends PaginatedResult {1114tools: Tool[];1115}11161117/**1118* The server's response to a tool call.1119*1120* @category `tools/call`1121*/1122export interface CallToolResult extends Result {1123/**1124* A list of content objects that represent the unstructured result of the tool call.1125*/1126content: ContentBlock[];11271128/**1129* An optional JSON object that represents the structured result of the tool call.1130*/1131structuredContent?: { [key: string]: unknown };11321133/**1134* Whether the tool call ended in an error.1135*1136* If not set, this is assumed to be false (the call was successful).1137*1138* Any errors that originate from the tool SHOULD be reported inside the result1139* object, with `isError` set to true, _not_ as an MCP protocol-level error1140* response. Otherwise, the LLM would not be able to see that an error occurred1141* and self-correct.1142*1143* However, any errors in _finding_ the tool, an error indicating that the1144* server does not support tool calls, or any other exceptional conditions,1145* should be reported as an MCP error response.1146*/1147isError?: boolean;1148}11491150/**1151* Parameters for a `tools/call` request.1152*1153* @category `tools/call`1154*/1155export interface CallToolRequestParams extends TaskAugmentedRequestParams {1156/**1157* The name of the tool.1158*/1159name: string;1160/**1161* Arguments to use for the tool call.1162*/1163arguments?: { [key: string]: unknown };1164}11651166/**1167* Used by the client to invoke a tool provided by the server.1168*1169* @category `tools/call`1170*/1171export interface CallToolRequest extends JSONRPCRequest {1172method: "tools/call";1173params: CallToolRequestParams;1174}11751176/**1177* 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.1178*1179* @category `notifications/tools/list_changed`1180*/1181export interface ToolListChangedNotification extends JSONRPCNotification {1182method: "notifications/tools/list_changed";1183params?: NotificationParams;1184}11851186/**1187* Additional properties describing a Tool to clients.1188*1189* NOTE: all properties in ToolAnnotations are **hints**.1190* They are not guaranteed to provide a faithful description of1191* tool behavior (including descriptive properties like `title`).1192*1193* Clients should never make tool use decisions based on ToolAnnotations1194* received from untrusted servers.1195*1196* @category `tools/list`1197*/1198export interface ToolAnnotations {1199/**1200* A human-readable title for the tool.1201*/1202title?: string;12031204/**1205* If true, the tool does not modify its environment.1206*1207* Default: false1208*/1209readOnlyHint?: boolean;12101211/**1212* If true, the tool may perform destructive updates to its environment.1213* If false, the tool performs only additive updates.1214*1215* (This property is meaningful only when `readOnlyHint == false`)1216*1217* Default: true1218*/1219destructiveHint?: boolean;12201221/**1222* If true, calling the tool repeatedly with the same arguments1223* will have no additional effect on its environment.1224*1225* (This property is meaningful only when `readOnlyHint == false`)1226*1227* Default: false1228*/1229idempotentHint?: boolean;12301231/**1232* If true, this tool may interact with an "open world" of external1233* entities. If false, the tool's domain of interaction is closed.1234* For example, the world of a web search tool is open, whereas that1235* of a memory tool is not.1236*1237* Default: true1238*/1239openWorldHint?: boolean;1240}12411242/**1243* Execution-related properties for a tool.1244*1245* @category `tools/list`1246*/1247export interface ToolExecution {1248/**1249* Indicates whether this tool supports task-augmented execution.1250* This allows clients to handle long-running operations through polling1251* the task system.1252*1253* - "forbidden": Tool does not support task-augmented execution (default when absent)1254* - "optional": Tool may support task-augmented execution1255* - "required": Tool requires task-augmented execution1256*1257* Default: "forbidden"1258*/1259taskSupport?: "forbidden" | "optional" | "required";1260}12611262/**1263* Definition for a tool the client can call.1264*1265* @category `tools/list`1266*/1267export interface Tool extends BaseMetadata, Icons {1268/**1269* A human-readable description of the tool.1270*1271* This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.1272*/1273description?: string;12741275/**1276* A JSON Schema object defining the expected parameters for the tool.1277*/1278inputSchema: {1279$schema?: string;1280type: "object";1281properties?: { [key: string]: object };1282required?: string[];1283};12841285/**1286* Execution-related properties for this tool.1287*/1288execution?: ToolExecution;12891290/**1291* An optional JSON Schema object defining the structure of the tool's output returned in1292* the structuredContent field of a CallToolResult.1293*1294* Defaults to JSON Schema 2020-12 when no explicit $schema is provided.1295* Currently restricted to type: "object" at the root level.1296*/1297outputSchema?: {1298$schema?: string;1299type: "object";1300properties?: { [key: string]: object };1301required?: string[];1302};13031304/**1305* Optional additional tool information.1306*1307* Display name precedence order is: title, annotations.title, then name.1308*/1309annotations?: ToolAnnotations;13101311/**1312* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1313*/1314_meta?: { [key: string]: unknown };1315}13161317/* Tasks */13181319/**1320* The status of a task.1321*1322* @category `tasks`1323*/1324export type TaskStatus =1325| "working" // The request is currently being processed1326| "input_required" // The task is waiting for input (e.g., elicitation or sampling)1327| "completed" // The request completed successfully and results are available1328| "failed" // The associated request did not complete successfully. For tool calls specifically, this includes cases where the tool call result has `isError` set to true.1329| "cancelled"; // The request was cancelled before completion13301331/**1332* Metadata for augmenting a request with task execution.1333* Include this in the `task` field of the request parameters.1334*1335* @category `tasks`1336*/1337export interface TaskMetadata {1338/**1339* Requested duration in milliseconds to retain task from creation.1340*/1341ttl?: number;1342}13431344/**1345* Metadata for associating messages with a task.1346* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.1347*1348* @category `tasks`1349*/1350export interface RelatedTaskMetadata {1351/**1352* The task identifier this message is associated with.1353*/1354taskId: string;1355}13561357/**1358* Data associated with a task.1359*1360* @category `tasks`1361*/1362export interface Task {1363/**1364* The task identifier.1365*/1366taskId: string;13671368/**1369* Current task state.1370*/1371status: TaskStatus;13721373/**1374* Optional human-readable message describing the current task state.1375* This can provide context for any status, including:1376* - Reasons for "cancelled" status1377* - Summaries for "completed" status1378* - Diagnostic information for "failed" status (e.g., error details, what went wrong)1379*/1380statusMessage?: string;13811382/**1383* ISO 8601 timestamp when the task was created.1384*/1385createdAt: string;13861387/**1388* Actual retention duration from creation in milliseconds, null for unlimited.1389*/1390ttl: number | null;13911392/**1393* Suggested polling interval in milliseconds.1394*/1395pollInterval?: number;1396}13971398/**1399* A response to a task-augmented request.1400*1401* @category `tasks`1402*/1403export interface CreateTaskResult extends Result {1404task: Task;1405}14061407/**1408* A request to retrieve the state of a task.1409*1410* @category `tasks/get`1411*/1412export interface GetTaskRequest extends JSONRPCRequest {1413method: "tasks/get";1414params: {1415/**1416* The task identifier to query.1417*/1418taskId: string;1419};1420}14211422/**1423* The response to a tasks/get request.1424*1425* @category `tasks/get`1426*/1427export type GetTaskResult = Result & Task;14281429/**1430* A request to retrieve the result of a completed task.1431*1432* @category `tasks/result`1433*/1434export interface GetTaskPayloadRequest extends JSONRPCRequest {1435method: "tasks/result";1436params: {1437/**1438* The task identifier to retrieve results for.1439*/1440taskId: string;1441};1442}14431444/**1445* The response to a tasks/result request.1446* The structure matches the result type of the original request.1447* For example, a tools/call task would return the CallToolResult structure.1448*1449* @category `tasks/result`1450*/1451export interface GetTaskPayloadResult extends Result {1452[key: string]: unknown;1453}14541455/**1456* A request to cancel a task.1457*1458* @category `tasks/cancel`1459*/1460export interface CancelTaskRequest extends JSONRPCRequest {1461method: "tasks/cancel";1462params: {1463/**1464* The task identifier to cancel.1465*/1466taskId: string;1467};1468}14691470/**1471* The response to a tasks/cancel request.1472*1473* @category `tasks/cancel`1474*/1475export type CancelTaskResult = Result & Task;14761477/**1478* A request to retrieve a list of tasks.1479*1480* @category `tasks/list`1481*/1482export interface ListTasksRequest extends PaginatedRequest {1483method: "tasks/list";1484}14851486/**1487* The response to a tasks/list request.1488*1489* @category `tasks/list`1490*/1491export interface ListTasksResult extends PaginatedResult {1492tasks: Task[];1493}14941495/**1496* Parameters for a `notifications/tasks/status` notification.1497*1498* @category `notifications/tasks/status`1499*/1500export type TaskStatusNotificationParams = NotificationParams & Task;15011502/**1503* An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications.1504*1505* @category `notifications/tasks/status`1506*/1507export interface TaskStatusNotification extends JSONRPCNotification {1508method: "notifications/tasks/status";1509params: TaskStatusNotificationParams;1510}15111512/* Logging */15131514/**1515* Parameters for a `logging/setLevel` request.1516*1517* @category `logging/setLevel`1518*/1519export interface SetLevelRequestParams extends RequestParams {1520/**1521* The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.1522*/1523level: LoggingLevel;1524}15251526/**1527* A request from the client to the server, to enable or adjust logging.1528*1529* @category `logging/setLevel`1530*/1531export interface SetLevelRequest extends JSONRPCRequest {1532method: "logging/setLevel";1533params: SetLevelRequestParams;1534}15351536/**1537* Parameters for a `notifications/message` notification.1538*1539* @category `notifications/message`1540*/1541export interface LoggingMessageNotificationParams extends NotificationParams {1542/**1543* The severity of this log message.1544*/1545level: LoggingLevel;1546/**1547* An optional name of the logger issuing this message.1548*/1549logger?: string;1550/**1551* The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.1552*/1553data: unknown;1554}15551556/**1557* 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.1558*1559* @category `notifications/message`1560*/1561export interface LoggingMessageNotification extends JSONRPCNotification {1562method: "notifications/message";1563params: LoggingMessageNotificationParams;1564}15651566/**1567* The severity of a log message.1568*1569* These map to syslog message severities, as specified in RFC-5424:1570* https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.11571*1572* @category Common Types1573*/1574export type LoggingLevel =1575| "debug"1576| "info"1577| "notice"1578| "warning"1579| "error"1580| "critical"1581| "alert"1582| "emergency";15831584/* Sampling */1585/**1586* Parameters for a `sampling/createMessage` request.1587*1588* @category `sampling/createMessage`1589*/1590export interface CreateMessageRequestParams extends TaskAugmentedRequestParams {1591messages: SamplingMessage[];1592/**1593* The server's preferences for which model to select. The client MAY ignore these preferences.1594*/1595modelPreferences?: ModelPreferences;1596/**1597* An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.1598*/1599systemPrompt?: string;1600/**1601* A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.1602* The client MAY ignore this request.1603*1604* Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client1605* declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.1606*/1607includeContext?: "none" | "thisServer" | "allServers";1608/**1609* @TJS-type number1610*/1611temperature?: number;1612/**1613* The requested maximum number of tokens to sample (to prevent runaway completions).1614*1615* The client MAY choose to sample fewer tokens than the requested maximum.1616*/1617maxTokens: number;1618stopSequences?: string[];1619/**1620* Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.1621*/1622metadata?: object;1623/**1624* Tools that the model may use during generation.1625* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.1626*/1627tools?: Tool[];1628/**1629* Controls how the model uses tools.1630* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.1631* Default is `{ mode: "auto" }`.1632*/1633toolChoice?: ToolChoice;1634}16351636/**1637* Controls tool selection behavior for sampling requests.1638*1639* @category `sampling/createMessage`1640*/1641export interface ToolChoice {1642/**1643* Controls the tool use ability of the model:1644* - "auto": Model decides whether to use tools (default)1645* - "required": Model MUST use at least one tool before completing1646* - "none": Model MUST NOT use any tools1647*/1648mode?: "auto" | "required" | "none";1649}16501651/**1652* 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.1653*1654* @category `sampling/createMessage`1655*/1656export interface CreateMessageRequest extends JSONRPCRequest {1657method: "sampling/createMessage";1658params: CreateMessageRequestParams;1659}16601661/**1662* The client's response to a sampling/createMessage request from the server.1663* The client should inform the user before returning the sampled message, to allow them1664* to inspect the response (human in the loop) and decide whether to allow the server to see it.1665*1666* @category `sampling/createMessage`1667*/1668export interface CreateMessageResult extends Result, SamplingMessage {1669/**1670* The name of the model that generated the message.1671*/1672model: string;16731674/**1675* The reason why sampling stopped, if known.1676*1677* Standard values:1678* - "endTurn": Natural end of the assistant's turn1679* - "stopSequence": A stop sequence was encountered1680* - "maxTokens": Maximum token limit was reached1681* - "toolUse": The model wants to use one or more tools1682*1683* This field is an open string to allow for provider-specific stop reasons.1684*/1685stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string;1686}16871688/**1689* Describes a message issued to or received from an LLM API.1690*1691* @category `sampling/createMessage`1692*/1693export interface SamplingMessage {1694role: Role;1695content: SamplingMessageContentBlock | SamplingMessageContentBlock[];1696/**1697* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1698*/1699_meta?: { [key: string]: unknown };1700}1701export type SamplingMessageContentBlock =1702| TextContent1703| ImageContent1704| AudioContent1705| ToolUseContent1706| ToolResultContent;17071708/**1709* Optional annotations for the client. The client can use annotations to inform how objects are used or displayed1710*1711* @category Common Types1712*/1713export interface Annotations {1714/**1715* Describes who the intended audience of this object or data is.1716*1717* It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`).1718*/1719audience?: Role[];17201721/**1722* Describes how important this data is for operating the server.1723*1724* A value of 1 means "most important," and indicates that the data is1725* effectively required, while 0 means "least important," and indicates that1726* the data is entirely optional.1727*1728* @TJS-type number1729* @minimum 01730* @maximum 11731*/1732priority?: number;17331734/**1735* The moment the resource was last modified, as an ISO 8601 formatted string.1736*1737* Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").1738*1739* Examples: last activity timestamp in an open file, timestamp when the resource1740* was attached, etc.1741*/1742lastModified?: string;1743}17441745/**1746* @category Content1747*/1748export type ContentBlock =1749| TextContent1750| ImageContent1751| AudioContent1752| ResourceLink1753| EmbeddedResource;17541755/**1756* Text provided to or from an LLM.1757*1758* @category Content1759*/1760export interface TextContent {1761type: "text";17621763/**1764* The text content of the message.1765*/1766text: string;17671768/**1769* Optional annotations for the client.1770*/1771annotations?: Annotations;17721773/**1774* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1775*/1776_meta?: { [key: string]: unknown };1777}17781779/**1780* An image provided to or from an LLM.1781*1782* @category Content1783*/1784export interface ImageContent {1785type: "image";17861787/**1788* The base64-encoded image data.1789*1790* @format byte1791*/1792data: string;17931794/**1795* The MIME type of the image. Different providers may support different image types.1796*/1797mimeType: string;17981799/**1800* Optional annotations for the client.1801*/1802annotations?: Annotations;18031804/**1805* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1806*/1807_meta?: { [key: string]: unknown };1808}18091810/**1811* Audio provided to or from an LLM.1812*1813* @category Content1814*/1815export interface AudioContent {1816type: "audio";18171818/**1819* The base64-encoded audio data.1820*1821* @format byte1822*/1823data: string;18241825/**1826* The MIME type of the audio. Different providers may support different audio types.1827*/1828mimeType: string;18291830/**1831* Optional annotations for the client.1832*/1833annotations?: Annotations;18341835/**1836* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1837*/1838_meta?: { [key: string]: unknown };1839}18401841/**1842* A request from the assistant to call a tool.1843*1844* @category `sampling/createMessage`1845*/1846export interface ToolUseContent {1847type: "tool_use";18481849/**1850* A unique identifier for this tool use.1851*1852* This ID is used to match tool results to their corresponding tool uses.1853*/1854id: string;18551856/**1857* The name of the tool to call.1858*/1859name: string;18601861/**1862* The arguments to pass to the tool, conforming to the tool's input schema.1863*/1864input: { [key: string]: unknown };18651866/**1867* Optional metadata about the tool use. Clients SHOULD preserve this field when1868* including tool uses in subsequent sampling requests to enable caching optimizations.1869*1870* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1871*/1872_meta?: { [key: string]: unknown };1873}18741875/**1876* The result of a tool use, provided by the user back to the assistant.1877*1878* @category `sampling/createMessage`1879*/1880export interface ToolResultContent {1881type: "tool_result";18821883/**1884* The ID of the tool use this result corresponds to.1885*1886* This MUST match the ID from a previous ToolUseContent.1887*/1888toolUseId: string;18891890/**1891* The unstructured result content of the tool use.1892*1893* This has the same format as CallToolResult.content and can include text, images,1894* audio, resource links, and embedded resources.1895*/1896content: ContentBlock[];18971898/**1899* An optional structured result object.1900*1901* If the tool defined an outputSchema, this SHOULD conform to that schema.1902*/1903structuredContent?: { [key: string]: unknown };19041905/**1906* Whether the tool use resulted in an error.1907*1908* If true, the content typically describes the error that occurred.1909* Default: false1910*/1911isError?: boolean;19121913/**1914* Optional metadata about the tool result. Clients SHOULD preserve this field when1915* including tool results in subsequent sampling requests to enable caching optimizations.1916*1917* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.1918*/1919_meta?: { [key: string]: unknown };1920}19211922/**1923* The server's preferences for model selection, requested of the client during sampling.1924*1925* Because LLMs can vary along multiple dimensions, choosing the "best" model is1926* rarely straightforward. Different models excel in different areas-some are1927* faster but less capable, others are more capable but more expensive, and so1928* on. This interface allows servers to express their priorities across multiple1929* dimensions to help clients make an appropriate selection for their use case.1930*1931* These preferences are always advisory. The client MAY ignore them. It is also1932* up to the client to decide how to interpret these preferences and how to1933* balance them against other considerations.1934*1935* @category `sampling/createMessage`1936*/1937export interface ModelPreferences {1938/**1939* Optional hints to use for model selection.1940*1941* If multiple hints are specified, the client MUST evaluate them in order1942* (such that the first match is taken).1943*1944* The client SHOULD prioritize these hints over the numeric priorities, but1945* MAY still use the priorities to select from ambiguous matches.1946*/1947hints?: ModelHint[];19481949/**1950* How much to prioritize cost when selecting a model. A value of 0 means cost1951* is not important, while a value of 1 means cost is the most important1952* factor.1953*1954* @TJS-type number1955* @minimum 01956* @maximum 11957*/1958costPriority?: number;19591960/**1961* How much to prioritize sampling speed (latency) when selecting a model. A1962* value of 0 means speed is not important, while a value of 1 means speed is1963* the most important factor.1964*1965* @TJS-type number1966* @minimum 01967* @maximum 11968*/1969speedPriority?: number;19701971/**1972* How much to prioritize intelligence and capabilities when selecting a1973* model. A value of 0 means intelligence is not important, while a value of 11974* means intelligence is the most important factor.1975*1976* @TJS-type number1977* @minimum 01978* @maximum 11979*/1980intelligencePriority?: number;1981}19821983/**1984* Hints to use for model selection.1985*1986* Keys not declared here are currently left unspecified by the spec and are up1987* to the client to interpret.1988*1989* @category `sampling/createMessage`1990*/1991export interface ModelHint {1992/**1993* A hint for a model name.1994*1995* The client SHOULD treat this as a substring of a model name; for example:1996* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`1997* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.1998* - `claude` should match any Claude model1999*2000* The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:2001* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`2002*/2003name?: string;2004}20052006/* Autocomplete */2007/**2008* Parameters for a `completion/complete` request.2009*2010* @category `completion/complete`2011*/2012export interface CompleteRequestParams extends RequestParams {2013ref: PromptReference | ResourceTemplateReference;2014/**2015* The argument's information2016*/2017argument: {2018/**2019* The name of the argument2020*/2021name: string;2022/**2023* The value of the argument to use for completion matching.2024*/2025value: string;2026};20272028/**2029* Additional, optional context for completions2030*/2031context?: {2032/**2033* Previously-resolved variables in a URI template or prompt.2034*/2035arguments?: { [key: string]: string };2036};2037}20382039/**2040* A request from the client to the server, to ask for completion options.2041*2042* @category `completion/complete`2043*/2044export interface CompleteRequest extends JSONRPCRequest {2045method: "completion/complete";2046params: CompleteRequestParams;2047}20482049/**2050* The server's response to a completion/complete request2051*2052* @category `completion/complete`2053*/2054export interface CompleteResult extends Result {2055completion: {2056/**2057* An array of completion values. Must not exceed 100 items.2058*/2059values: string[];2060/**2061* The total number of completion options available. This can exceed the number of values actually sent in the response.2062*/2063total?: number;2064/**2065* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.2066*/2067hasMore?: boolean;2068};2069}20702071/**2072* A reference to a resource or resource template definition.2073*2074* @category `completion/complete`2075*/2076export interface ResourceTemplateReference {2077type: "ref/resource";2078/**2079* The URI or URI template of the resource.2080*2081* @format uri-template2082*/2083uri: string;2084}20852086/**2087* Identifies a prompt.2088*2089* @category `completion/complete`2090*/2091export interface PromptReference extends BaseMetadata {2092type: "ref/prompt";2093}20942095/* Roots */2096/**2097* Sent from the server to request a list of root URIs from the client. Roots allow2098* servers to ask for specific directories or files to operate on. A common example2099* for roots is providing a set of repositories or directories a server should operate2100* on.2101*2102* This request is typically used when the server needs to understand the file system2103* structure or access specific locations that the client has permission to read from.2104*2105* @category `roots/list`2106*/2107export interface ListRootsRequest extends JSONRPCRequest {2108method: "roots/list";2109params?: RequestParams;2110}21112112/**2113* The client's response to a roots/list request from the server.2114* This result contains an array of Root objects, each representing a root directory2115* or file that the server can operate on.2116*2117* @category `roots/list`2118*/2119export interface ListRootsResult extends Result {2120roots: Root[];2121}21222123/**2124* Represents a root directory or file that the server can operate on.2125*2126* @category `roots/list`2127*/2128export interface Root {2129/**2130* The URI identifying the root. This *must* start with file:// for now.2131* This restriction may be relaxed in future versions of the protocol to allow2132* other URI schemes.2133*2134* @format uri2135*/2136uri: string;2137/**2138* An optional name for the root. This can be used to provide a human-readable2139* identifier for the root, which may be useful for display purposes or for2140* referencing the root in other parts of the application.2141*/2142name?: string;21432144/**2145* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.2146*/2147_meta?: { [key: string]: unknown };2148}21492150/**2151* A notification from the client to the server, informing it that the list of roots has changed.2152* This notification should be sent whenever the client adds, removes, or modifies any root.2153* The server should then request an updated list of roots using the ListRootsRequest.2154*2155* @category `notifications/roots/list_changed`2156*/2157export interface RootsListChangedNotification extends JSONRPCNotification {2158method: "notifications/roots/list_changed";2159params?: NotificationParams;2160}21612162/**2163* The parameters for a request to elicit non-sensitive information from the user via a form in the client.2164*2165* @category `elicitation/create`2166*/2167export interface ElicitRequestFormParams extends TaskAugmentedRequestParams {2168/**2169* The elicitation mode.2170*/2171mode?: "form";21722173/**2174* The message to present to the user describing what information is being requested.2175*/2176message: string;21772178/**2179* A restricted subset of JSON Schema.2180* Only top-level properties are allowed, without nesting.2181*/2182requestedSchema: {2183$schema?: string;2184type: "object";2185properties: {2186[key: string]: PrimitiveSchemaDefinition;2187};2188required?: string[];2189};2190}21912192/**2193* The parameters for a request to elicit information from the user via a URL in the client.2194*2195* @category `elicitation/create`2196*/2197export interface ElicitRequestURLParams extends TaskAugmentedRequestParams {2198/**2199* The elicitation mode.2200*/2201mode: "url";22022203/**2204* The message to present to the user explaining why the interaction is needed.2205*/2206message: string;22072208/**2209* The ID of the elicitation, which must be unique within the context of the server.2210* The client MUST treat this ID as an opaque value.2211*/2212elicitationId: string;22132214/**2215* The URL that the user should navigate to.2216*2217* @format uri2218*/2219url: string;2220}22212222/**2223* The parameters for a request to elicit additional information from the user via the client.2224*2225* @category `elicitation/create`2226*/2227export type ElicitRequestParams =2228| ElicitRequestFormParams2229| ElicitRequestURLParams;22302231/**2232* A request from the server to elicit additional information from the user via the client.2233*2234* @category `elicitation/create`2235*/2236export interface ElicitRequest extends JSONRPCRequest {2237method: "elicitation/create";2238params: ElicitRequestParams;2239}22402241/**2242* Restricted schema definitions that only allow primitive types2243* without nested objects or arrays.2244*2245* @category `elicitation/create`2246*/2247export type PrimitiveSchemaDefinition =2248| StringSchema2249| NumberSchema2250| BooleanSchema2251| EnumSchema;22522253/**2254* @category `elicitation/create`2255*/2256export interface StringSchema {2257type: "string";2258title?: string;2259description?: string;2260minLength?: number;2261maxLength?: number;2262format?: "email" | "uri" | "date" | "date-time";2263default?: string;2264}22652266/**2267* @category `elicitation/create`2268*/2269export interface NumberSchema {2270type: "number" | "integer";2271title?: string;2272description?: string;2273minimum?: number;2274maximum?: number;2275default?: number;2276}22772278/**2279* @category `elicitation/create`2280*/2281export interface BooleanSchema {2282type: "boolean";2283title?: string;2284description?: string;2285default?: boolean;2286}22872288/**2289* Schema for single-selection enumeration without display titles for options.2290*2291* @category `elicitation/create`2292*/2293export interface UntitledSingleSelectEnumSchema {2294type: "string";2295/**2296* Optional title for the enum field.2297*/2298title?: string;2299/**2300* Optional description for the enum field.2301*/2302description?: string;2303/**2304* Array of enum values to choose from.2305*/2306enum: string[];2307/**2308* Optional default value.2309*/2310default?: string;2311}23122313/**2314* Schema for single-selection enumeration with display titles for each option.2315*2316* @category `elicitation/create`2317*/2318export interface TitledSingleSelectEnumSchema {2319type: "string";2320/**2321* Optional title for the enum field.2322*/2323title?: string;2324/**2325* Optional description for the enum field.2326*/2327description?: string;2328/**2329* Array of enum options with values and display labels.2330*/2331oneOf: Array<{2332/**2333* The enum value.2334*/2335const: string;2336/**2337* Display label for this option.2338*/2339title: string;2340}>;2341/**2342* Optional default value.2343*/2344default?: string;2345}23462347/**2348* @category `elicitation/create`2349*/2350// Combined single selection enumeration2351export type SingleSelectEnumSchema =2352| UntitledSingleSelectEnumSchema2353| TitledSingleSelectEnumSchema;23542355/**2356* Schema for multiple-selection enumeration without display titles for options.2357*2358* @category `elicitation/create`2359*/2360export interface UntitledMultiSelectEnumSchema {2361type: "array";2362/**2363* Optional title for the enum field.2364*/2365title?: string;2366/**2367* Optional description for the enum field.2368*/2369description?: string;2370/**2371* Minimum number of items to select.2372*/2373minItems?: number;2374/**2375* Maximum number of items to select.2376*/2377maxItems?: number;2378/**2379* Schema for the array items.2380*/2381items: {2382type: "string";2383/**2384* Array of enum values to choose from.2385*/2386enum: string[];2387};2388/**2389* Optional default value.2390*/2391default?: string[];2392}23932394/**2395* Schema for multiple-selection enumeration with display titles for each option.2396*2397* @category `elicitation/create`2398*/2399export interface TitledMultiSelectEnumSchema {2400type: "array";2401/**2402* Optional title for the enum field.2403*/2404title?: string;2405/**2406* Optional description for the enum field.2407*/2408description?: string;2409/**2410* Minimum number of items to select.2411*/2412minItems?: number;2413/**2414* Maximum number of items to select.2415*/2416maxItems?: number;2417/**2418* Schema for array items with enum options and display labels.2419*/2420items: {2421/**2422* Array of enum options with values and display labels.2423*/2424anyOf: Array<{2425/**2426* The constant enum value.2427*/2428const: string;2429/**2430* Display title for this option.2431*/2432title: string;2433}>;2434};2435/**2436* Optional default value.2437*/2438default?: string[];2439}24402441/**2442* @category `elicitation/create`2443*/2444// Combined multiple selection enumeration2445export type MultiSelectEnumSchema =2446| UntitledMultiSelectEnumSchema2447| TitledMultiSelectEnumSchema;24482449/**2450* Use TitledSingleSelectEnumSchema instead.2451* This interface will be removed in a future version.2452*2453* @category `elicitation/create`2454*/2455export interface LegacyTitledEnumSchema {2456type: "string";2457title?: string;2458description?: string;2459enum: string[];2460/**2461* (Legacy) Display names for enum values.2462* Non-standard according to JSON schema 2020-12.2463*/2464enumNames?: string[];2465default?: string;2466}24672468/**2469* @category `elicitation/create`2470*/2471// Union type for all enum schemas2472export type EnumSchema =2473| SingleSelectEnumSchema2474| MultiSelectEnumSchema2475| LegacyTitledEnumSchema;24762477/**2478* The client's response to an elicitation request.2479*2480* @category `elicitation/create`2481*/2482export interface ElicitResult extends Result {2483/**2484* The user action in response to the elicitation.2485* - "accept": User submitted the form/confirmed the action2486* - "decline": User explicitly decline the action2487* - "cancel": User dismissed without making an explicit choice2488*/2489action: "accept" | "decline" | "cancel";24902491/**2492* The submitted form data, only present when action is "accept" and mode was "form".2493* Contains values matching the requested schema.2494* Omitted for out-of-band mode responses.2495*/2496content?: { [key: string]: string | number | boolean | string[] };2497}24982499/**2500* An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.2501*2502* @category `notifications/elicitation/complete`2503*/2504export interface ElicitationCompleteNotification extends JSONRPCNotification {2505method: "notifications/elicitation/complete";2506params: {2507/**2508* The ID of the elicitation that completed.2509*/2510elicitationId: string;2511};2512}25132514/* Client messages */2515/** @internal */2516export type ClientRequest =2517| PingRequest2518| InitializeRequest2519| CompleteRequest2520| SetLevelRequest2521| GetPromptRequest2522| ListPromptsRequest2523| ListResourcesRequest2524| ListResourceTemplatesRequest2525| ReadResourceRequest2526| SubscribeRequest2527| UnsubscribeRequest2528| CallToolRequest2529| ListToolsRequest2530| GetTaskRequest2531| GetTaskPayloadRequest2532| ListTasksRequest2533| CancelTaskRequest;25342535/** @internal */2536export type ClientNotification =2537| CancelledNotification2538| ProgressNotification2539| InitializedNotification2540| RootsListChangedNotification2541| TaskStatusNotification;25422543/** @internal */2544export type ClientResult =2545| EmptyResult2546| CreateMessageResult2547| ListRootsResult2548| ElicitResult2549| GetTaskResult2550| GetTaskPayloadResult2551| ListTasksResult2552| CancelTaskResult;25532554/* Server messages */2555/** @internal */2556export type ServerRequest =2557| PingRequest2558| CreateMessageRequest2559| ListRootsRequest2560| ElicitRequest2561| GetTaskRequest2562| GetTaskPayloadRequest2563| ListTasksRequest2564| CancelTaskRequest;25652566/** @internal */2567export type ServerNotification =2568| CancelledNotification2569| ProgressNotification2570| LoggingMessageNotification2571| ResourceUpdatedNotification2572| ResourceListChangedNotification2573| ToolListChangedNotification2574| PromptListChangedNotification2575| ElicitationCompleteNotification2576| TaskStatusNotification;25772578/** @internal */2579export type ServerResult =2580| EmptyResult2581| InitializeResult2582| CompleteResult2583| GetPromptResult2584| ListPromptsResult2585| ListResourceTemplatesResult2586| ListResourcesResult2587| ReadResourceResult2588| CallToolResult2589| ListToolsResult2590| GetTaskResult2591| GetTaskPayloadResult2592| ListTasksResult2593| CancelTaskResult;2594}259525962597