GatedToolCalls
Tool calls through a gate: consult, execute through the registry, record. This is the one place a tool is called on behalf of an actor that must be governed — a model, a recipe, a sequence. Every caller extends it or holds one: a model gateway adds what it removed from the table, a governed door adds the consent it collected (greenhouse decisions/0225). Extensions separate three facts: {@see self::hidden()} controls catalogue visibility, {@see self::withdrawn()} forbids execution, and {@see self::optionRemoved()} marks a gate refusal against historical withdrawal. Nothing here knows what a session or a model is.
GatedToolCalls::__construct()
public function __construct(Milpa\ToolRuntime\ToolRegistry $registry, ?Milpa\ToolRuntime\Gate\ToolCallGate $gate = null, ?Milpa\ToolRuntime\Gate\ToolCallRecorder $recorder = null):Calls through `$registry`, asking `$gate` before each one and telling `$recorder` after — both optional.
Parameters
| Name | Type | Description |
|---|---|---|
| $registry | Milpa\ToolRuntime\ToolRegistry | |
| $gate | ?Milpa\ToolRuntime\Gate\ToolCallGate | |
| $recorder | ?Milpa\ToolRuntime\Gate\ToolCallRecorder |
GatedToolCalls::setContext()
public function setContext(Milpa\ToolRuntime\Contracts\ToolContext $context): voidThe context every call from now on carries to the registry (who, on which channel).
Parameters
| Name | Type | Description |
|---|---|---|
| $context | Milpa\ToolRuntime\Contracts\ToolContext |
GatedToolCalls::callToolWithBudget()
public function callToolWithBudget(string $name, array $args, Milpa\ToolRuntime\Contracts\ResultBudget $budget): ?mixedScope a transport budget to one synchronous call, preserving subclass dispatch and gates. The overlay is applied after an extension has supplied the actual caller's context.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $args | array<string, mixed> | |
| $budget | Milpa\ToolRuntime\Contracts\ResultBudget |
GatedToolCalls::getToolSummaries()
public function getToolSummaries(): arrayThe registry's tool summaries, minus what {@see self::hidden()} takes away.
GatedToolCalls::callTool()
public function callTool(string $name, array $args): ?mixedCall one tool: scopes, active withdrawal, gate, registry, then recorder.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $args | array<string, mixed> |
Throws
ToolCallRefused when an active withdrawal or the gate refuses
\Exception when the tool itself failed, with the tool's own error