> ## 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.

<img src="https://mintcdn.com/adaline/i9BAOc2yCgCBZtLd/images/iterate/tool-parameters.png?fit=max&auto=format&n=i9BAOc2yCgCBZtLd&q=85&s=cd2b9306d3b89b0e94312857a6c6a618" alt="Tool configuration in Adaline" title="Tool configuration in Adaline" style={{ width: "100%" }} width="1324" height="721" data-path="images/iterate/tool-parameters.png" />

## Add tools to a prompt

<Steps>
  <Step title="Select a compatible model">
    Choose an LLM that supports tool calling (function calling). Most modern models from OpenAI, Anthropic, and Google support this feature.

    <img src="https://mintcdn.com/adaline/i9BAOc2yCgCBZtLd/images/iterate/select-model.png?fit=max&auto=format&n=i9BAOc2yCgCBZtLd&q=85&s=e205bf9fac8bff598b889c85d4b782bd" alt="Selecting an LLM in Adaline" title="Selecting an LLM in Adaline" style={{ width: "100%" }} width="1504" height="551" data-path="images/iterate/select-model.png" />
  </Step>

  <Step title="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.

    <img src="https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/prompt-for-tool.png?fit=max&auto=format&n=-Bsa4BuK4fSdmy67&q=85&s=72d5539adeba319ae2f8ffb65ba83129" alt="A prompt that needs tool calling" title="A prompt that needs tool calling" style={{ width: "100%" }} width="735" height="108" data-path="images/iterate/prompt-for-tool.png" />
  </Step>

  <Step title="Enable tool choice">
    Enable the tool choice feature in the model settings to allow the LLM to generate tool calls.

    <img src="https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/enable-tool-choice.png?fit=max&auto=format&n=-Bsa4BuK4fSdmy67&q=85&s=40dcdb4970021aaf7343cdf3b9ea740c" alt="Enabling tool choice" title="Enabling tool choice" style={{ width: "60%" }} width="604" height="733" data-path="images/iterate/enable-tool-choice.png" />
  </Step>

  <Step title="Configure tool choice mode">
    Set the tool choice mode to control how the model uses your tools.

    <img src="https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/tool-choice-config.png?fit=max&auto=format&n=-Bsa4BuK4fSdmy67&q=85&s=c38c5a2b5ca1a4d04661d3deb8fdec2c" alt="Configuring tool choice mode" title="Configuring tool choice mode" style={{ width: "100%" }} width="1027" height="412" data-path="images/iterate/tool-choice-config.png" />

    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.                                    |
  </Step>

  <Step title="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.

    <img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/iterate/add-tool.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=4ee1f25b3c2d3e9ec1b5c5350a8ee447" alt="Adding a tool in Adaline" title="Adding a tool in Adaline" style={{ width: "100%" }} width="1298" height="754" data-path="images/iterate/add-tool.png" />
  </Step>
</Steps>

## 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:

<img src="https://mintcdn.com/adaline/-Bsa4BuK4fSdmy67/images/iterate/define-tool-schema.png?fit=max&auto=format&n=-Bsa4BuK4fSdmy67&q=85&s=53e6473601e7da3a4892022cc509a780" alt="Defining the schema for a tool" title="Defining the schema for a tool" style={{ width: "100%" }} width="1030" height="849" data-path="images/iterate/define-tool-schema.png" />

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.
</Note>

## 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.

<img src="https://mintcdn.com/adaline/Um_T8BffW4hfcoYD/images/iterate/add-tool-call.png?fit=max&auto=format&n=Um_T8BffW4hfcoYD&q=85&s=10d1a734fbf22b0b1978a25c8847354a" alt="Adding tool calls in the Editor" title="Adding tool calls in the Editor" style={{ width: "100%" }} width="782" height="710" data-path="images/iterate/add-tool-call.png" />

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](/docs/iterate/tool-calls-in-playground) 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

<CardGroup cols={2}>
  <Card title="Tool Calls in Playground" icon="play" href="/docs/iterate/tool-calls-in-playground">
    Test tool interactions in the Playground sandbox.
  </Card>

  <Card title="Use MCP Servers in Prompts" icon="server" href="/docs/iterate/use-mcp-server-in-prompt">
    Connect to MCP servers for standardized tool access.
  </Card>
</CardGroup>
