# `ToolCall.Doc`

Extracts tool descriptions from `@doc` strings.

`@doc` is free-form markdown. The first paragraph becomes the tool
description; a leading `#` title is stripped, while a leading level-2+
section heading is omitted and its body is used. Bullets under a
`## Parameters` heading (also `Params`, `Arguments` and `Args`) become
per-parameter descriptions, with an optional type annotation such as
`* city (String.t()) - city name`. `## Options` conventionally documents the
keys of a keyword argument, so those bullets are returned under `:options`
rather than `:params`; they are not matched against parameter names, do not
name a parameter by position and do not warn. The section is not part of the
tool description.

    @doc """
    Get the forecast.

    ## Parameters
      * `city` - city name
      * `days` - forecast days
    """

# `parsed`

```elixir
@type parsed() :: %{
  description: String.t() | nil,
  params: %{required(String.t()) =&gt; String.t()},
  options: %{required(String.t()) =&gt; String.t()},
  param_order: [String.t()],
  param_heading: :parameters | :options | nil
}
```

# `parse`

```elixir
@spec parse(nil | false | String.t()) :: parsed()
```

Parses a `@doc` string.

`:params` contains `## Parameters` bullets and `:options` contains
`## Options` bullets; the two maps are mutually exclusive. `:param_order`
preserves declaration order for parameter bullets.

---

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