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

# Use tools in prompts

> Enable function calling and tool use to extend your LLM's capabilities with external services

Tools let your LLM interact with external services, databases, and APIs during a conversation. When a model determines it needs external data or actions, it generates a structured tool call request that can be executed to fetch results and continue the conversation.

Adaline supports the full tool calling workflow — from defining tool schemas to configuring automatic execution with custom backends.

![Tool configuration in Adaline](https://mintcdn.com/adaline/i9BAOc2yCgCBZtLd/images/iterate/tool-parameters.png?fit=max\&auto=format\&n=i9BAOc2yCgCBZtLd\&q=85\&s=cd2b9306d3b89b0e94312857a6c6a618)

## Add tools to a prompt

**1. Select a compatible model**

Choose an LLM that supports tool calling (function calling). Most modern models from OpenAI, Anthropic, and Google support this feature.

![Selecting an LLM in Adaline](https://mintcdn.com/adaline/i9BAOc2yCgCBZtLd/images/iterate/select-model.png?fit=max\&auto=format\&n=i9BAOc2yCgCBZtLd\&q=85\&s=e205bf9fac8bff598b889c85d4b782bd)

**2. Write your prompt**

Compose a prompt that may require external data or actions. For example, a prompt asking about current weather conditions would benefit from a weather API tool.

![A prompt that needs tool calling](https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/prompt-for-tool.png?fit=max\&auto=format\&n=-Bsa4BuK4fSdmy67\&q=85\&s=72d5539adeba319ae2f8ffb65ba83129)

**3. Enable tool choice**

Enable the tool choice feature in the model settings to allow the LLM to generate tool calls.

![Enabling tool choice](https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/enable-tool-choice.png?fit=max\&auto=format\&n=-Bsa4BuK4fSdmy67\&q=85\&s=40dcdb4970021aaf7343cdf3b9ea740c)

**4. Configure tool choice mode**

Set the tool choice mode to control how the model uses your tools.

![Configuring tool choice mode](https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/tool-choice-config.png?fit=max\&auto=format\&n=-Bsa4BuK4fSdmy67\&q=85\&s=c38c5a2b5ca1a4d04661d3deb8fdec2c)

Choose from the following modes (availability varies by model):

| Mode | Behavior |
| - | - |
| **none** | The model will not invoke any tools. |
| **auto** | The model decides which tools to use and when, based on the conversation context. |
| **required** | The model must invoke at least one tool in its response. |
| **any** | The model can call any of the available tools. |

**5. Define or link a tool**

Click **Add Tool** to create a new inline tool definition, or link to an already defined tool in the project.

![Adding a tool in Adaline](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/iterate/add-tool.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=4ee1f25b3c2d3e9ec1b5c5350a8ee447)

## Tool schema definition

Each tool is defined using a JSON schema that tells the model what the tool does and what parameters it accepts. Click **Add Tool** to open the schema editor:

![Defining the schema for a tool](https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/define-tool-schema.png?fit=max\&auto=format\&n=-Bsa4BuK4fSdmy67\&q=85\&s=53e6473601e7da3a4892022cc509a780)

Here is the complete JSON structure for a tool definition:

```json theme={null}
{
  "type": "function",
  "definition": {
    "schema": {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": ["celsius", "fahrenheit"]
          }
        },
        "required": ["location"]
      }
    }
  }
}
```

### Schema reference

| Field | Type | Required | Description |
| - | - | - | - |
| `type` | String | Yes | Always set to `"function"`. |
| `name` | String | Yes | A unique identifier for the tool. |
| `description` | String | Yes | Describes what the tool does. Helps the model decide when to use it. |
| `parameters.type` | String | No | The parameter structure type. Typically `"object"`. |
| `parameters.properties` | Object | No | Defines individual parameters with their types and descriptions. |
| `required` | Array | No | Lists the parameter names that are mandatory. |

> [!NOTE]
>
> Refer to the [OpenAI function calling documentation](https://platform.openai.com/docs/guides/function-calling) for more schema examples and best practices.

## Add tool calls and responses to messages

Beyond defining tools, you can add tool call and tool response messages directly in the Editor. This is useful for building multi-shot prompts that demonstrate how the model should interact with tools.

![Adding tool calls in the Editor](https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/iterate/add-tool-call.png?fit=max\&auto=format\&n=Um_T8BffW4hfcoYD\&q=85\&s=10d1a734fbf22b0b1978a25c8847354a)

A **tool call** (in an Assistant message) represents the model invoking a specific tool. A **tool response** (in a Tool message) shows the data returned by the external service. Together, they teach the model the expected interaction pattern.

## Configure auto tool calls

For tools that connect to a live backend, you can configure an HTTP request endpoint so the [Playground](https://www.adaline.ai/docs/iterate/tool-calls-in-playground.md) automatically executes the tool and continues the conversation.

Add a `request` object to your tool definition:

```json theme={null}
{
  "type": "function",
  "definition": {
    "schema": {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          }
        },
        "required": ["location"]
      }
    }
  },
  "request": {
    "type": "http",
    "method": "get",
    "url": "https://api.my-tool-backend.com/get_weather",
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer <your-api-key>"
    },
    "retry": {
      "maxAttempts": 3,
      "initialDelay": 1000,
      "exponentialFactor": 2
    }
  }
}
```

### Request configuration reference

| Field | Type | Required | Description |
| - | - | - | - |
| `type` | String | Yes | Always set to `"http"`. |
| `method` | String | Yes | The HTTP method (`GET` or `POST`). |
| `url` | String | Yes | The endpoint URL to call. |
| `headers` | Object | No | HTTP headers to include in the request. |
| `retry` | Object | No | Retry configuration for failed requests. |
| `retry.maxAttempts` | Number | No | Maximum number of retry attempts. |
| `retry.initialDelay` | Number | No | Initial delay in milliseconds before the first retry. |
| `retry.exponentialFactor` | Number | No | Multiplier for exponential backoff between retries. |

When auto tool calls are enabled and a tool has a configured request endpoint, the Playground will automatically invoke the tool, inject the response, and continue the conversation — enabling fully automated multi-turn interactions.

## Next steps

> [card] [Tool Calls in Playground](https://www.adaline.ai/docs/iterate/tool-calls-in-playground.md)
>
> Test tool interactions in the Playground sandbox.

> [card] [Use MCP Servers in Prompts](https://www.adaline.ai/docs/iterate/use-mcp-server-in-prompt.md)
>
> Connect to MCP servers for standardized tool access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.