Bitbucket Integration
Overview
Bitbucket code repository integration for managing repositories, branches, pull requests, issues, and CI/CD pipelines.
Connected account: {display_name}
Use bitbucket_repos(action='list_repos', workspace='WS') or bitbucket_repos(action='list_workspaces') to discover connected repos.
Workspace and repository auto-resolve from saved user selection if not passed explicitly.
Instructions
Tools (6 tools, 44 actions)
bitbucket_repos -- Repository, File & Code Operations:
list_repos,get_repo,get_file_contents,find_in_file,edit_file,create_or_update_file,delete_fileget_directory_tree,search_code,list_workspaces,get_workspace
bitbucket_branches -- Branch & Commit Operations:
list_branches,create_branch,delete_branch,list_commits,get_commit,get_diff,compare
bitbucket_pull_requests -- Pull Request Operations:
list_prs,get_pr,create_pr,update_pr,merge_pr,approve_pr,unapprove_pr,decline_prlist_pr_comments,add_pr_comment,get_pr_diff,get_pr_activity
bitbucket_issues -- Issue Operations:
list_issues,get_issue,create_issue,update_issue,list_issue_comments,add_issue_comment
bitbucket_pipelines -- CI/CD Pipeline Operations:
list_pipelines,get_pipeline,trigger_pipeline,stop_pipelinelist_pipeline_steps,get_step_log,get_pipeline_step
Reading & Editing Repo Files
- Prefer
edit_file(anchored search-and-replace applied server-side against the true current file) for ANY change to an existing file. Usecreate_or_update_fileONLY for brand-new paths — never to overwrite a file you already read via a full-content upload. - First read the file with
get_file_contentsand copyold_stringbyte-for-byte from the output. Keepold_stringnarrow — the changed lines plus 1-3 lines of surrounding context. Do NOT pass the whole file asold_string. - Large files come back in verbatim pages. The page header says
[lines X-Y of N — pass start_line=<n> commit=<sha> to continue](orstart_char=<offset>for one oversized line) — follow it verbatim to read further; thecommit=<sha>pin keeps every page on the same file version even if the branch moves. Every page is exact file content, never a summary. - Big-file workflow:
find_in_file(locate the lines to change, returnsL<line>: <text>matches plus the resolvedcommit) →get_file_contentswithstart_line=<match line>and thatcommit(read that region verbatim) →edit_filewith narrow anchors. You do not need the whole file in context to edit it.find_in_filematches your query as a literal substring first, then as a regex. - One
edit_filecall can carry several edits (scattered locations = one commit); multiple files = multipleedit_filecalls on the same branch = one PR. - A comments-only config file is never a valid change. To remove a resource, delete its block; to change a value, edit it — do not replace file contents with a comment.
- During Aurora Actions / interactive chat: create a branch, apply
edit_fileon that branch, then open a PR. During background RCA: repo tools are read-only — usebitbucket_fixto propose changes instead.
bitbucket_fix -- Suggest Code Fixes During RCA:
- Use when you identify a specific code change that would fix the root cause
- Accepts anchored search-and-replace edits (old_string → new_string)
- Fetches the current file, applies edits, and saves the suggestion for user review
- The user can then review, edit, and create a PR from the Incidents UI
- Parameters:
file_path,edits(list of {old_string, new_string, replace_all}),fix_description,root_cause_summary - Optional:
repo(workspace/repo_slug),commit_message,branch
RCA Investigation Flow
- List connected repos in the workspace:
bitbucket_repos(action='list_repos', workspace='WS') - Check recent commits for changes that may correlate with the alert:
bitbucket_branches(action='list_commits', workspace='WS', repo_slug='REPO') - Check recent PRs for merged changes:
bitbucket_pull_requests(action='list_prs', workspace='WS', repo_slug='REPO', state='MERGED') - Check pipeline runs for deployment failures:
bitbucket_pipelines(action='list_pipelines', workspace='WS', repo_slug='REPO') - Get step-level logs for failed pipelines:
bitbucket_pipelines(action='get_step_log', workspace='WS', repo_slug='REPO', pipeline_uuid='UUID', step_uuid='UUID') - Inspect diffs for suspicious commits:
bitbucket_branches(action='get_diff', workspace='WS', repo_slug='REPO', spec='COMMIT_SHA') - If a root cause code change is identified, propose a fix:
bitbucket_fix(file_path='path/to/file', edits=[{old_string: '...', new_string: '...'}], fix_description='...', root_cause_summary='...')
Tool Usage Rules
list_reposandlist_workspacesreturn only the repos/workspaces the user has connected — not everything in their Bitbucket account.- When user asks about PRs, issues, repos, or branches WITHOUT specifying a repository, use the selected workspace/repo from context.
- Workspace and
repo_slugauto-resolve from saved selection if not passed explicitly. - During background RCA: tools are READ-ONLY. Do NOT manually create branches, commit files, or create PRs. Use
bitbucket_fixto propose code changes — it saves suggestions for user review. - Destructive actions (delete branch, delete file, merge PR, decline PR, trigger/stop pipeline) require user confirmation and will prompt automatically.
- Non-destructive operations (create branch, create PR, update PR, approve, comment, create issue) proceed without extra confirmation.
bitbucket_fixdoes NOT modify the repo directly — it saves the suggestion for user review. No confirmation needed.- If no repository is selected and user doesn't specify one, ask which repository they want to work with.
Important Rules
- Look for: config changes, k8s manifests, Terraform, dependency updates.
- Check pipeline logs when builds fail near the incident time.
- Cross-reference commit history with deployment timing.
- When you identify the problematic code change during RCA, use
bitbucket_fixto propose a revert or correction. - During background RCA, NEVER manually create a branch + commit file + create PR — use
bitbucket_fixinstead; the user will create the PR from the Incidents UI after reviewing your suggestion. During Aurora Actions / interactive chat, the branch →edit_file→ PR workflow described above IS the correct way to ship a change.