MCP TypeScript SDK (V2)
    Preparing search index...

    An MCP server on top of a pluggable transport.

    This server will automatically respond to the initialization flow as initiated from the client.

    Use McpServer instead for the high-level API. Only use Server for advanced use cases.

    Hierarchy (View Summary)

    Index

    Constructors

    • Initializes this server with the given name and version information.

      Parameters

      • _serverInfo: {
            description?: string;
            icons?: {
                mimeType?: string;
                sizes?: string[];
                src: string;
                theme?: "light" | "dark";
            }[];
            name: string;
            title?: string;
            version: string;
            websiteUrl?: string;
        }
        • Optionaldescription?: string

          An optional human-readable description of what this implementation does.

          This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

        • Optionalicons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]

          Optional set of sized icons that the client can display in a user interface.

          Clients that support rendering icons MUST support at least the following MIME types:

          • image/png - PNG images (safe, universal compatibility)
          • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

          Clients that support rendering icons SHOULD also support:

          • image/svg+xml - SVG images (scalable but requires security precautions)
          • image/webp - WebP images (modern, efficient format)
        • name: string

          Intended for programmatic or logical use, but used as a display name in past specs or fallback

        • Optionaltitle?: string

          Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

          If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

        • version: string
        • OptionalwebsiteUrl?: string

          An optional URL of the website for this implementation.

      • Optionaloptions: ServerOptions

      Returns Server

    Properties

    _supportedProtocolVersions: string[]
    fallbackNotificationHandler?: (
        notification: {
            method: string;
            params?: {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        },
    ) => Promise<void>

    A handler to invoke for any notification types that do not have their own handler installed.

    fallbackRequestHandler?: (
        request: {
            id: string | number;
            jsonrpc: "2.0";
            method: string;
            params?: {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        },
        ctx: ServerContext,
    ) => Promise<
        {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            [key: string]: unknown;
        },
    >

    A handler to invoke for any request types that do not have their own handler installed.

    onclose?: () => void

    Callback for when the connection is closed for any reason.

    This is invoked when close() is called as well.

    onerror?: (error: Error) => void

    Callback for when an error occurs.

    Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.

    oninitialized?: () => void

    Callback for when initialization has fully completed (i.e., the client has sent an notifications/initialized notification).

    Accessors

    Methods

    • Experimental

      Cancels a specific task.

      Use client.experimental.tasks.cancelTask() to access this method.

      Parameters

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              createdAt: string;
              lastUpdatedAt: string;
              pollInterval?: number;
              status: | "working"
              | "input_required"
              | "completed"
              | "failed"
              | "cancelled";
              statusMessage?: string;
              taskId: string;
              ttl: number
              | null;
          },
      >

    • Creates a reusable callback that, when invoked, will send a notifications/elicitation/complete notification for the specified elicitation ID.

      Parameters

      • elicitationId: string

        The ID of the elicitation to mark as complete.

      • Optionaloptions: NotificationOptions

        Optional notification options. Useful when the completion notification should be related to a prior request.

      Returns () => Promise<void>

      A function that emits the completion notification when awaited.

    • Request LLM sampling from the client (without tools). Returns single content block for backwards compatibility.

      Parameters

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              content: | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  text: string;
                  type: "text";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "image";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "audio";
              };
              model: string;
              role: "user"
              | "assistant";
              stopReason?: string;
              [key: string]: unknown;
          },
      >

    • Request LLM sampling from the client with tool support. Returns content that may be a single block or array (for parallel tool calls).

      Parameters

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              content: | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  text: string;
                  type: "text";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "image";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "audio";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  id: string;
                  input: { [key: string]: unknown };
                  name: string;
                  type: "tool_use";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  content: (
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          text: string;
                          type: "text";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          data: string;
                          mimeType: string;
                          type: "image";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          data: string;
                          mimeType: string;
                          type: "audio";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          resource: | {
                              _meta?: { [key: ...]: ... };
                              mimeType?: string;
                              text: string;
                              uri: string;
                          }
                          | {
                              _meta?: { [key: ...]: ... };
                              blob: string;
                              mimeType?: string;
                              uri: string;
                          };
                          type: "resource";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          description?: string;
                          icons?: {
                              mimeType?: (...)
                              | (...);
                              sizes?: (...) | (...);
                              src: string;
                              theme?: (...) | (...) | (...);
                          }[];
                          mimeType?: string;
                          name: string;
                          title?: string;
                          type: "resource_link";
                          uri: string;
                      }
                  )[];
                  isError?: boolean;
                  structuredContent?: { [key: string]: unknown };
                  toolUseId: string;
                  type: "tool_result";
              }
              | (
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ((...) | (...))[];
                          lastModified?: string;
                          priority?: number;
                      };
                      text: string;
                      type: "text";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ((...) | (...))[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "image";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ((...) | (...))[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "audio";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      id: string;
                      input: { [key: string]: unknown };
                      name: string;
                      type: "tool_use";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      content: (
                          | {
                              _meta?: { [key: ...]: ... };
                              annotations?: { audience?: ...; lastModified?: ...; priority?: ... };
                              text: string;
                              type: "text";
                          }
                          | {
                              _meta?: { [key: ...]: ... };
                              annotations?: { audience?: ...; lastModified?: ...; priority?: ... };
                              data: string;
                              mimeType: string;
                              type: "image";
                          }
                          | {
                              _meta?: { [key: ...]: ... };
                              annotations?: { audience?: ...; lastModified?: ...; priority?: ... };
                              data: string;
                              mimeType: string;
                              type: "audio";
                          }
                          | {
                              _meta?: { [key: ...]: ... };
                              annotations?: { audience?: ...; lastModified?: ...; priority?: ... };
                              resource:
                                  | { _meta?: ...; mimeType?: ...; text: ...; uri: ... }
                                  | { _meta?: ...; blob: ...; mimeType?: ...; uri: ... };
                              type: "resource";
                          }
                          | {
                              _meta?: { [key: ...]: ... };
                              annotations?: { audience?: ...; lastModified?: ...; priority?: ... };
                              description?: string;
                              icons?: (...)[];
                              mimeType?: string;
                              name: string;
                              title?: string;
                              type: "resource_link";
                              uri: string;
                          }
                      )[];
                      isError?: boolean;
                      structuredContent?: { [key: string]: unknown };
                      toolUseId: string;
                      type: "tool_result";
                  }
              )[];
              model: string;
              role: "user"
              | "assistant";
              stopReason?: string;
              [key: string]: unknown;
          },
      >

    • Request LLM sampling from the client. When tools may or may not be present, returns the union type.

      Parameters

      • params: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            includeContext?: "none"
            | "thisServer"
            | "allServers";
            maxTokens: number;
            messages: {
                _meta?: { [key: string]: unknown };
                content:
                    | {
                        _meta?: { [key: string]: unknown };
                        annotations?: {
                            audience?: ("user" | "assistant")[];
                            lastModified?: string;
                            priority?: number;
                        };
                        text: string;
                        type: "text";
                    }
                    | {
                        _meta?: { [key: string]: unknown };
                        annotations?: {
                            audience?: ("user" | "assistant")[];
                            lastModified?: string;
                            priority?: number;
                        };
                        data: string;
                        mimeType: string;
                        type: "image";
                    }
                    | {
                        _meta?: { [key: string]: unknown };
                        annotations?: {
                            audience?: ("user" | "assistant")[];
                            lastModified?: string;
                            priority?: number;
                        };
                        data: string;
                        mimeType: string;
                        type: "audio";
                    }
                    | {
                        _meta?: { [key: string]: unknown };
                        id: string;
                        input: { [key: string]: unknown };
                        name: string;
                        type: "tool_use";
                    }
                    | {
                        _meta?: { [key: string]: unknown };
                        content: (
                            | {
                                _meta?: { [key: string]: unknown };
                                annotations?: {
                                    audience?: (...) | (...);
                                    lastModified?: (...) | (...);
                                    priority?: (...) | (...);
                                };
                                text: string;
                                type: "text";
                            }
                            | {
                                _meta?: { [key: string]: unknown };
                                annotations?: {
                                    audience?: (...) | (...);
                                    lastModified?: (...) | (...);
                                    priority?: (...) | (...);
                                };
                                data: string;
                                mimeType: string;
                                type: "image";
                            }
                            | {
                                _meta?: { [key: string]: unknown };
                                annotations?: {
                                    audience?: (...) | (...);
                                    lastModified?: (...) | (...);
                                    priority?: (...) | (...);
                                };
                                data: string;
                                mimeType: string;
                                type: "audio";
                            }
                            | {
                                _meta?: { [key: string]: unknown };
                                annotations?: {
                                    audience?: (...) | (...);
                                    lastModified?: (...) | (...);
                                    priority?: (...) | (...);
                                };
                                resource: | {
                                    _meta?: (...)
                                    | (...);
                                    mimeType?: (...) | (...);
                                    text: string;
                                    uri: string;
                                }
                                | {
                                    _meta?: (...)
                                    | (...);
                                    blob: string;
                                    mimeType?: (...) | (...);
                                    uri: string;
                                };
                                type: "resource";
                            }
                            | {
                                _meta?: { [key: string]: unknown };
                                annotations?: {
                                    audience?: (...) | (...);
                                    lastModified?: (...) | (...);
                                    priority?: (...) | (...);
                                };
                                description?: string;
                                icons?: { mimeType?: ...; sizes?: ...; src: ...; theme?: ... }[];
                                mimeType?: string;
                                name: string;
                                title?: string;
                                type: "resource_link";
                                uri: string;
                            }
                        )[];
                        isError?: boolean;
                        structuredContent?: { [key: string]: unknown };
                        toolUseId: string;
                        type: "tool_result";
                    }
                    | (
                        | {
                            _meta?: { [key: string]: unknown };
                            annotations?: {
                                audience?: (...)[];
                                lastModified?: string;
                                priority?: number;
                            };
                            text: string;
                            type: "text";
                        }
                        | {
                            _meta?: { [key: string]: unknown };
                            annotations?: {
                                audience?: (...)[];
                                lastModified?: string;
                                priority?: number;
                            };
                            data: string;
                            mimeType: string;
                            type: "image";
                        }
                        | {
                            _meta?: { [key: string]: unknown };
                            annotations?: {
                                audience?: (...)[];
                                lastModified?: string;
                                priority?: number;
                            };
                            data: string;
                            mimeType: string;
                            type: "audio";
                        }
                        | {
                            _meta?: { [key: string]: unknown };
                            id: string;
                            input: { [key: string]: unknown };
                            name: string;
                            type: "tool_use";
                        }
                        | {
                            _meta?: { [key: string]: unknown };
                            content: (
                                | {
                                    _meta?: (...)
                                    | (...);
                                    annotations?: (...) | (...);
                                    text: string;
                                    type: "text";
                                }
                                | {
                                    _meta?: (...)
                                    | (...);
                                    annotations?: (...) | (...);
                                    data: string;
                                    mimeType: string;
                                    type: "image";
                                }
                                | {
                                    _meta?: (...)
                                    | (...);
                                    annotations?: (...) | (...);
                                    data: string;
                                    mimeType: string;
                                    type: "audio";
                                }
                                | {
                                    _meta?: (...)
                                    | (...);
                                    annotations?: (...) | (...);
                                    resource: (...) | (...);
                                    type: "resource";
                                }
                                | {
                                    _meta?: (...)
                                    | (...);
                                    annotations?: (...) | (...);
                                    description?: (...) | (...);
                                    icons?: (...) | (...);
                                    mimeType?: (...) | (...);
                                    name: string;
                                    title?: (...) | (...);
                                    type: "resource_link";
                                    uri: string;
                                }
                            )[];
                            isError?: boolean;
                            structuredContent?: { [key: string]: unknown };
                            toolUseId: string;
                            type: "tool_result";
                        }
                    )[];
                role: "user"
                | "assistant";
            }[];
            metadata?: object;
            modelPreferences?: {
                costPriority?: number;
                hints?: { name?: string }[];
                intelligencePriority?: number;
                speedPriority?: number;
            };
            stopSequences?: string[];
            systemPrompt?: string;
            task?: { ttl?: number };
            temperature?: number;
            toolChoice?: { mode?: "required" | "auto" | "none" };
            tools?: {
                _meta?: { [key: string]: unknown };
                annotations?: {
                    destructiveHint?: boolean;
                    idempotentHint?: boolean;
                    openWorldHint?: boolean;
                    readOnlyHint?: boolean;
                    title?: string;
                };
                description?: string;
                execution?: { taskSupport?: "optional"
                | "required"
                | "forbidden" };
                icons?: {
                    mimeType?: string;
                    sizes?: string[];
                    src: string;
                    theme?: "light" | "dark";
                }[];
                inputSchema: {
                    properties?: { [key: string]: object };
                    required?: string[];
                    type: "object";
                    [key: string]: unknown;
                };
                name: string;
                outputSchema?: {
                    properties?: { [key: string]: object };
                    required?: string[];
                    type: "object";
                    [key: string]: unknown;
                };
                title?: string;
            }[];
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See General fields: _meta for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

        • OptionalincludeContext?: "none" | "thisServer" | "allServers"

          A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.

          Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.

        • maxTokens: number

          The requested maximum number of tokens to sample (to prevent runaway completions).

          The client MAY choose to sample fewer tokens than the requested maximum.

        • messages: {
              _meta?: { [key: string]: unknown };
              content:
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ("user" | "assistant")[];
                          lastModified?: string;
                          priority?: number;
                      };
                      text: string;
                      type: "text";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ("user" | "assistant")[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "image";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: ("user" | "assistant")[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "audio";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      id: string;
                      input: { [key: string]: unknown };
                      name: string;
                      type: "tool_use";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      content: (
                          | {
                              _meta?: { [key: string]: unknown };
                              annotations?: {
                                  audience?: (...) | (...);
                                  lastModified?: (...) | (...);
                                  priority?: (...) | (...);
                              };
                              text: string;
                              type: "text";
                          }
                          | {
                              _meta?: { [key: string]: unknown };
                              annotations?: {
                                  audience?: (...) | (...);
                                  lastModified?: (...) | (...);
                                  priority?: (...) | (...);
                              };
                              data: string;
                              mimeType: string;
                              type: "image";
                          }
                          | {
                              _meta?: { [key: string]: unknown };
                              annotations?: {
                                  audience?: (...) | (...);
                                  lastModified?: (...) | (...);
                                  priority?: (...) | (...);
                              };
                              data: string;
                              mimeType: string;
                              type: "audio";
                          }
                          | {
                              _meta?: { [key: string]: unknown };
                              annotations?: {
                                  audience?: (...) | (...);
                                  lastModified?: (...) | (...);
                                  priority?: (...) | (...);
                              };
                              resource: | {
                                  _meta?: (...)
                                  | (...);
                                  mimeType?: (...) | (...);
                                  text: string;
                                  uri: string;
                              }
                              | {
                                  _meta?: (...)
                                  | (...);
                                  blob: string;
                                  mimeType?: (...) | (...);
                                  uri: string;
                              };
                              type: "resource";
                          }
                          | {
                              _meta?: { [key: string]: unknown };
                              annotations?: {
                                  audience?: (...) | (...);
                                  lastModified?: (...) | (...);
                                  priority?: (...) | (...);
                              };
                              description?: string;
                              icons?: { mimeType?: ...; sizes?: ...; src: ...; theme?: ... }[];
                              mimeType?: string;
                              name: string;
                              title?: string;
                              type: "resource_link";
                              uri: string;
                          }
                      )[];
                      isError?: boolean;
                      structuredContent?: { [key: string]: unknown };
                      toolUseId: string;
                      type: "tool_result";
                  }
                  | (
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          text: string;
                          type: "text";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          data: string;
                          mimeType: string;
                          type: "image";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...)[];
                              lastModified?: string;
                              priority?: number;
                          };
                          data: string;
                          mimeType: string;
                          type: "audio";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          id: string;
                          input: { [key: string]: unknown };
                          name: string;
                          type: "tool_use";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          content: (
                              | {
                                  _meta?: (...)
                                  | (...);
                                  annotations?: (...) | (...);
                                  text: string;
                                  type: "text";
                              }
                              | {
                                  _meta?: (...)
                                  | (...);
                                  annotations?: (...) | (...);
                                  data: string;
                                  mimeType: string;
                                  type: "image";
                              }
                              | {
                                  _meta?: (...)
                                  | (...);
                                  annotations?: (...) | (...);
                                  data: string;
                                  mimeType: string;
                                  type: "audio";
                              }
                              | {
                                  _meta?: (...)
                                  | (...);
                                  annotations?: (...) | (...);
                                  resource: (...) | (...);
                                  type: "resource";
                              }
                              | {
                                  _meta?: (...)
                                  | (...);
                                  annotations?: (...) | (...);
                                  description?: (...) | (...);
                                  icons?: (...) | (...);
                                  mimeType?: (...) | (...);
                                  name: string;
                                  title?: (...) | (...);
                                  type: "resource_link";
                                  uri: string;
                              }
                          )[];
                          isError?: boolean;
                          structuredContent?: { [key: string]: unknown };
                          toolUseId: string;
                          type: "tool_result";
                      }
                  )[];
              role: "user"
              | "assistant";
          }[]
        • Optionalmetadata?: object

          Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.

        • OptionalmodelPreferences?: {
              costPriority?: number;
              hints?: { name?: string }[];
              intelligencePriority?: number;
              speedPriority?: number;
          }

          The server's preferences for which model to select. The client MAY modify or omit this request.

          • OptionalcostPriority?: number

            How much to prioritize cost when selecting a model.

          • Optionalhints?: { name?: string }[]

            Optional hints to use for model selection.

          • OptionalintelligencePriority?: number

            How much to prioritize intelligence and capabilities when selecting a model.

          • OptionalspeedPriority?: number

            How much to prioritize sampling speed (latency) when selecting a model.

        • OptionalstopSequences?: string[]
        • OptionalsystemPrompt?: string

          An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.

        • Optionaltask?: { ttl?: number }

          If specified, the caller is requesting task-augmented execution for this request. The request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.

          Task augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities.

        • Optionaltemperature?: number
        • OptionaltoolChoice?: { mode?: "required" | "auto" | "none" }

          Controls how the model uses tools. The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. Default is { mode: "auto" }.

          • Optionalmode?: "required" | "auto" | "none"

            Controls when tools are used:

            • "auto": Model decides whether to use tools (default)
            • "required": Model MUST use at least one tool before completing
            • "none": Model MUST NOT use any tools
        • Optionaltools?: {
              _meta?: { [key: string]: unknown };
              annotations?: {
                  destructiveHint?: boolean;
                  idempotentHint?: boolean;
                  openWorldHint?: boolean;
                  readOnlyHint?: boolean;
                  title?: string;
              };
              description?: string;
              execution?: { taskSupport?: "optional"
              | "required"
              | "forbidden" };
              icons?: {
                  mimeType?: string;
                  sizes?: string[];
                  src: string;
                  theme?: "light" | "dark";
              }[];
              inputSchema: {
                  properties?: { [key: string]: object };
                  required?: string[];
                  type: "object";
                  [key: string]: unknown;
              };
              name: string;
              outputSchema?: {
                  properties?: { [key: string]: object };
                  required?: string[];
                  type: "object";
                  [key: string]: unknown;
              };
              title?: string;
          }[]

          Tools that the model may use during generation. The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.

      • Optionaloptions: RequestOptions

      Returns Promise<
          | {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              content: | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  text: string;
                  type: "text";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "image";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "audio";
              };
              model: string;
              role: "user"
              | "assistant";
              stopReason?: string;
              [key: string]: unknown;
          }
          | {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              content: | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  text: string;
                  type: "text";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "image";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  annotations?: {
                      audience?: ("user" | "assistant")[];
                      lastModified?: string;
                      priority?: number;
                  };
                  data: string;
                  mimeType: string;
                  type: "audio";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  id: string;
                  input: { [key: string]: unknown };
                  name: string;
                  type: "tool_use";
              }
              | {
                  _meta?: { [key: string]: unknown };
                  content: (
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...) | (...);
                              lastModified?: (...) | (...);
                              priority?: (...) | (...);
                          };
                          text: string;
                          type: "text";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...) | (...);
                              lastModified?: (...) | (...);
                              priority?: (...) | (...);
                          };
                          data: string;
                          mimeType: string;
                          type: "image";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...) | (...);
                              lastModified?: (...) | (...);
                              priority?: (...) | (...);
                          };
                          data: string;
                          mimeType: string;
                          type: "audio";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...) | (...);
                              lastModified?: (...) | (...);
                              priority?: (...) | (...);
                          };
                          resource: | {
                              _meta?: (...)
                              | (...);
                              mimeType?: (...) | (...);
                              text: string;
                              uri: string;
                          }
                          | {
                              _meta?: (...)
                              | (...);
                              blob: string;
                              mimeType?: (...) | (...);
                              uri: string;
                          };
                          type: "resource";
                      }
                      | {
                          _meta?: { [key: string]: unknown };
                          annotations?: {
                              audience?: (...) | (...);
                              lastModified?: (...) | (...);
                              priority?: (...) | (...);
                          };
                          description?: string;
                          icons?: { mimeType?: ...; sizes?: ...; src: ...; theme?: ... }[];
                          mimeType?: string;
                          name: string;
                          title?: string;
                          type: "resource_link";
                          uri: string;
                      }
                  )[];
                  isError?: boolean;
                  structuredContent?: { [key: string]: unknown };
                  toolUseId: string;
                  type: "tool_result";
              }
              | (
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: (...)[];
                          lastModified?: string;
                          priority?: number;
                      };
                      text: string;
                      type: "text";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: (...)[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "image";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      annotations?: {
                          audience?: (...)[];
                          lastModified?: string;
                          priority?: number;
                      };
                      data: string;
                      mimeType: string;
                      type: "audio";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      id: string;
                      input: { [key: string]: unknown };
                      name: string;
                      type: "tool_use";
                  }
                  | {
                      _meta?: { [key: string]: unknown };
                      content: (
                          | {
                              _meta?: (...)
                              | (...);
                              annotations?: (...) | (...);
                              text: string;
                              type: "text";
                          }
                          | {
                              _meta?: (...)
                              | (...);
                              annotations?: (...) | (...);
                              data: string;
                              mimeType: string;
                              type: "image";
                          }
                          | {
                              _meta?: (...)
                              | (...);
                              annotations?: (...) | (...);
                              data: string;
                              mimeType: string;
                              type: "audio";
                          }
                          | {
                              _meta?: (...)
                              | (...);
                              annotations?: (...) | (...);
                              resource: (...) | (...);
                              type: "resource";
                          }
                          | {
                              _meta?: (...)
                              | (...);
                              annotations?: (...) | (...);
                              description?: (...) | (...);
                              icons?: (...) | (...);
                              mimeType?: (...) | (...);
                              name: string;
                              title?: (...) | (...);
                              type: "resource_link";
                              uri: string;
                          }
                      )[];
                      isError?: boolean;
                      structuredContent?: { [key: string]: unknown };
                      toolUseId: string;
                      type: "tool_result";
                  }
              )[];
              model: string;
              role: "user"
              | "assistant";
              stopReason?: string;
              [key: string]: unknown;
          },
      >

    • Creates an elicitation request for the given parameters. For backwards compatibility, mode may be omitted for form requests and will default to "form".

      Parameters

      • params:
            | {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                elicitationId: string;
                message: string;
                mode: "url";
                task?: { ttl?: number };
                url: string;
            }
            | {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                message: string;
                mode?: "form";
                requestedSchema: {
                    properties: {
                        [key: string]: | {
                            default?: boolean;
                            description?: string;
                            title?: string;
                            type: "boolean";
                        }
                        | {
                            default?: string;
                            description?: string;
                            format?: "email"
                            | "date"
                            | "uri"
                            | "date-time";
                            maxLength?: number;
                            minLength?: number;
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: number;
                            description?: string;
                            maximum?: number;
                            minimum?: number;
                            title?: string;
                            type: "number"
                            | "integer";
                        }
                        | {
                            default?: string;
                            description?: string;
                            enum: string[];
                            enumNames?: string[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string;
                            description?: string;
                            enum: string[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string;
                            description?: string;
                            oneOf: { const: string; title: string }[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string[];
                            description?: string;
                            items: { enum: string[]; type: "string" };
                            maxItems?: number;
                            minItems?: number;
                            title?: string;
                            type: "array";
                        }
                        | {
                            default?: string[];
                            description?: string;
                            items: { anyOf: { const: string; title: string }[] };
                            maxItems?: number;
                            minItems?: number;
                            title?: string;
                            type: "array";
                        };
                    };
                    required?: string[];
                    type: "object";
                };
                task?: { ttl?: number };
            }

        The parameters for the elicitation request.

        • {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              elicitationId: string;
              message: string;
              mode: "url";
              task?: { ttl?: number };
              url: string;
          }
          • Optional_meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            }

            See General fields: _meta for notes on _meta usage.

            • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

              If specified, this request is related to the provided task.

            • OptionalprogressToken?: string | number

              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.

          • elicitationId: 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.

          • message: string

            The message to present to the user explaining why the interaction is needed.

          • mode: "url"

            The elicitation mode.

          • Optionaltask?: { ttl?: number }

            If specified, the caller is requesting task-augmented execution for this request. The request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.

            Task augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities.

          • url: string

            The URL that the user should navigate to.

        • {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              message: string;
              mode?: "form";
              requestedSchema: {
                  properties: {
                      [key: string]: | {
                          default?: boolean;
                          description?: string;
                          title?: string;
                          type: "boolean";
                      }
                      | {
                          default?: string;
                          description?: string;
                          format?: "email"
                          | "date"
                          | "uri"
                          | "date-time";
                          maxLength?: number;
                          minLength?: number;
                          title?: string;
                          type: "string";
                      }
                      | {
                          default?: number;
                          description?: string;
                          maximum?: number;
                          minimum?: number;
                          title?: string;
                          type: "number"
                          | "integer";
                      }
                      | {
                          default?: string;
                          description?: string;
                          enum: string[];
                          enumNames?: string[];
                          title?: string;
                          type: "string";
                      }
                      | {
                          default?: string;
                          description?: string;
                          enum: string[];
                          title?: string;
                          type: "string";
                      }
                      | {
                          default?: string;
                          description?: string;
                          oneOf: { const: string; title: string }[];
                          title?: string;
                          type: "string";
                      }
                      | {
                          default?: string[];
                          description?: string;
                          items: { enum: string[]; type: "string" };
                          maxItems?: number;
                          minItems?: number;
                          title?: string;
                          type: "array";
                      }
                      | {
                          default?: string[];
                          description?: string;
                          items: { anyOf: { const: string; title: string }[] };
                          maxItems?: number;
                          minItems?: number;
                          title?: string;
                          type: "array";
                      };
                  };
                  required?: string[];
                  type: "object";
              };
              task?: { ttl?: number };
          }
          • Optional_meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            }

            See General fields: _meta for notes on _meta usage.

            • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

              If specified, this request is related to the provided task.

            • OptionalprogressToken?: string | number

              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.

          • message: string

            The message to present to the user describing what information is being requested.

          • Optionalmode?: "form"

            The elicitation mode.

            Optional for backward compatibility. Clients MUST treat missing mode as "form".

          • requestedSchema: {
                properties: {
                    [key: string]:
                        | {
                            default?: boolean;
                            description?: string;
                            title?: string;
                            type: "boolean";
                        }
                        | {
                            default?: string;
                            description?: string;
                            format?: "email"
                            | "date"
                            | "uri"
                            | "date-time";
                            maxLength?: number;
                            minLength?: number;
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: number;
                            description?: string;
                            maximum?: number;
                            minimum?: number;
                            title?: string;
                            type: "number"
                            | "integer";
                        }
                        | {
                            default?: string;
                            description?: string;
                            enum: string[];
                            enumNames?: string[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string;
                            description?: string;
                            enum: string[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string;
                            description?: string;
                            oneOf: { const: string; title: string }[];
                            title?: string;
                            type: "string";
                        }
                        | {
                            default?: string[];
                            description?: string;
                            items: { enum: string[]; type: "string" };
                            maxItems?: number;
                            minItems?: number;
                            title?: string;
                            type: "array";
                        }
                        | {
                            default?: string[];
                            description?: string;
                            items: { anyOf: { const: string; title: string }[] };
                            maxItems?: number;
                            minItems?: number;
                            title?: string;
                            type: "array";
                        };
                };
                required?: string[];
                type: "object";
            }

            A restricted subset of JSON Schema. Only top-level properties are allowed, without nesting.

          • Optionaltask?: { ttl?: number }

            If specified, the caller is requesting task-augmented execution for this request. The request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.

            Task augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities.

      • Optionaloptions: RequestOptions

        Optional request options.

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              action: "cancel"
              | "accept"
              | "decline";
              content?: { [key: string]: string | number | boolean | string[] };
              [key: string]: unknown;
          },
      >

      The result of the elicitation request.

    • Returns the current server capabilities.

      Returns {
          completions?: object;
          experimental?: { [key: string]: object };
          logging?: object;
          prompts?: { listChanged?: boolean };
          resources?: { listChanged?: boolean; subscribe?: boolean };
          tasks?: {
              cancel?: object;
              list?: object;
              requests?: {
                  tools?: { call?: object; [key: string]: unknown };
                  [key: string]: unknown;
              };
              [key: string]: unknown;
          };
          tools?: { listChanged?: boolean };
      }

      • Optionalcompletions?: object

        Present if the server supports sending completions to the client.

      • Optionalexperimental?: { [key: string]: object }

        Experimental, non-standard capabilities that the server supports.

      • Optionallogging?: object

        Present if the server supports sending log messages to the client.

      • Optionalprompts?: { listChanged?: boolean }

        Present if the server offers any prompt templates.

        • OptionallistChanged?: boolean

          Whether this server supports issuing notifications for changes to the prompt list.

      • Optionalresources?: { listChanged?: boolean; subscribe?: boolean }

        Present if the server offers any resources to read.

        • OptionallistChanged?: boolean

          Whether this server supports issuing notifications for changes to the resource list.

        • Optionalsubscribe?: boolean

          Whether this server supports clients subscribing to resource updates.

      • Optionaltasks?: {
            cancel?: object;
            list?: object;
            requests?: {
                tools?: { call?: object; [key: string]: unknown };
                [key: string]: unknown;
            };
            [key: string]: unknown;
        }

        Present if the server supports task creation.

        • Optionalcancel?: object

          Present if the server supports cancelling tasks.

        • Optionallist?: object

          Present if the server supports listing tasks.

        • Optionalrequests?: { tools?: { call?: object; [key: string]: unknown }; [key: string]: unknown }

          Capabilities for task creation on specific request types.

          • Optionaltools?: { call?: object; [key: string]: unknown }

            Task support for tool requests.

      • Optionaltools?: { listChanged?: boolean }

        Present if the server offers any tools to call.

        • OptionallistChanged?: boolean

          Whether this server supports issuing notifications for changes to the tool list.

    • After initialization has completed, this will be populated with the client's reported capabilities.

      Returns
          | {
              elicitation?: {
                  form?: { applyDefaults?: boolean; [key: string]: unknown };
                  url?: object;
                  [key: string]: unknown;
              };
              experimental?: { [key: string]: object };
              roots?: { listChanged?: boolean };
              sampling?: { context?: object; tools?: object };
              tasks?: {
                  cancel?: object;
                  list?: object;
                  requests?: {
                      elicitation?: { create?: object; [key: string]: unknown };
                      sampling?: { createMessage?: object; [key: string]: unknown };
                      [key: string]: unknown;
                  };
                  [key: string]: unknown;
              };
          }
          | undefined

      • {
            elicitation?: {
                form?: { applyDefaults?: boolean; [key: string]: unknown };
                url?: object;
                [key: string]: unknown;
            };
            experimental?: { [key: string]: object };
            roots?: { listChanged?: boolean };
            sampling?: { context?: object; tools?: object };
            tasks?: {
                cancel?: object;
                list?: object;
                requests?: {
                    elicitation?: { create?: object; [key: string]: unknown };
                    sampling?: { createMessage?: object; [key: string]: unknown };
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        }
        • Optionalelicitation?: {
              form?: { applyDefaults?: boolean; [key: string]: unknown };
              url?: object;
              [key: string]: unknown;
          }

          Present if the client supports eliciting user input.

        • Optionalexperimental?: { [key: string]: object }

          Experimental, non-standard capabilities that the client supports.

        • Optionalroots?: { listChanged?: boolean }

          Present if the client supports listing roots.

          • OptionallistChanged?: boolean

            Whether the client supports issuing notifications for changes to the roots list.

        • Optionalsampling?: { context?: object; tools?: object }

          Present if the client supports sampling from an LLM.

          • Optionalcontext?: object

            Present if the client supports context inclusion via includeContext parameter. If not declared, servers SHOULD only use includeContext: "none" (or omit it).

          • Optionaltools?: object

            Present if the client supports tool use via tools and toolChoice parameters.

        • Optionaltasks?: {
              cancel?: object;
              list?: object;
              requests?: {
                  elicitation?: { create?: object; [key: string]: unknown };
                  sampling?: { createMessage?: object; [key: string]: unknown };
                  [key: string]: unknown;
              };
              [key: string]: unknown;
          }

          Present if the client supports task creation.

          • Optionalcancel?: object

            Present if the client supports cancelling tasks.

          • Optionallist?: object

            Present if the client supports listing tasks.

          • Optionalrequests?: {
                elicitation?: { create?: object; [key: string]: unknown };
                sampling?: { createMessage?: object; [key: string]: unknown };
                [key: string]: unknown;
            }

            Capabilities for task creation on specific request types.

            • Optionalelicitation?: { create?: object; [key: string]: unknown }

              Task support for elicitation requests.

            • Optionalsampling?: { createMessage?: object; [key: string]: unknown }

              Task support for sampling requests.

      • undefined
    • After initialization has completed, this will be populated with information about the client's name and version.

      Returns
          | {
              description?: string;
              icons?: {
                  mimeType?: string;
                  sizes?: string[];
                  src: string;
                  theme?: "light"
                  | "dark";
              }[];
              name: string;
              title?: string;
              version: string;
              websiteUrl?: string;
          }
          | undefined

      • {
            description?: string;
            icons?: {
                mimeType?: string;
                sizes?: string[];
                src: string;
                theme?: "light" | "dark";
            }[];
            name: string;
            title?: string;
            version: string;
            websiteUrl?: string;
        }
        • Optionaldescription?: string

          An optional human-readable description of what this implementation does.

          This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

        • Optionalicons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]

          Optional set of sized icons that the client can display in a user interface.

          Clients that support rendering icons MUST support at least the following MIME types:

          • image/png - PNG images (safe, universal compatibility)
          • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

          Clients that support rendering icons SHOULD also support:

          • image/svg+xml - SVG images (scalable but requires security precautions)
          • image/webp - WebP images (modern, efficient format)
        • name: string

          Intended for programmatic or logical use, but used as a display name in past specs or fallback

        • Optionaltitle?: string

          Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

          If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

        • version: string
        • OptionalwebsiteUrl?: string

          An optional URL of the website for this implementation.

      • undefined
    • Experimental

      Gets the current status of a task.

      Use client.experimental.tasks.getTask() to access this method.

      Parameters

      • params: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            taskId: string;
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See General fields: _meta for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

        • taskId: string
      • Optionaloptions: RequestOptions

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              createdAt: string;
              lastUpdatedAt: string;
              pollInterval?: number;
              status: | "working"
              | "input_required"
              | "completed"
              | "failed"
              | "cancelled";
              statusMessage?: string;
              taskId: string;
              ttl: number
              | null;
          },
      >

    • Experimental

      Retrieves the result of a completed task.

      Use client.experimental.tasks.getTaskResult() to access this method.

      Type Parameters

      Parameters

      • params: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            taskId: string;
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See General fields: _meta for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

        • taskId: string
      • resultSchema: T
      • Optionaloptions: RequestOptions

      Returns Promise<SchemaOutput<T>>

    • Parameters

      • Optionalparams: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See General fields: _meta for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

      • Optionaloptions: RequestOptions

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              roots: { _meta?: Record<string, unknown>; name?: string; uri: string }[];
              [key: string]: unknown;
          },
      >

    • Experimental

      Lists tasks, optionally starting from a pagination cursor.

      Use client.experimental.tasks.listTasks() to access this method.

      Parameters

      Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
              nextCursor?: string;
              tasks: {
                  createdAt: string;
                  lastUpdatedAt: string;
                  pollInterval?: number;
                  status: | "working"
                  | "input_required"
                  | "completed"
                  | "failed"
                  | "cancelled";
                  statusMessage?: string;
                  taskId: string;
                  ttl: number
                  | null;
              }[];
              [key: string]: unknown;
          },
      >

    • Emits a notification, which is a one-way message that does not expect a response.

      Parameters

      • notification: {
            method: string;
            params?: {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        }
      • Optionaloptions: NotificationOptions

      Returns Promise<void>

    • Returns Promise<
          {
              _meta?: {
                  "io.modelcontextprotocol/related-task"?: { taskId: string };
                  progressToken?: string | number;
                  [key: string]: unknown;
              };
          },
      >

    • Registers new capabilities. This can only be called before connecting to a transport.

      The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).

      Parameters

      • capabilities: {
            completions?: object;
            experimental?: { [key: string]: object };
            logging?: object;
            prompts?: { listChanged?: boolean };
            resources?: { listChanged?: boolean; subscribe?: boolean };
            tasks?: {
                cancel?: object;
                list?: object;
                requests?: {
                    tools?: { call?: object; [key: string]: unknown };
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
            tools?: { listChanged?: boolean };
        }
        • Optionalcompletions?: object

          Present if the server supports sending completions to the client.

        • Optionalexperimental?: { [key: string]: object }

          Experimental, non-standard capabilities that the server supports.

        • Optionallogging?: object

          Present if the server supports sending log messages to the client.

        • Optionalprompts?: { listChanged?: boolean }

          Present if the server offers any prompt templates.

          • OptionallistChanged?: boolean

            Whether this server supports issuing notifications for changes to the prompt list.

        • Optionalresources?: { listChanged?: boolean; subscribe?: boolean }

          Present if the server offers any resources to read.

          • OptionallistChanged?: boolean

            Whether this server supports issuing notifications for changes to the resource list.

          • Optionalsubscribe?: boolean

            Whether this server supports clients subscribing to resource updates.

        • Optionaltasks?: {
              cancel?: object;
              list?: object;
              requests?: {
                  tools?: { call?: object; [key: string]: unknown };
                  [key: string]: unknown;
              };
              [key: string]: unknown;
          }

          Present if the server supports task creation.

          • Optionalcancel?: object

            Present if the server supports cancelling tasks.

          • Optionallist?: object

            Present if the server supports listing tasks.

          • Optionalrequests?: { tools?: { call?: object; [key: string]: unknown }; [key: string]: unknown }

            Capabilities for task creation on specific request types.

            • Optionaltools?: { call?: object; [key: string]: unknown }

              Task support for tool requests.

        • Optionaltools?: { listChanged?: boolean }

          Present if the server offers any tools to call.

          • OptionallistChanged?: boolean

            Whether this server supports issuing notifications for changes to the tool list.

      Returns void

    • Sends a request and waits for a response.

      Do not use this method to emit notifications! Use notification() instead.

      Type Parameters

      Parameters

      • request: {
            method: string;
            params?: {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        }
      • resultSchema: T
      • Optionaloptions: RequestOptions

      Returns Promise<SchemaOutput<T>>

    • Experimental

      Sends a request and returns an AsyncGenerator that yields response messages. The generator is guaranteed to end with either a 'result' or 'error' message.

      Use client.experimental.tasks.requestStream() to access this method.

      Type Parameters

      Parameters

      • request: {
            method: string;
            params?: {
                _meta?: {
                    "io.modelcontextprotocol/related-task"?: { taskId: string };
                    progressToken?: string | number;
                    [key: string]: unknown;
                };
                [key: string]: unknown;
            };
        }
      • resultSchema: T
      • Optionaloptions: RequestOptions

      Returns AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>

    • Sends a logging message to the client, if connected. Note: You only need to send the parameters object, not the entire JSON-RPC message.

      Parameters

      • params: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            data: unknown;
            level: | "debug"
            | "error"
            | "info"
            | "notice"
            | "warning"
            | "critical"
            | "alert"
            | "emergency";
            logger?: string;
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See MCP specification for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

        • data: unknown

          The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.

        • level:
              | "debug"
              | "error"
              | "info"
              | "notice"
              | "warning"
              | "critical"
              | "alert"
              | "emergency"

          The severity of this log message.

        • Optionallogger?: string

          An optional name of the logger issuing this message.

      • OptionalsessionId: string

        Optional for stateless transports and backward compatibility.

      Returns Promise<void>

    • Parameters

      • params: {
            _meta?: {
                "io.modelcontextprotocol/related-task"?: { taskId: string };
                progressToken?: string | number;
                [key: string]: unknown;
            };
            uri: string;
        }
        • Optional_meta?: {
              "io.modelcontextprotocol/related-task"?: { taskId: string };
              progressToken?: string | number;
              [key: string]: unknown;
          }

          See MCP specification for notes on _meta usage.

          • Optionalio.modelcontextprotocol/related-task?: { taskId: string }

            If specified, this request is related to the provided task.

          • OptionalprogressToken?: string | number

            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.

        • uri: string

          The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.

      Returns Promise<void>