add_pr_comment
Add comments to Bitbucket Cloud pull requests for general feedback or specific file/line discussions. Use this tool to provide code reviews, ask questions, or share insights directly within pull requests.
Instructions
Add a comment to a pull request. Can be a general comment or an inline comment on a specific file/line.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| pr_id | Yes | The pull request ID | |
| content | Yes | Comment content (markdown) | |
| path | No | File path for inline comment | |
| line | No | Line number for inline comment |
Implementation Reference
- src/tools/index.ts:970-980 (handler)Handler for the 'add_pr_comment' tool: parses input parameters using the Zod schema, constructs inline comment object if path and line provided, and delegates to PullRequestsAPI.addComment method.case 'add_pr_comment': { const params = toolSchemas.add_pr_comment.parse(args); const inline = params.path ? { path: params.path, line: params.line } : undefined; return this.prs.addComment( params.workspace, params.repo_slug, params.pr_id, params.content, inline ); }
- src/tools/index.ts:131-138 (schema)Zod input schema definition for the 'add_pr_comment' tool, defining required and optional parameters with descriptions.add_pr_comment: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), pr_id: z.number().describe('The pull request ID'), content: z.string().describe('Comment content (markdown)'), path: z.string().optional().describe('File path for inline comment'), line: z.number().optional().describe('Line number for inline comment'), }),
- src/tools/index.ts:538-554 (registration)Registration of the 'add_pr_comment' tool in the toolDefinitions array, including name, description, and JSON schema for MCP compatibility.{ name: 'add_pr_comment', description: 'Add a comment to a pull request. Can be a general comment or an inline comment on a specific file/line.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, pr_id: { type: 'number', description: 'The pull request ID' }, content: { type: 'string', description: 'Comment content (markdown)' }, path: { type: 'string', description: 'File path for inline comment' }, line: { type: 'number', description: 'Line number for inline comment' }, }, required: ['workspace', 'repo_slug', 'pr_id', 'content'], }, },