# llmToolCall

`llmToolCall` is a frontend AI/tooling action. It receives one or more tool calls requested by an LLM and maps them into BetterForms named actions.

## Expected Options

| Key                  | Type     | Description                                                                       |
| -------------------- | -------- | --------------------------------------------------------------------------------- |
| `options.functions`  | `array`  | Array of tool/function calls requested by the LLM                                 |
| `options.toolCallId` | `string` | Correlation ID used to tie the tool execution back to the originating LLM request |

## Behavior

* BetterForms validates that `functions` is an array and that `toolCallId` is present.
* Each requested function is mapped to a BetterForms named action using the function name.
* Function arguments are parsed from JSON when needed.
* BetterForms injects `toolCallId` into the named-action options.
* The runtime emits `processNamedAction` for each tool call.
* If dispatch fails, BetterForms sends an error payload to `llm/tool-response`.

## Important Pattern

This action is designed to work with `llmToolCallResponse`.

Typical flow:

1. `llmToolCall` receives the tool request.
2. A BetterForms named action runs UI logic.
3. That named action ends with `llmToolCallResponse` to send the result back.

## Related Pages

* [llmToolCallResponse](/reference/actions-processor/actions_overview/llmtoolcallresponse.md)
* [Klai Streaming API (LLM Query)](/reference/apis-and-services/streaming-proxy/bf-streaming-api-llm-query.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.klai.studio/reference/actions-processor/actions_overview/llmtoolcall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
