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
| Name | Type | Description |
|---|---|---|
| $suggestions | array<int, string> | Proactive improvement suggestions |
| $warnings | array<int, string> | Non-blocking warnings |
| $nextActions | array<int, array{tool: string, params?: array<string, mixed>, label: string}> | Suggested follow-up actions |
| $context | array<string, mixed> | Entity context (completeness, relationships, capacity) |
| $businessRules | array<string, mixed> | Business rules state (applied, would_block, tips) |
ToolIntelligence::empty()
public static function empty(): selfCreate an empty intelligence instance.
ToolIntelligence::fromArray()
public static function fromArray(array $data): selfCreate from array data.
Parameters
| Name | Type | Description |
|---|---|---|
| $data | array<string, mixed> |
ToolIntelligence::withSuggestions()
public function withSuggestions(array $suggestions): selfAdd suggestions to a new instance.
Parameters
| Name | Type | Description |
|---|---|---|
| $suggestions | array<string> |
ToolIntelligence::withWarnings()
public function withWarnings(array $warnings): selfAdd warnings to a new instance.
Parameters
| Name | Type | Description |
|---|---|---|
| $warnings | array<string> |
ToolIntelligence::withNextActions()
public function withNextActions(array $nextActions): selfAdd next actions to a new instance.
Parameters
| Name | Type | Description |
|---|---|---|
| $nextActions | array<int, array{tool: string, params?: array<string, mixed>, label: string}> |
ToolIntelligence::withContext()
public function withContext(array $context): selfSet context in a new instance.
Parameters
| Name | Type | Description |
|---|---|---|
| $context | array<string, mixed> |
ToolIntelligence::withBusinessRules()
public function withBusinessRules(array $businessRules): selfSet business rules in a new instance.
Parameters
| Name | Type | Description |
|---|---|---|
| $businessRules | array<string, mixed> | Business rules (applied, would_block, tips) |
ToolIntelligence::merge()
public function merge(self $other): selfMerge another ToolIntelligence into this one.
Parameters
| Name | Type | Description |
|---|---|---|
| $other | self |
ToolIntelligence::isEmpty()
public function isEmpty(): boolCheck if this intelligence has any content.
ToolIntelligence::hasWarnings()
public function hasWarnings(): boolCheck if there are any warnings.
ToolIntelligence::hasBlockingRules()
public function hasBlockingRules(): boolCheck if there are potential blocking rules.
ToolIntelligence::getCompleteness()
public function getCompleteness(): floatGet completeness percentage from context.
ToolIntelligence::getMissingRecommended()
public function getMissingRecommended(): arrayGet missing recommended fields from context.
ToolIntelligence::toArray()
public function toArray(): arrayConvert to array for JSON serialization.
ToolIntelligence::jsonSerialize()
public function jsonSerialize(): arraySerialize for JSON encoding; delegates to {@see toArray()} so empty sections are omitted.