# `ExAthena.ToolCalls.Native`
[🔗](https://github.com/udin-io/ex_athena/blob/v0.7.1/lib/ex_athena/tool_calls/native.ex#L1)

Parses native tool-call structures from provider responses.

Handles the four common shapes:

  1. OpenAI / Ollama — `%{id:, type: "function", function: %{name:, arguments: "json"}}`.
     `arguments` is almost always a JSON-encoded string.

  2. Claude — `%{type: "tool_use", id:, name:, input: map()}`.

  3. Pre-parsed — already-parsed `%{id:, name:, arguments: map()}`. No-op.

  4. ReqLLM streaming — `%ReqLLM.StreamChunk{type: :tool_call, name:, arguments:, metadata:}`.
     An optional id is read from `metadata["id"]` or `metadata[:id]`; if absent, one is generated.

Tolerant of both atom and string keys, and tolerant of either a JSON string
or a decoded map for `arguments`.

# `parse`

```elixir
@spec parse(list()) :: {:ok, [ExAthena.Messages.ToolCall.t()]} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
