Skip to content
docs

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

Parámetros de __construct()
NombreTipoDescripción
$scopesarray<string>Required auth scopes for this tool
$mutatingbool
$requiresConfirmationbool
$timeout?int
$clampsarray<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): self

Build from a raw options array (the shape the old `array $options` parameter accepted).

Parameters

Parámetros de fromArray()
NombreTipoDescripción
$optionsarray<string, mixed>

Throws

\InvalidArgumentException if $options contains a key this VO does not model

ToolOptions::toArray()

public function toArray(): array

Expose the options as a plain array for the registry's internal use.