MCP TypeScript SDK
    Preparing search index...

    Class UrlElicitationRequiredError

    Specialized error type when a tool requires a URL mode elicitation. This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • elicitations: {
            _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.

      • message: string = ...

      Returns UrlElicitationRequiredError

    Properties

    code: number
    data?: unknown
    message: string
    name: string
    stack?: string
    stackTraceLimit: number

    The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

    The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

    If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

    Accessors

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

      Returns {
          _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.

    Methods

    • Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

      const myObject = {};
      Error.captureStackTrace(myObject);
      myObject.stack; // Similar to `new Error().stack`

      The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

      The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

      The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

      function a() {
      b();
      }

      function b() {
      c();
      }

      function c() {
      // Create an error without stack trace to avoid calculating the stack trace twice.
      const { stackTraceLimit } = Error;
      Error.stackTraceLimit = 0;
      const error = new Error();
      Error.stackTraceLimit = stackTraceLimit;

      // Capture the stack trace above function b
      Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
      throw error;
      }

      a();

      Parameters

      • targetObject: object
      • OptionalconstructorOpt: Function

      Returns void

    • Factory method to create the appropriate error type based on the error code and data

      Parameters

      • code: number
      • message: string
      • Optionaldata: unknown

      Returns McpError