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

Parses `~~~tool_call` fenced blocks out of assistant text.

The contract with the model (enforced by the system-prompt preamble added by
`ExAthena.ToolCalls.augment_system_prompt/2`):

    ~~~tool_call
    {"name": "read_file", "arguments": {"path": "/foo/bar"}}
    ~~~

Rules:

  * One block per call. Multiple blocks in one response are allowed.
  * Both fences must be on their own lines.
  * `id` is optional in the payload; missing ids are generated server-side.
  * Malformed JSON in a block is returned as an error on that block; other
    well-formed blocks in the same text are still parsed (best-effort).

A valid `~~~tool_call` block carries the model's intent to call a tool even
if the model also emitted a prose preamble around the block — this parser
returns tool calls only; the prose is left alone and should not be replayed
as a response to the user until the tools have actually run.

# `parse`

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

Extract tool calls from assistant text. Always returns a list.

---

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