bitbucket_reply_to_comment
Reply to a specific comment on a Bitbucket pull request with a text message.
Instructions
Reply to a comment on a pull request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project key | |
| repo | Yes | Repository slug | |
| prId | Yes | Pull request ID | |
| commentId | Yes | Parent comment ID | |
| text | Yes | Reply text |
Implementation Reference
- src/tools/pr-tools.ts:259-289 (handler)Handler function for the bitbucket_reply_to_comment tool. Validates input using replyToCommentShape, requires 'write_pr' permission, calls prApi.replyToComment(), invalidates PR cache, and returns the result.
bitbucket_reply_to_comment: async (args: unknown): Promise<McpToolResult> => { const start = Date.now(); try { const input = z.object(replyToCommentShape).parse(args); requirePermission(config, 'write_pr'); log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_reply_to_comment', }); const result = await prApi.replyToComment( input.project, input.repo, input.prId, input.commentId, input.text ); invalidatePrCache(cache, config, input.project, input.repo, input.prId); log('info', 'tool end', { toolName: 'bitbucket_reply_to_comment', durationMs: Date.now() - start, }); return textResult(result); } catch (err) { log('error', 'tool error', { toolName: 'bitbucket_reply_to_comment', error: String(err), durationMs: Date.now() - start, }); return errorResult('REPLY_FAILED', err instanceof Error ? err.message : String(err)); } }, - src/tools/schemas.ts:50-54 (schema)Zod schema (ZodRawShape) defining the input shape for bitbucket_reply_to_comment. Extends prRefShape (project, repo, prId) and adds commentId and text fields.
export const replyToCommentShape = { ...prRefShape, commentId: z.coerce.number().int().positive().describe('Parent comment ID'), text: z.string().min(1).describe('Reply text'), } as const; - src/tools/registry.ts:99-104 (registration)Registration entry for the bitbucket_reply_to_comment tool in the tool registry, linking name, description, input shape, and handler.
{ name: 'bitbucket_reply_to_comment', description: 'Reply to a comment on a pull request', shape: replyToCommentShape, handler: h.pr.bitbucket_reply_to_comment, }, - Bitbucket API method that sends a POST request to create a reply comment with a parent comment ID.
async replyToComment( project: string, repo: string, prId: number, commentId: number, text: string ): Promise<BitbucketComment> { return this.client.requestJson<BitbucketComment>( `/projects/${project}/repos/${repo}/pull-requests/${prId}/comments`, { method: 'POST', body: { text, parent: { id: commentId } } } ); } - src/tools/schemas.ts:32-32 (schema)Base schema reused by replyToCommentShape, providing project, repo, and prId fields.
export const prRefShape = { project, repo, prId } as const;