# AI Tool

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://2803907488-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJF7AoTYz7NHacejws5p9%2Fuploads%2Fgit-blob-69f8bfe4bdc5bcaf3457770cefc81326e8b64cfd%2Fai-tool-config.png?alt=media" 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/documentation-and-resources/components-and-data/flows/node-reference/ai-gateway/ai-tool-response) to send the result back to AI Generate.
