> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lyzn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Tool Builder

> Extend your AI agents with custom logic workflows

# Custom Tool Builder

Sometimes the built-in tools aren't enough. You might need to call a proprietary internal API, process complex data, or chain multiple actions together.

The **Custom Tool Builder** (also known as the `AI Extender Tool`) allows you to build a tool using a mini-workflow.

## The Concept

Instead of writing code, you define a tool using nodes.

```mermaid theme={null}
graph LR
    AI[AI Agent] -->|Call| Extender[Custom Tool Node]
    
    subgraph "Your Custom Logic"
        Extender -->|Start Chain| API[HTTP Request]
        API -->|Data| DB[Database Insert]
        DB -->|Result| Extender
    end
    
    Extender -->|Return Result| AI
```

## How to Build a Custom Tool

1. **Add the Node**: Search for "Custom Tool Builder" (or `AI Extender`).
2. **Define Inputs**: In the properties panel, define what the AI should send.
   * *Example*: `order_id` (String), `reason` (String).
   * The AI will intelligently extract these from the user's message.
3. **Build the Chain**:
   * Connect the **Chain** output handle to your first logic node (e.g., `HTTP Request`).
   * Perform your logic (e.g., Look up order status).
4. **Return the Result**:
   * Connect the final node of your processing chain back to the **Result** input handle of the Custom Tool Builder.

### Accessing Inputs

Inside your chain, you can access the inputs the AI sent using variables:

* `{{ custom_tool_node_id.parameters.order_id }}`
* `{{ custom_tool_node_id.parameters.reason }}`

## Example: refund\_processor

Imagine building a tool to process refunds.

1. **Tool Name**: `refund_order`
2. **Description**: "Process a refund for a customer order"
3. **Inputs**: `orderId`, `reason`
4. **Logic Chain**:
   * **HTTP Request**: POST to `/api/refund` with `orderId`.
   * **Email Send**: Email the user "Your refund is processed".
5. **Result**: Return `{{ http_request.body.status }}` to the AI.

The AI simply calls `refund_order`, and your workflow handles the complexity!
