Interface: Tool
Defined in: tool.ts:33
An MCP tool: what it is and how it answers, independent of how a server
exposes it. registerTools registers a list of them, either one MCP
tool each or deferred behind search / describe / call.
Properties
_meta?
optional_meta?:Record<string,unknown>
Defined in: tool.ts:87
Tool metadata forwarded verbatim on tools/list. The MCP Apps extension
links a tool to its view through it: build the bag with
registerAppResource(...).toolMeta().
annotations?
optionalannotations?:object
Defined in: tool.ts:74
Behaviour hints forwarded on tools/list (readOnlyHint,
destructiveHint, idempotentHint, openWorldHint). Clients use them to
decide when to ask the user for confirmation; they never enforce anything.
description
description:
string
Defined in: tool.ts:39
What the tool does, written for the model.
handler
handler: (
args) => {[key:string]:unknown; } |Promise<{[key:string]:unknown; }>
Defined in: tool.ts:89
Answers a call with the (validated, when enforced) arguments.
Parameters
| Parameter | Type |
|---|---|
args | Record<string, unknown> |
Returns
{[key: string]: unknown; } | Promise<{[key: string]: unknown; }>
inputSchema?
optionalinputSchema?:ToolSchema
Defined in: tool.ts:50
The tool's input.
- A JSON Schema is advertised verbatim and enforced only with
validateArguments; the handler receives the raw arguments. - A Standard Schema (
z.object(...)) is always enforced; the handler receives its parsed output, defaults and coercions applied.
Default
{ type: 'object', properties: {} }
name
name:
string
Defined in: tool.ts:35
Unique tool name.
outputSchema?
optionaloutputSchema?:ToolSchema
Defined in: tool.ts:68
The result's schema, advertised on tools/list. A result's
structuredContent is validated against it.
summary?
optionalsummary?:string
Defined in: tool.ts:81
The line the deferred search shows for the tool. Defaults to the first
line of description. Not sent on tools/list.
tags?
optionaltags?:string[]
Defined in: tool.ts:76
Groups the tool for the deferred search filter. Not sent on tools/list.
title?
optionaltitle?:string
Defined in: tool.ts:37
Display name clients show instead of name.
validateArguments?
optionalvalidateArguments?:boolean
Defined in: tool.ts:63
Whether a JSON Schema inputSchema is enforced before the handler runs.
Enable it once the schema describes every value the tool genuinely
accepts. Schemas generated from an OpenAPI document are a common source of
incomplete ones — a field a client may send as null to clear it, or
one accepting several shapes, is easy to emit as a bare
{ type: 'string' } — and validating against them rejects calls the
underlying API would have accepted. A Standard Schema ignores this flag.
Default
false