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

# Tools

# Tools

Tool types for function calling with LLMs.

## ToolType

Tools allow LLMs to invoke external functions. Define tools with a name, description, and JSON Schema parameters.

```typescript theme={null}
const tools = [
  {
    type: "function",
    definition: {
      schema: {
        name: "get_weather",
        description: "Get the current weather for a location",
        parameters: {
          type: "object",
          properties: {
            location: {
              type: "string",
              description: "City name, e.g. San Francisco",
            },
            unit: {
              type: "string",
              enum: ["celsius", "fahrenheit"],
              description: "Temperature unit",
            },
          },
          required: ["location"],
        },
      },
    },
    handler: async (args) => {
      // Your function logic here
      return { temperature: 72, condition: "sunny" };
    },
  },
];
```

### Fields

<ParamField body="type" type="string" required>
  The tool type. Currently only `"function"` is supported.
</ParamField>

<ParamField body="definition" type="object" required>
  <Expandable title="Properties">
    <ParamField body="schema" type="object" required>
      The function schema following JSON Schema format.

      <Expandable title="Properties">
        <ParamField body="name" type="string" required>
          The function name. Must be a-z, A-Z, 0-9, underscores, or dashes.
        </ParamField>

        <ParamField body="description" type="string" required>
          A description of what the function does. Helps the model decide when to call it.
        </ParamField>

        <ParamField body="parameters" type="object" required>
          JSON Schema object describing the function parameters.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="handler" type="function" optional>
  An async function that executes when the tool is called via `gateway.getToolResponses()`. Receives the parsed arguments and returns the result.
</ParamField>
