Class Definition
Type Parameters
| Parameter | Description |
|---|---|
InSchema | Input schema type (Zod shape) |
OutSchema | Output schema type |
In | Inferred input type |
Out | Inferred output type |
Properties
| Property | Type | Description |
|---|---|---|
metadata | ToolMetadata | Tool metadata (name, description, etc.) |
input | In | Parsed and validated input |
output | Out | undefined | Tool output (after execution) |
toolName | string | Tool name |
toolId | string | Tool ID (or name if not specified) |
platform | AIPlatformType | Detected AI platform |
clientInfo | ClientInfo | undefined | Client information |
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.Elicitation Methods
elicit<S>(message, requestedSchema, options?)
Request interactive user input during execution.| Option | Type | Description |
|---|---|---|
mode | 'form' | 'url' | Input mode |
ttl | number | Timeout in milliseconds |
Platform Detection
get platform
Detect the AI platform making the request.'openai' | 'claude' | 'gemini' | 'langchain' | 'vercel-ai' | 'unknown'
get clientInfo
Get client information.History
inputHistory
History of input changes during execution.outputHistory
History of output changes during execution.Full Example
Related
@Tool
Tool decorator
ExecutionContextBase
Base class
ToolRegistry
Tool registry
Tool Errors
Tool errors