feat : add 22 MCP tool classes for projects, tasks, and time tracking
Tools: list-users, list-clients, list/get/create/update-project, list/get/create/update/delete-task, list-statuses/priorities/efforts/tags, list/create/update-group, list/create/update/delete-time-entry. Attribute moved to class level for SDK discovery compatibility. Install nyholm/psr7 for HTTP transport PSR-17 support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
src/Mcp/Tool/TaskMeta/ListGroupsTool.php
Normal file
39
src/Mcp/Tool/TaskMeta/ListGroupsTool.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Mcp\Tool\TaskMeta;
|
||||
|
||||
use App\Repository\TaskGroupRepository;
|
||||
use Mcp\Capability\Attribute\McpTool;
|
||||
|
||||
#[McpTool(name: 'list-groups', description: 'List task groups, optionally filtered by project. Groups are per-project (each group belongs to one project).')]
|
||||
class ListGroupsTool
|
||||
{
|
||||
public function __construct(
|
||||
private readonly TaskGroupRepository $taskGroupRepository,
|
||||
) {}
|
||||
|
||||
public function __invoke(?int $projectId = null, bool $archived = false): string
|
||||
{
|
||||
$criteria = ['archived' => $archived];
|
||||
if (null !== $projectId) {
|
||||
$criteria['project'] = $projectId;
|
||||
}
|
||||
|
||||
$groups = $this->taskGroupRepository->findBy($criteria, ['title' => 'ASC']);
|
||||
|
||||
return json_encode(array_map(fn ($g) => [
|
||||
'id' => $g->getId(),
|
||||
'title' => $g->getTitle(),
|
||||
'description' => $g->getDescription(),
|
||||
'color' => $g->getColor(),
|
||||
'project' => [
|
||||
'id' => $g->getProject()->getId(),
|
||||
'code' => $g->getProject()->getCode(),
|
||||
'name' => $g->getProject()->getName(),
|
||||
],
|
||||
'archived' => $g->isArchived(),
|
||||
], $groups));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user