From ff49a7bea893007ec9c0dd633832dded5f97bf21 Mon Sep 17 00:00:00 2001 From: Sam Bobb Date: Sun, 10 May 2026 14:57:05 -0600 Subject: [PATCH] Fix wtc_list MCP tool always reporting status as "up" `docker compose -p ps --format json` exits 0 with empty output for a project that doesn't exist, so the previous `execSafe(...) !== null` check treated every worktree as up regardless of whether its compose stack was actually running. The CLI's `listCommand` already guards against this with a `result.length > 2` check (in src/commands/list.ts). Apply the same guard in the MCP server's `listWorktrees` so its `status` field matches the CLI output. --- src/mcp/server.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 60b6c93..cae00af 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -73,10 +73,11 @@ function listWorktrees(): object { const idx = i + 1; const project = composeProjectName(ctx.repoName, idx, wt.branch); const allocations = allocateWorktreePorts(ctx.portMappings, idx); - const up = - execSafe(`docker compose -p "${project}" ps --format json`, { - cwd: wt.path, - }) !== null; + const psOutput = execSafe( + `docker compose -p "${project}" ps --format json`, + { cwd: wt.path }, + ); + const up = psOutput !== null && psOutput.length > 2; return { index: idx,