# `Jido.AI.Directive.ToolExec`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/directive/tool_exec.ex#L1)

Directive to execute a Jido.Action as a tool.

The runtime will execute this asynchronously and send the result back
as a `ai.tool.result` signal.

## Execution Modes

1. **Direct module execution** (preferred): When `action_module` is provided,
   the module is executed directly via `Turn.execute_module/4`, bypassing
   name-based lookup. This is used by strategies that maintain their own tool lists.

2. **Name lookup**: When `action_module` is nil, runtime resolves the tool name
   against the current strategy/plugin tool map and executes via `Jido.AI.Turn`.

## Argument Normalization

LLM tool calls return arguments with string keys (from JSON). The execution
normalizes arguments using the tool's schema before execution:
- Converts string keys to atom keys
- Parses string numbers to integers/floats based on schema type

This ensures consistent argument semantics whether tools are called via
DirectiveExec or any other path.

# `t`

```elixir
@type t() :: %Jido.AI.Directive.ToolExec{
  action_module: nil | atom(),
  arguments: map(),
  context: map(),
  id: binary(),
  iteration: nil | integer(),
  max_retries: integer(),
  metadata: map(),
  request_id: nil | binary(),
  retry_backoff_ms: integer(),
  timeout_ms: nil | integer(),
  tool_name: binary()
}
```

# `new!`

Create a new ToolExec directive.

---

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