MCP TypeScript SDK
    Preparing search index...

    Type Alias RequestHandlerExtra<SendRequestT, SendNotificationT>

    Extra data given to request handlers.

    type RequestHandlerExtra<
        SendRequestT extends Request,
        SendNotificationT extends Notification,
    > = {
        _meta?: RequestMeta;
        authInfo?: AuthInfo;
        closeSSEStream?: () => void;
        closeStandaloneSSEStream?: () => void;
        requestId: RequestId;
        requestInfo?: RequestInfo;
        sendNotification: (notification: SendNotificationT) => Promise<void>;
        sendRequest: <U extends AnySchema>(
            request: SendRequestT,
            resultSchema: U,
            options?: TaskRequestOptions,
        ) => Promise<SchemaOutput<U>>;
        sessionId?: string;
        signal: AbortSignal;
        taskId?: string;
        taskRequestedTtl?: number | null;
        taskStore?: RequestTaskStore;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    _meta?: RequestMeta

    Metadata from the original request.

    authInfo?: AuthInfo

    Information about a validated access token, provided to request handlers.

    closeSSEStream?: () => void

    Closes the SSE stream for this request, triggering client reconnection. Only available when using StreamableHTTPServerTransport with eventStore configured. Use this to implement polling behavior during long-running operations.

    closeStandaloneSSEStream?: () => void

    Closes the standalone GET SSE stream, triggering client reconnection. Only available when using StreamableHTTPServerTransport with eventStore configured. Use this to implement polling behavior for server-initiated notifications.

    requestId: RequestId

    The JSON-RPC ID of the request being handled. This can be useful for tracking or logging purposes.

    requestInfo?: RequestInfo

    The original HTTP request.

    sendNotification: (notification: SendNotificationT) => Promise<void>

    Sends a notification that relates to the current request being handled.

    This is used by certain transports to correctly associate related messages.

    sendRequest: <U extends AnySchema>(
        request: SendRequestT,
        resultSchema: U,
        options?: TaskRequestOptions,
    ) => Promise<SchemaOutput<U>>

    Sends a request that relates to the current request being handled.

    This is used by certain transports to correctly associate related messages.

    sessionId?: string

    The session ID from the transport, if available.

    signal: AbortSignal

    An abort signal used to communicate if the request was cancelled from the sender's side.

    taskId?: string
    taskRequestedTtl?: number | null
    taskStore?: RequestTaskStore