Type Alias MCPToolHandler<Input, Structured>
MCPToolHandler: (
input: Input,
context: MCPToolContext,
) => Promise<MCPToolResult<Structured>> | MCPToolResult<Structured>
input: Input,
context: MCPToolContext,
) => Promise<MCPToolResult<Structured>> | MCPToolResult<Structured>
Type Parameters
- Input extends Record<string, unknown> = Record<string, never>
Arguments the tool accepts, matching its inputSchema
- Structured extends Record<string, unknown> = Record<string, unknown>
Type of the structuredContent the tool returns
Type Declaration
- (
input: Input,
context: MCPToolContext,
): Promise<MCPToolResult<Structured>> | MCPToolResult<Structured> Parameters
- input: Input
- context: MCPToolContext
Returns Promise<MCPToolResult<Structured>> | MCPToolResult<Structured>
- (
Signature of an MCP tool's onCall function. Declare handlers using
satisfies MCPToolHandlerrather than asMCPToolHandlerto keep their inferred result type, so clients can use MCPToolOutput to get the type of their structuredContent