***

title: "McpToolHandler"
generated: true
---------------

<GenerationInfo sourceFile="packages/mcp-sdk/src/mcp-tool.decorator.ts" sourceLine="189" packageName="@vendure/mcp-sdk" since="3.8.0" />

The shape of an MCP tool class: an `execute` method that the server calls with the
[RequestContext](/current/framework/reference/typescript-api/request/request-context#requestcontext), the input, and, when a tool needs to know who is calling,
[McpCallerInfo](/current/framework/reference/mcp-sdk/mcp-caller-info#mcpcallerinfo).

```ts title="Signature"
interface McpToolHandler<I = unknown, O = unknown> {
    execute(ctx: RequestContext, input: I, caller?: McpCallerInfo): Promise<O> | O;
}
```

<div className="members-wrapper">

### execute

\<MemberInfo kind="method" type={`(ctx: <a href='/current/framework/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, input: I, caller?: <a href='/current/framework/reference/mcp-sdk/mcp-caller-info#mcpcallerinfo'>McpCallerInfo</a>) => Promise<O> | O`}   />

The tool's implementation. The server calls it with a [RequestContext](/current/framework/reference/typescript-api/request/request-context#requestcontext) for the caller,
the validated input, and [McpCallerInfo](/current/framework/reference/mcp-sdk/mcp-caller-info#mcpcallerinfo). The caller info is always passed, though the
parameter is optional so a tool that ignores it can leave it out. Whatever the method
returns becomes the tool's result.

</div>
