Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dist/server/mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ function createMcpServer(manager) {
console.log(`MCP_ADD_DOCUMENT slug=${found.slug} item=${itemId} title="${itemTitle}" path=${path}`);
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
});
server.tool('remove_document', 'Remove a document tab (and its comments) from the review UI. Pass the item id as returned by add_document / listed in its items array. The diff tab cannot be removed.', {
repoPath: z.string().describe('Absolute path to the git repository'),
item: z.string().describe('Item ID of the document tab to remove'),
}, async ({ repoPath, item }) => {
const { found } = resolveProject(manager, repoPath, server);
const ok = found.session.removeItem(item);
if (ok)
found.session.broadcast('items_changed', { removed: item });
console.log(`MCP_REMOVE_DOCUMENT slug=${found.slug} item=${item} ok=${ok}`);
const payload = ok
? { ok: true, removed: item, items: found.session.items }
: { ok: false, error: 'Item not found or not removable ("diff" cannot be removed).', items: found.session.items };
return { content: [{ type: 'text', text: JSON.stringify(payload) }] };
});
server.tool('comment', 'Add comments from Claude to a review item (diff or document). Comments appear inline in the review UI for the user to reply to, resolve, or dismiss. Use the file+line fields for diff comments, or the block field for document comments.', {
repoPath: z.string().describe('Absolute path to the git repository'),
item: z.string().optional().describe('Item ID to comment on (default: "diff")'),
Expand Down
19 changes: 19 additions & 0 deletions server/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ function createMcpServer(manager: SessionManager): McpServer {
},
);

server.tool(
'remove_document',
'Remove a document tab (and its comments) from the review UI. Pass the item id as returned by add_document / listed in its items array. The diff tab cannot be removed.',
{
repoPath: z.string().describe('Absolute path to the git repository'),
item: z.string().describe('Item ID of the document tab to remove'),
},
async ({ repoPath, item }) => {
const { found } = resolveProject(manager, repoPath, server);
const ok = found.session.removeItem(item);
if (ok) found.session.broadcast('items_changed', { removed: item });
console.log(`MCP_REMOVE_DOCUMENT slug=${found.slug} item=${item} ok=${ok}`);
const payload = ok
? { ok: true, removed: item, items: found.session.items }
: { ok: false, error: 'Item not found or not removable ("diff" cannot be removed).', items: found.session.items };
return { content: [{ type: 'text' as const, text: JSON.stringify(payload) }] };
},
);

server.tool(
'comment',
'Add comments from Claude to a review item (diff or document). Comments appear inline in the review UI for the user to reply to, resolve, or dismiss. Use the file+line fields for diff comments, or the block field for document comments.',
Expand Down
Loading