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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ All commands auto-detect the project when run from a synced directory (contains
| `olcli download <file> [project]` | Download a single file |
| `olcli comments list [project]` | List comments with source text and file locations (`--status`, `--context`) |
| `olcli comments add <file> <message> [project]` | Add a comment to selected text |
| `olcli comments reply <threadId> <body> [project]` | Reply to a comment thread |
| `olcli comments resolve <threadId> [project]` | Resolve a comment thread |
| `olcli comments reopen <threadId> [project]` | Reopen a resolved comment thread |
| `olcli comments delete <threadId> [project]` | Permanently delete a comment thread |
Expand All @@ -190,6 +191,7 @@ All commands auto-detect the project when run from a synced directory (contains
olcli comments list "My Paper" --status open --context 2
olcli comments list "My Paper" --status resolved --json
olcli comments add main.tex "Please clarify this definition" "My Paper" --text "A Skill is"
olcli comments reply 6a1a5fedbf90b811e1000001 "I have updated the definition" "My Paper"
olcli comments add main.tex "Check this sentence" "My Paper" --line 42 --column 1 --length 20 --json
olcli comments resolve 6a1a5fedbf90b811e1000001 "My Paper" --json
olcli comments reopen 6a1a5fedbf90b811e1000001 "My Paper"
Expand Down Expand Up @@ -520,6 +522,7 @@ import {
| `get_entities` | Get a flat list of all files in a project |
| `download_file` | Download a specific file by its remote path |
| `add_comment` | Add a review comment to a document |
| `reply_to_comment` | Add a reply to an existing comment thread |
| `resolve_comment` | Mark a comment thread as resolved |
| `delete_entity` | Delete a file or document by path |
| `rename_entity` | Rename a file or document |
Expand Down
24 changes: 24 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,30 @@ commentsCmd
}
});

commentsCmd
.command('reply <threadId> <body> [project]')
.description('Reply to a comment thread with a message')
.option('--json', 'Output as JSON')
.option('--cookie <session>', 'Session cookie override')
.action(async (threadId, body, project, options) => {
const spinner = ora('Posting reply...').start();
try {
const client = await getClient(options.cookie);
const proj = await resolveProject(client, project);
const message = await client.postCommentMessage(proj.id, threadId, body);
if (options.json) {
spinner.stop();
console.log(JSON.stringify({ replied: true, message }, null, 2));
return;
}
spinner.succeed(`Replied to ${threadId}`);
setLastProject(proj.id);
} catch (error: any) {
spinner.fail(`Failed: ${error.message}`);
process.exit(1);
}
});

commentsCmd
.command('resolve <threadId> [project]')
.description('Resolve a comment thread')
Expand Down
20 changes: 20 additions & 0 deletions src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ server.tool(
})
);

// ---------------------------------------------------------------------------
// Tool: reply_to_comment
// ---------------------------------------------------------------------------

server.tool(
'reply_to_comment',
'Add a reply to an existing comment thread on an Overleaf project.',
{
project_id: z.string().describe('The Overleaf project ID'),
thread_id: z.string().describe('The comment thread ID (from list_comments)'),
content: z.string().describe('The reply message text'),
},
async ({ project_id, thread_id, content }) =>
wrapTool(async () => {
const client = await getClient();
const message = await client.postCommentMessage(project_id, thread_id, content);
return { replied: true, thread_id, message };
})
);

// ---------------------------------------------------------------------------
// Tool: get_project_info
// ---------------------------------------------------------------------------
Expand Down