Skip to main content

Class Definition

Type Parameters

Properties

Abstract Method

execute(input)

The main execution method that must be implemented.

Methods

Response Methods

respond(value)

Set output and end execution immediately.

Notification Methods (MCP 2025-11-25)

notify(message, level?)

Send a log message notification to the client.

progress(progress, total?, message?)

Send a progress notification to the client.

notifyResourceUpdated(uri)

Notify subscribed clients that a resource’s contents changed. Sends notifications/resources/updated to every session subscribed to uri (via resources/subscribe); a no-op for sessions that aren’t subscribed. Call this after a tool mutates state that backs a @Resource so subscribers re-fetch.

notifyResourceListChanged()

Broadcast notifications/resources/list_changed so clients re-run resources/list. Call this when a tool adds or removes resources at runtime.

Elicitation Methods

elicit<S>(message, requestedSchema, options?)

Request interactive user input during execution.
Options: Result:
Usage:

Platform Detection

get platform

Detect the AI platform making the request.
Values: 'openai' | 'claude' | 'gemini' | 'cursor' | 'continue' | 'cody' | 'generic-mcp' | 'ext-apps' | 'unknown'

get clientInfo

Get client information.

History

Entries are HistoryEntry records, not bare values:

inputHistory

History of input changes during execution.

outputHistory

History of output changes during execution.

Full Example

@Tool

Tool decorator

ExecutionContextBase

Base class

ToolRegistry

Tool registry

Tool Errors

Tool errors