add_comment
Add comments to Bitbucket pull requests with options for general feedback, replies, inline code comments, and code suggestions. Supports line numbers, code snippets, and multi-line replacements for precise feedback.
Instructions
Add a comment to a pull request. Supports: 1) General PR comments, 2) Replies to existing comments, 3) Inline comments on specific code lines (using line_number OR code_snippet), 4) Code suggestions for single or multi-line replacements. For inline comments, you can either provide exact line_number or use code_snippet to auto-detect the line.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
code_snippet | No | Exact code text from the diff to find and comment on. Use this instead of line_number for auto-detection. Must match exactly including whitespace (optional) | |
comment_text | Yes | The main comment text. For suggestions, this is the explanation before the code suggestion. | |
file_path | No | File path for inline comment. Required for inline comments. Example: "src/components/Button.js" (optional) | |
line_number | No | Exact line number in the file. Use this OR code_snippet, not both. Required with file_path unless using code_snippet (optional) | |
line_type | No | Type of line: ADDED (green/new lines), REMOVED (red/deleted lines), or CONTEXT (unchanged lines). Default: CONTEXT | |
match_strategy | No | How to handle multiple matches when using code_snippet. "strict": fail with detailed error showing all matches. "best": automatically pick the highest confidence match. Default: "strict" | |
parent_comment_id | No | ID of comment to reply to. Use this to create threaded conversations (optional) | |
pull_request_id | Yes | Pull request ID | |
repository | Yes | Repository slug (e.g., "my-repo") | |
search_context | No | Additional context lines to help locate the exact position when using code_snippet. Useful when the same code appears multiple times (optional) | |
suggestion | No | Replacement code for a suggestion. Creates a suggestion block that can be applied in Bitbucket UI. Requires file_path and line_number. For multi-line, include newlines in the string (optional) | |
suggestion_end_line | No | For multi-line suggestions: the last line number to replace. If not provided, only replaces the single line at line_number (optional) | |
workspace | Yes | Bitbucket workspace/project key (e.g., "PROJ") |