integer('parentId')->description('ID of the parent goal to get children for.') ->required(); } public function name(): string { return 'getChildGoals'; } public function description(): string { return 'Gets all child goals associated with a parent goal.'; } /** * Handle the tool request. */ public function handle(array $arguments): ToolResult { $parentId = (int) ($arguments['parentId'] ?? 0); $childGoals = $this->goalcanvasService->getChildrenbyKPI($parentId); if (empty($childGoals)) { return ToolResult::text("No child goals found for parent goal ID: {$parentId}"); } $response = "## Child Goals for Parent ID: {$parentId}\n"; foreach ($childGoals as $goal) { $result = [ 'id' => $goal['id'], 'title' => Str::sanitizeForLLM($goal['title']), 'startValue' => $goal['startValue'], 'currentValue' => $goal['currentValue'], 'endValue' => $goal['endValue'], 'metricType' => $goal['metricType'], 'boardTitle' => Str::sanitizeForLLM($goal['boardTitle']), 'canvasId' => $goal['canvasId'], 'projectName' => Str::sanitizeForLLM($goal['projectName']), ]; $response .= Str::toMarkdown($result)."\n"; } return ToolResult::text($response); } }