ToolFailedEvent
POST event (tool-runtime 0.5, event-driven retrofit): a tool's callback threw. Dispatched by {@see \Milpa\ToolRuntime\ToolRegistry::call()} as `tool.failed` — pure notification, readonly, no slot (an exception has already happened; there is nothing left to veto or short-circuit). {@see \Milpa\ToolRuntime\ToolAuditLogger} subscribes to this event to log the failure exactly as it did before this event existed. Only dispatched for an exception thrown by the tool's own callback during execution — NOT for validation errors, authorization denials, or rate-limit rejections, which are rejected before `tool.executing` is ever dispatched (see the security anchor on {@see \Milpa\ToolRuntime\ToolRegistry::call()}) and continue to be logged directly by {@see \Milpa\ToolRuntime\ToolAuditLogger::logValidationFailure()} / {@see \Milpa\ToolRuntime\ToolAuditLogger::logAuthFailure()} / the rate-limit branch's direct {@see \Milpa\ToolRuntime\ToolAuditLogger::log()} call.
ToolFailedEvent::__construct()
public function __construct(string $name, Milpa\ToolRuntime\Contracts\ToolContext $ctx, array $args, Throwable $exception, int $tookMs):Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | Tool name that failed |
| $ctx | ToolContext | Execution context the call ran under |
| $args | array<string, mixed> | The (validated/clamped) arguments the call ran with |
| $exception | \Throwable | The exception thrown by the tool's callback |
| $tookMs | int | Elapsed time in milliseconds up to the failure |