---
title: "ADR-010: Tool/Function Calling Design"
manual: "TYPO3 LLM Extension"
version: "0.35"
permalink: "https://docs.typo3.org/permalink/netresearch/nr-llm:adr-010@0.35"
source: "Adr/Adr010ToolFunctionCallingDesign.rst"
modified: "2026-09-16T22:09:16+00:00"
---

# ADR-010: Tool/Function Calling Design

-   *Status:* Accepted
-   *Date:* 2024-04
-   *Authors:* Netresearch DTT GmbH

## Context

Modern LLMs support tool/function calling for:

-   External data retrieval.
-   Action execution.
-   Structured output generation.

## Decision

Support **OpenAI-compatible tool format**:

**Example: Tool definition**

```php
$tools = [
    [
        'type' => 'function',
        'function' => [
            'name' => 'get_weather',
            'description' => 'Get weather for location',
            'parameters' => [
                'type' => 'object',
                'properties' => [
                    'location' => ['type' => 'string'],
                ],
                'required' => ['location'],
            ],
        ],
    ],
];
```

Tool calls returned in `CompletionResponse::$toolCalls`:

-   A typed `list<ToolCall>` (nullable) of `ToolCall` value objects —
    each with the tool `id`, `name` and its arguments as an already
    **JSON-decoded** associative array (not an encoded string). A full
    tool-execution runtime was added later in [ADR-038](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-038@0.35), and the
    PHP tool return type evolved from a plain string to a typed `ToolResult`
    (provider-facing content plus run-only artifacts) in [ADR-108](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-108@0.35).

## Consequences

**Positive:**

-   ●● Industry-standard format.
-   ●● Cross-provider compatibility.
-   ● Flexible tool definitions.
-   ● Type-safe parameters.

**Negative:**

-   ◑ Complex nested structure.
-   ◑ Provider translation needed.
-   ✕ No automatic execution.
-   ◑ Testing complexity.

**Net Score:** +5.0 (Positive impact -
OpenAI-compatible format ensures broad compatibility)
