feat(mcp/external): add ListTags + inject TagRepository

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-25 11:24:10 +02:00
parent e767d57640
commit e6846b7e6d
3 changed files with 56 additions and 1 deletions

View File

@@ -10,6 +10,8 @@ namespace ClaudeDo.Worker.External;
public sealed record TaskListDto(string Id, string Name, string? WorkingDir);
public sealed record TagDto(long Id, string Name);
public sealed record TaskDto(
string Id,
string ListId,
@@ -29,17 +31,20 @@ public sealed class ExternalMcpService
private readonly ListRepository _lists;
private readonly QueueService _queue;
private readonly HubBroadcaster _broadcaster;
private readonly TagRepository _tags;
public ExternalMcpService(
TaskRepository tasks,
ListRepository lists,
QueueService queue,
HubBroadcaster broadcaster)
HubBroadcaster broadcaster,
TagRepository tags)
{
_tasks = tasks;
_lists = lists;
_queue = queue;
_broadcaster = broadcaster;
_tags = tags;
}
[McpServerTool, Description("List all task lists available in ClaudeDo.")]
@@ -183,6 +188,13 @@ public sealed class ExternalMcpService
return cancelled;
}
[McpServerTool, Description("List all known tags. Useful for discovering existing tag names (including 'agent' which marks tasks for auto-execution) before tagging.")]
public async Task<IReadOnlyList<TagDto>> ListTags(CancellationToken cancellationToken)
{
var tags = await _tags.GetAllAsync(cancellationToken);
return tags.Select(t => new TagDto(t.Id, t.Name)).ToList();
}
private static TaskDto ToDto(TaskEntity t) => new(
t.Id,
t.ListId,