bb_create_pull_request_comment
Add comments to Bitbucket pull requests, including inline code line comments, structured review findings, and replies to existing comments.
Instructions
Add a comment on a PR. Inline code comments need 'anchoredTo' (file path + line number + lineType). Plain text goes in 'text'. Returns the created comment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | REQUIRED for inline comments. Exact 1-based line number of the changed line in the SOURCE branch file. Equivalently, count from the @@ hunk header's +c value through context and + lines (skip - lines). This is the number of the line in the source branch, not the target branch. | |
| prId | Yes | ||
| text | Yes | Comment body (supports inline markup). LEGACY: when no structured finding fields are supplied, this raw body is STRICTLY validated against the Review Note contract and REFUSED if it does not match (free-form finding text is never posted as-is). | |
| anchorId | No | Anchor id (returned from the comment on inline create); required to reply to an existing comment | |
| diffType | No | Anchor diffType — defaults to 'EFFECTIVE' (PR-level diff). Use 'COMMIT' if you're anchoring to a specific commit's diff. | |
| fileType | No | Anchor side — defaults to 'TO' (the destination file version). Use 'FROM' when anchoring to a line that was removed. | |
| lineType | No | Side of the diff (ADDED/CONTEXT/BEFORE vs REMOVED/AFTER) — for inline comments | |
| repoSlug | Yes | ||
| anchorType | No | Default LINE. Only use FILE when you intentionally want a file-level comment (no line). Prefer LINE. | |
| projectKey | Yes | ||
| reviewRuleId | No | Structured finding rule ID, e.g. 'AS-09'. Rendered as '#AS-09' by the formatter (never '[AS-09]'). | |
| reviewSummary | No | Structured one-line summary of the finding (<=15 words). | |
| anchoredToFile | No | Relative file path for an inline comment, e.g. 'src/foo.ts' | |
| reviewSeverity | No | Structured finding severity: CRITICAL | WARNING | SUGGESTION. Only CRITICAL/WARNING are posted by the review policy. | |
| parentCommentId | No | Replying to an existing comment? Pass that comment id here; 'anchoredTo' fields are then ignored. | |
| reviewWhatIsWrong | No | Structured 'What is wrong' clause - the defect as the code currently is, with file:line evidence. | |
| reviewWhyItMatters | No | Structured 'Why it matters' clause - the user-visible consequence. | |
| reviewSuggestedChange | No | Structured 'Suggested change' clause - one concrete fix, or 'n/a'. |