Skip to main content

ModelContextToolDefinition

A WebMCP tool definition, as registered via document.modelContext.registerTool().

This is an interface exported by @mapcairn/react, checked against version 0.2.0.

Signature​

import type { ModelContextToolDefinition } from "@mapcairn/react";

interface ModelContextToolDefinition<TInput = unknown>

Type parameters​

  • TInput?

Properties​

description​

description: string;

What the tool does and when to use it, written for the calling agent. Read once, when the tool is registered.

execute​

execute: (input: TInput) => Promise<ModelContextToolResult> | ModelContextToolResult;

Runs the tool. The latest closure passed in is always the one called, so it may read current component state.

inputSchema​

inputSchema: Record<string, unknown>;

A JSON Schema object for the one argument execute receives. Read once, when the tool is registered.

name​

name: string;

The name an agent calls the tool by. Changing it re-registers the tool.

Remarks​

inputSchema is a JSON Schema object describing execute's single argument; pass { type: "object", properties: {}, additionalProperties: false } for a tool that takes no input.

See also​

Source: packages/react/src/hooks/useModelContextTool.ts:26