defineTool
@tsed/platform-mcp
Usage
typescript
import { defineTool } from "@tsed/platform-mcp";Overview
ts
function defineTool<Input, Output = undefined>(options: FnToolProps<Input, Output>): TokenProvider;
export function defineTool<Input, Output = undefined>(options: ClassToolProps<Input, Output>): TokenProvider;- options (
FnToolProps<Input): Functional or class-based tool configuration.
Description
Registers an MCP tool provider and wraps its handler with error logging plus schema conversion.
Usage
ts
defineTool({
name: "add",
handler: async ({a, b}) => ({content: [{type: "text", text: String(a + b)}]})
});