# 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

```ts
import type { ModelContextToolDefinition } from "@mapcairn/react";
 
interface ModelContextToolDefinition<TInput = unknown>
```

## Type parameters

- `TInput?`

## Properties

### description

```ts
description: string;
```

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

### execute

```ts
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

```ts
inputSchema: Record<string, unknown>;
```

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

### name

```ts
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

- [`ModelContextToolResult`](https://docs.mapcairn.com/api/react/ModelContextToolResult.md)

Source: [packages/react/src/hooks/useModelContextTool.ts:26](https://github.com/MapCairn/mapcairn/blob/main/packages/react/src/hooks/useModelContextTool.ts#L26)
