diff --git a/src/ClaudeDo.Worker/External/ListMcpTools.cs b/src/ClaudeDo.Worker/External/ListMcpTools.cs index d1884e7..15479a8 100644 --- a/src/ClaudeDo.Worker/External/ListMcpTools.cs +++ b/src/ClaudeDo.Worker/External/ListMcpTools.cs @@ -47,6 +47,8 @@ public sealed class ListMcpTools var entity = await _lists.GetByIdAsync(listId, cancellationToken) ?? throw new InvalidOperationException($"List {listId} not found."); + if (name is not null && string.IsNullOrWhiteSpace(name)) + throw new InvalidOperationException("name cannot be blank."); if (name is not null) entity.Name = name; if (workingDir is not null) entity.WorkingDir = string.IsNullOrWhiteSpace(workingDir) ? null : workingDir; diff --git a/tests/ClaudeDo.Worker.Tests/External/ListMcpToolsTests.cs b/tests/ClaudeDo.Worker.Tests/External/ListMcpToolsTests.cs index 9f096d1..50f1f05 100644 --- a/tests/ClaudeDo.Worker.Tests/External/ListMcpToolsTests.cs +++ b/tests/ClaudeDo.Worker.Tests/External/ListMcpToolsTests.cs @@ -4,34 +4,9 @@ using ClaudeDo.Data.Repositories; using ClaudeDo.Worker.External; using ClaudeDo.Worker.Hub; using ClaudeDo.Worker.Tests.Infrastructure; -using Microsoft.AspNetCore.SignalR; namespace ClaudeDo.Worker.Tests.External; -internal sealed class ListToolsHubClients : IHubClients -{ - public ListToolsClientProxy Proxy { get; } = new(); - public IClientProxy All => Proxy; - public IClientProxy AllExcept(IReadOnlyList e) => Proxy; - public IClientProxy Client(string c) => Proxy; - public IClientProxy Clients(IReadOnlyList c) => Proxy; - public IClientProxy Group(string g) => Proxy; - public IClientProxy GroupExcept(string g, IReadOnlyList e) => Proxy; - public IClientProxy Groups(IReadOnlyList g) => Proxy; - public IClientProxy User(string u) => Proxy; - public IClientProxy Users(IReadOnlyList u) => Proxy; -} -internal sealed class ListToolsClientProxy : IClientProxy -{ - public Task SendCoreAsync(string m, object?[] a, CancellationToken ct = default) => Task.CompletedTask; -} -internal sealed class ListToolsHubContext : IHubContext -{ - public ListToolsHubClients RecordingClients { get; } = new(); - public IHubClients Clients => RecordingClients; - public IGroupManager Groups => throw new NotImplementedException(); -} - public sealed class ListMcpToolsTests : IDisposable { private readonly DbFixture _db = new(); @@ -43,7 +18,7 @@ public sealed class ListMcpToolsTests : IDisposable { _ctx = _db.CreateContext(); _lists = new ListRepository(_ctx); - _sut = new ListMcpTools(_lists, new HubBroadcaster(new ListToolsHubContext())); + _sut = new ListMcpTools(_lists, new HubBroadcaster(new CapturingHubContext())); } public void Dispose() { _ctx.Dispose(); _db.Dispose(); }