# `Gemini.Tools`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/tools.ex#L1)

High-level facade for tool registration and execution in the Gemini client.

This module provides a convenient interface for developers to register tool
implementations and execute function calls returned by the Gemini API. It
integrates with the ALTAR LATER runtime for robust tool execution.

## Usage

    # Register a tool
    {:ok, declaration} = Altar.ADM.new_function_declaration(%{
      name: "get_weather",
      description: "Gets weather for a location",
      parameters: %{}
    })

    :ok = Gemini.Tools.register(declaration, &MyApp.Tools.get_weather/1)

    # Execute function calls from API response
    function_calls = [%Altar.ADM.FunctionCall{...}]
    {:ok, results} = Gemini.Tools.execute_calls(function_calls)

# `execute_calls`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/tools.ex#L55)

```elixir
@spec execute_calls([Altar.ADM.FunctionCall.t()]) :: {:ok, [Altar.ADM.ToolResult.t()]}
```

Execute a list of function calls in parallel using the LATER executor.

Takes a list of `%Altar.ADM.FunctionCall{}` structs (typically from a
GenerateContentResponse) and executes them concurrently, returning a list
of `%Altar.ADM.ToolResult{}` structs.

Returns `{:ok, [ToolResult.t()]}` on success. Individual tool failures
are captured in the ToolResult's `is_error` field rather than causing
the entire operation to fail.

# `register`
[🔗](https://github.com/nshkrdotcom/gemini_ex/blob/v0.11.0/lib/gemini/tools.ex#L39)

```elixir
@spec register(Altar.ADM.FunctionDeclaration.t(), (map() -&gt; any())) ::
  :ok | {:error, term()}
```

Register a tool implementation with the LATER registry.

- `declaration` is a validated `%Altar.ADM.FunctionDeclaration{}`
- `fun` is an arity-1 function that accepts a map of arguments

Returns `:ok` on success or `{:error, reason}` if registration fails.

---

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