integer('projectId')->description('Project ID to get status updates for.') ->required(); } public function name(): string { return 'getAllProjectComments'; } public function description(): string { return 'Gets all project status updates for a specific project.'; } /** * Handle the tool request. */ public function handle(array $arguments): ToolResult { $projectId = (int) ($arguments['projectId'] ?? 0); $comments = $this->commentsService->getComments('project', $projectId); if (empty($comments)) { return ToolResult::text("No status updates found for project ID: {$projectId}"); } $response = "## Project Status Updates\n"; foreach ($comments as $comment) { $statusIndicator = match ($comment['status']) { 'green' => '🟢 ', 'yellow' => '🟡 ', 'red' => '🔴 ', default => '', }; $result = [ 'id' => $comment['id'], 'status' => $statusIndicator.($comment['status'] ?: 'None'), 'text' => Str::sanitizeForLLM($comment['text']), 'date' => $comment['date'], 'author' => $comment['firstname'].' '.$comment['lastname'], ]; $response .= Str::toMarkdown($result)."\n"; } return ToolResult::text($response); } }