Skip to main content

Interface: RegisterToolFromSchemaParams

Defined in: registerToolFromSchema.ts:26

Parameters accepted by registerToolFromSchema.

Properties

description?

optional description?: string

Defined in: registerToolFromSchema.ts:30

Human-readable description shown to the AI client.


handler

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

Defined in: registerToolFromSchema.ts:61

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:37

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:28

Unique tool name.


validateArguments?

optional validateArguments?: boolean

Defined in: registerToolFromSchema.ts:55

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