repo_reply_to_comment
Respond to pull request comments in Azure DevOps repositories by specifying repository, PR, thread IDs, and content. Simplify collaboration with direct replies using PAT authentication.
Instructions
Replies to a specific comment on a pull request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content of the comment to be added. | |
| fullResponse | No | Return full comment JSON response instead of a simple confirmation message. | |
| project | No | Project ID or project name (optional) | |
| pullRequestId | Yes | The ID of the pull request where the comment thread exists. | |
| repositoryId | Yes | The ID of the repository where the pull request is located. | |
| threadId | Yes | The ID of the thread to which the comment will be added. |
Implementation Reference
- src/tools/repos.ts:604-627 (handler)The handler function that implements the core logic of the 'repo_reply_to_comment' tool by calling gitApi.createComment to reply to a comment in a pull request thread.async ({ repositoryId, pullRequestId, threadId, content, project, fullResponse }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const comment = await gitApi.createComment({ content }, repositoryId, pullRequestId, threadId, project); // Check if the comment was successfully created if (!comment) { return { content: [{ type: "text", text: `Error: Failed to add comment to thread ${threadId}. The comment was not created successfully.` }], isError: true, }; } if (fullResponse) { return { content: [{ type: "text", text: JSON.stringify(comment, null, 2) }], }; } return { content: [{ type: "text", text: `Comment successfully added to thread ${threadId}.` }], }; } );
- src/tools/repos.ts:597-603 (schema)Zod input schema defining the parameters for the 'repo_reply_to_comment' tool.repositoryId: z.string().describe("The ID of the repository where the pull request is located."), pullRequestId: z.number().describe("The ID of the pull request where the comment thread exists."), threadId: z.number().describe("The ID of the thread to which the comment will be added."), content: z.string().describe("The content of the comment to be added."), project: z.string().optional().describe("Project ID or project name (optional)"), fullResponse: z.boolean().optional().default(false).describe("Return full comment JSON response instead of a simple confirmation message."), },
- src/tools/repos.ts:593-628 (registration)The server.tool registration call that registers the 'repo_reply_to_comment' tool with the MCP server, including schema and handler.server.tool( REPO_TOOLS.reply_to_comment, "Replies to a specific comment on a pull request.", { repositoryId: z.string().describe("The ID of the repository where the pull request is located."), pullRequestId: z.number().describe("The ID of the pull request where the comment thread exists."), threadId: z.number().describe("The ID of the thread to which the comment will be added."), content: z.string().describe("The content of the comment to be added."), project: z.string().optional().describe("Project ID or project name (optional)"), fullResponse: z.boolean().optional().default(false).describe("Return full comment JSON response instead of a simple confirmation message."), }, async ({ repositoryId, pullRequestId, threadId, content, project, fullResponse }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const comment = await gitApi.createComment({ content }, repositoryId, pullRequestId, threadId, project); // Check if the comment was successfully created if (!comment) { return { content: [{ type: "text", text: `Error: Failed to add comment to thread ${threadId}. The comment was not created successfully.` }], isError: true, }; } if (fullResponse) { return { content: [{ type: "text", text: JSON.stringify(comment, null, 2) }], }; } return { content: [{ type: "text", text: `Comment successfully added to thread ${threadId}.` }], }; } );
- src/tools/repos.ts:25-44 (registration)REPO_TOOLS constant that defines the mapping from internal name 'reply_to_comment' to the MCP tool name 'repo_reply_to_comment'.const REPO_TOOLS = { list_repos_by_project: "repo_list_repos_by_project", list_pull_requests_by_repo: "repo_list_pull_requests_by_repo", list_pull_requests_by_project: "repo_list_pull_requests_by_project", list_branches_by_repo: "repo_list_branches_by_repo", list_my_branches_by_repo: "repo_list_my_branches_by_repo", list_pull_request_threads: "repo_list_pull_request_threads", list_pull_request_thread_comments: "repo_list_pull_request_thread_comments", get_repo_by_name_or_id: "repo_get_repo_by_name_or_id", get_branch_by_name: "repo_get_branch_by_name", get_pull_request_by_id: "repo_get_pull_request_by_id", create_pull_request: "repo_create_pull_request", update_pull_request: "repo_update_pull_request", update_pull_request_reviewers: "repo_update_pull_request_reviewers", reply_to_comment: "repo_reply_to_comment", create_pull_request_thread: "repo_create_pull_request_thread", resolve_comment: "repo_resolve_comment", search_commits: "repo_search_commits", list_pull_requests_by_commits: "repo_list_pull_requests_by_commits", };