Skip to content
docsv0.2.0

ToolIntelligence

Intelligence data attached to tool results. This DTO carries enriched information that helps the LLM: - suggestions: Proactive tips to improve operations - warnings: Non-blocking alerts about potential issues - nextActions: Suggested follow-up tool calls - context: Entity completeness, relationships, capacity - businessRules: Applied rules, potential blocks, tips

ToolIntelligence::__construct()

public function __construct(array $suggestions = [], array $warnings = [], array $nextActions = [], array $context = [], array $businessRules = []):

Parameters

Parameters of __construct()
NameTypeDescription
$suggestionsarray<int, string>Proactive improvement suggestions
$warningsarray<int, string>Non-blocking warnings
$nextActionsarray<int, array{tool: string, params?: array<string, mixed>, label: string}>Suggested follow-up actions
$contextarray<string, mixed>Entity context (completeness, relationships, capacity)
$businessRulesarray<string, mixed>Business rules state (applied, would_block, tips)

ToolIntelligence::empty()

public static function empty(): self

Create an empty intelligence instance.

ToolIntelligence::fromArray()

public static function fromArray(array $data): self

Create from array data.

Parameters

Parameters of fromArray()
NameTypeDescription
$dataarray<string, mixed>

ToolIntelligence::withSuggestions()

public function withSuggestions(array $suggestions): self

Add suggestions to a new instance.

Parameters

Parameters of withSuggestions()
NameTypeDescription
$suggestionsarray<string>

ToolIntelligence::withWarnings()

public function withWarnings(array $warnings): self

Add warnings to a new instance.

Parameters

Parameters of withWarnings()
NameTypeDescription
$warningsarray<string>

ToolIntelligence::withNextActions()

public function withNextActions(array $nextActions): self

Add next actions to a new instance.

Parameters

Parameters of withNextActions()
NameTypeDescription
$nextActionsarray<int, array{tool: string, params?: array<string, mixed>, label: string}>

ToolIntelligence::withContext()

public function withContext(array $context): self

Set context in a new instance.

Parameters

Parameters of withContext()
NameTypeDescription
$contextarray<string, mixed>

ToolIntelligence::withBusinessRules()

public function withBusinessRules(array $businessRules): self

Set business rules in a new instance.

Parameters

Parameters of withBusinessRules()
NameTypeDescription
$businessRulesarray<string, mixed>Business rules (applied, would_block, tips)

ToolIntelligence::merge()

public function merge(self $other): self

Merge another ToolIntelligence into this one.

Parameters

Parameters of merge()
NameTypeDescription
$otherself

ToolIntelligence::isEmpty()

public function isEmpty(): bool

Check if this intelligence has any content.

ToolIntelligence::hasWarnings()

public function hasWarnings(): bool

Check if there are any warnings.

ToolIntelligence::hasBlockingRules()

public function hasBlockingRules(): bool

Check if there are potential blocking rules.

ToolIntelligence::getCompleteness()

public function getCompleteness(): float

Get completeness percentage from context.

ToolIntelligence::getMissingRecommended()

public function getMissingRecommended(): array

Get missing recommended fields from context.

ToolIntelligence::toArray()

public function toArray(): array

Convert to array for JSON serialization.

ToolIntelligence::jsonSerialize()

public function jsonSerialize(): array

Serialize for JSON encoding; delegates to {@see toArray()} so empty sections are omitted.