Skip to main content

Interface: RegisterToolFromSchemaParams

Defined in: registerToolFromSchema.ts:25

Parameters accepted by registerToolFromSchema.

Properties

_meta?

optional _meta?: Record<string, unknown>

Defined in: registerToolFromSchema.ts:67

Tool metadata forwarded verbatim on tools/list.

The MCP Apps extension links a tool to the view its result is rendered with through this field; build the bag with toolMeta() from registerAppResource rather than writing the keys by hand.

Example

_meta: dashboard.toolMeta({ visibility: ['app'] }),

description?

optional description?: string

Defined in: registerToolFromSchema.ts:29

Human-readable description shown to the AI client.


handler

handler: (args) => {[key: string]: unknown; } | Promise<{[key: string]: unknown; }>

Defined in: registerToolFromSchema.ts:73

Tool handler invoked when the AI client calls the tool. Receives the request arguments, validated against inputSchema only when validateArguments is enabled.

Parameters

ParameterType
argsRecord<string, unknown>

Returns

{[key: string]: unknown; } | Promise<{[key: string]: unknown; }>


inputSchema?

optional inputSchema?: JsonObjectSchema

Defined in: registerToolFromSchema.ts:36

Plain JSON Schema that describes the tool's input object. This schema is forwarded verbatim over the MCP wire protocol, so any JSON Schema feature (anyOf, $ref, pattern, …) is preserved without loss. Defaults to { type: 'object', properties: {} } when omitted.


name

name: string

Defined in: registerToolFromSchema.ts:27

Unique tool name.


validateArguments?

optional validateArguments?: boolean

Defined in: registerToolFromSchema.ts:54

Whether tools/call arguments are validated against inputSchema before the handler runs, rejecting a mismatch with an MCP error.

Defaults to false, which forwards arguments to the handler unchecked — the behavior this helper has always had. inputSchema is still advertised verbatim over tools/list either way; this only controls enforcement.

Enable it once you know inputSchema 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' }. Validating against a schema like that rejects calls the underlying API would have accepted.

Default

false