# Class LittleGhost::CodeMode::Broker

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/CodeMode/Broker.html

Keeps tool authorization and execution in the trusted parent process.

## Inheritance

`LittleGhost::CodeMode::Broker < Object`

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new(agent: nil, registry: nil, context: RunContext.new, events: [],
        parent_operation_id: nil, parent_trace_context: nil, except: nil, dispatch: nil, max_calls: nil)
```

Builds a broker for an Agent's Tool registry. `except` removes names from the
code-mode catalog. `dispatch` is a trusted adapter hook used by custom hosts;
ordinary Agent integrations should let the broker dispatch through `agent`.

## Instance methods

<a id="method-i-call"></a>
### `#call`

```ruby
#call(name, arguments = {}, id: SecureRandom.uuid)
```

Calls an available Tool by model-visible `name`. The returned CallResult has
`id`, decoded `value`, and model-safe `error` fields. `arguments` remains
untrusted until the ordinary Tool path validates and authorizes it.

<a id="method-i-catalog"></a>
### `#catalog`

```ruby
#catalog()
```

Returns the Tool specifications available to model-authored code. Excluded
Tools, code-mode controls, and subagent controls stay outside this catalog.
