ToolOptions
Typed replacement for the untyped `array $options` previously accepted by {@see \Milpa\app\Interfaces\Tooling\ToolRegistryInterface::register()}. The concrete tool-runtime {@see \Milpa\Plugins\MilpaToolRuntimePlugin\ToolDefinition} only understands `scopes|mutating|requiresConfirmation|timeout|clamps|version|outputSchema`. Passing an unknown key (e.g. `category`) in the old raw-array API silently vanished — {@see ToolDefinition} has no such property, so it was dropped with no error. {@see self::fromArray()} closes that gap by rejecting unknown keys outright.
ToolOptions::__construct()
public function __construct(array $scopes = [], bool $mutating = false, bool $requiresConfirmation = false, ?int $timeout = null, array $clamps = [], ?string $version = null, ?array $outputSchema = null):Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $scopes | array<string> | Required auth scopes for this tool |
| $mutating | bool | |
| $requiresConfirmation | bool | |
| $timeout | ?int | |
| $clamps | array<string, array<(int | float)>> | Per-argument numeric clamps ({min, max}) |
| $version | ?string | |
| $outputSchema | (array<string, mixed> | null) | JSON-schema-like output definition |
ToolOptions::fromArray()
public static function fromArray(array $options): selfBuild from a raw options array (the shape the old `array $options` parameter accepted).
Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $options | array<string, mixed> |
Throws
\InvalidArgumentException if $options contains a key this VO does not model
ToolOptions::toArray()
public function toArray(): arrayExpose the options as a plain array for the registry's internal use.