Skip to content

Commit 2350e6f

Browse files
Claudeclaude
authored andcommitted
fix: replace ASCII box tables with markdown tables in thread tools
list_threads and cleanup_threads used fixed-width ASCII box-drawing tables that truncated thread text to 40-48 chars. New users seeing clipped output would think the tool is broken. Now emits markdown tables that render cleanly in any MCP client with 60-char thread text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fe1515b commit 2350e6f

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

src/tools/cleanup-threads.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,16 @@ function buildCleanupDisplay(
100100

101101
for (const [label, items] of sections) {
102102
if (items.length === 0) continue;
103-
lines.push(`${label} (${items.length}):`);
103+
lines.push(`**${label}** (${items.length}):`);
104+
lines.push("");
105+
lines.push("| ID | Thread | Last Touch |");
106+
lines.push("|----|--------|------------|");
104107
for (const t of items) {
105-
const text = truncate(t.text, 48);
108+
const text = truncate(t.text, 60);
106109
const time = formatDaysAgo(t.days_since_touch);
107-
lines.push(` ${t.thread_id} ${text.padEnd(50)} ${time.padStart(8)}`);
110+
lines.push(`| ${t.thread_id} | ${text} | ${time} |`);
108111
}
112+
lines.push("");
109113
}
110114

111115
lines.push("");

src/tools/list-threads.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,16 @@ function buildThreadsDisplay(
6464
a.created_at.localeCompare(b.created_at)
6565
);
6666

67-
const NUM_W = 3;
68-
const ID_W = 12;
69-
const TEXT_W = 40;
70-
const DATE_W = 8;
71-
const hr = (l: string, j: string, r: string) =>
72-
`${l}${"─".repeat(NUM_W + 2)}${j}${"─".repeat(ID_W + 2)}${j}${"─".repeat(TEXT_W + 2)}${j}${"─".repeat(DATE_W + 2)}${r}`;
73-
const hdr = (l: string, j: string, r: string) =>
74-
`${l}${"═".repeat(NUM_W + 2)}${j}${"═".repeat(ID_W + 2)}${j}${"═".repeat(TEXT_W + 2)}${j}${"═".repeat(DATE_W + 2)}${r}`;
75-
const row = (n: string, id: string, t: string, d: string) =>
76-
`│ ${n.padEnd(NUM_W)}${id.padEnd(ID_W)}${t.padEnd(TEXT_W)}${d.padStart(DATE_W)} │`;
77-
78-
lines.push(hr("┌", "┬", "┐"));
79-
lines.push(row("#", "ID", "Thread", "Active"));
80-
lines.push(hdr("╞", "╪", "╡"));
67+
// Markdown table — renders cleanly in all MCP clients
68+
lines.push("| # | ID | Thread | Active |");
69+
lines.push("|---|-----|--------|--------|");
8170
for (let i = 0; i < sorted.length; i++) {
8271
const t = sorted[i];
83-
const shortId = truncate(t.id, ID_W);
84-
const text = truncate(t.text, TEXT_W);
72+
const shortId = t.id;
73+
const text = truncate(t.text, 60);
8574
const date = shortDate(t.last_touched_at || t.created_at);
86-
lines.push(row(`${i + 1}.`, shortId, text, date));
75+
lines.push(`| ${i + 1} | ${shortId} | ${text} | ${date} |`);
8776
}
88-
lines.push(hr("└", "┴", "┘"));
8977

9078
return wrapDisplay(lines.join("\n"));
9179
}

0 commit comments

Comments
 (0)