# AI Tool

These instructions apply to the legacy Admin Console.

Define a tool that can be invoked by AI Generate.

## Where to Find It

In the Flow Editor, look in the left palette under **AI Gateway**, then drag **Tool** onto your canvas.

<figure><img src="https://docs.contextual.io/legacy/media/ai-tool-config.png" alt="AI Tool node configuration" width="375"><figcaption><p>AI Tool configuration with Tool ID, Description, and Schema.</p></figcaption></figure>

## What It Does

The Tool node is the entry point for tool execution when the model decides to call a tool. When invoked, it emits a copy of the AI Generate message with the tool parameters in `msg.payload`.

## Configuration

1. **Name** (optional) - Provide a friendly label for the node.
2. **Tool ID** (required) - The unique identifier the model calls. Tool IDs must be unique within the tools selected by the same AI Generate node and can include letters, numbers, `_`, and `-`.
3. **Description** (optional) - Describe what the tool does to help the model choose it.
4. **Input Schema** (required) - The JSON Schema for tool parameters.
   * Use the editor for static schema definitions.
   * Use a `msg` reference when you want the schema sourced dynamically from the AI Generate message.

## Outputs

When the model invokes the tool, the node emits a message with:

* `msg.payload` set to the tool parameters
* the rest of the original AI Generate message preserved for context

Use downstream nodes to implement the tool behavior, then finish the tool path with [AI Tool Response](https://docs.contextual.io/legacy/components-and-data/flows/node-reference/ai-gateway/ai-tool-response.md) to send the result back to AI Generate.
