productivity
Bitbucket CLI for AI Agents
Use the Bitbucket CLI from KosmoKrator to call Bitbucket tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Bitbucket CLI Setup
Bitbucket can be configured headlessly with `kosmokrator integrations:configure bitbucket`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure bitbucket --set api_key="$BITBUCKET_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor bitbucket --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | BITBUCKET_API_KEY | Secret secret | yes | App Password / OAuth Token |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call bitbucket.bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json kosmo integrations:bitbucket bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs bitbucket --json
kosmo integrations:docs bitbucket.bitbucket_list_repos --json
kosmo integrations:schema bitbucket.bitbucket_list_repos --json
kosmo integrations:search "Bitbucket" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
bitbucket.bitbucket_list_repos
List repositories in a Bitbucket workspace. Supports sorting and pagination.
read - Parameters
- workspace, sort, pagelen, page
kosmo integrations:call bitbucket.bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json kosmo integrations:bitbucket bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json bitbucket.bitbucket_get_repo
Get details for a specific Bitbucket repository by workspace and repo slug.
read - Parameters
- workspace, repo_slug
kosmo integrations:call bitbucket.bitbucket_get_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug"}' --json kosmo integrations:bitbucket bitbucket_get_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug"}' --json bitbucket.bitbucket_create_repo
Create a new repository in a Bitbucket workspace. Optionally set description, visibility, and language.
write - Parameters
- workspace, repo_slug, description, is_private, language
kosmo integrations:call bitbucket.bitbucket_create_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug","description":"example_description","is_private":true,"language":"example_language"}' --json kosmo integrations:bitbucket bitbucket_create_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug","description":"example_description","is_private":true,"language":"example_language"}' --json bitbucket.bitbucket_list_issues
List issues in a Bitbucket repository. Supports filtering by state, kind, and priority.
read - Parameters
- workspace, repo_slug, state, kind, priority, pagelen
kosmo integrations:call bitbucket.bitbucket_list_issues '{"workspace":"example_workspace","repo_slug":"example_repo_slug","state":"example_state","kind":"example_kind","priority":"example_priority","pagelen":1}' --json kosmo integrations:bitbucket bitbucket_list_issues '{"workspace":"example_workspace","repo_slug":"example_repo_slug","state":"example_state","kind":"example_kind","priority":"example_priority","pagelen":1}' --json bitbucket.bitbucket_get_issue
Get details for a specific issue in a Bitbucket repository.
read - Parameters
- workspace, repo_slug, issue_id
kosmo integrations:call bitbucket.bitbucket_get_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1}' --json kosmo integrations:bitbucket bitbucket_get_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1}' --json bitbucket.bitbucket_create_issue
Create a new issue in a Bitbucket repository. Requires a title; optionally set content, kind, priority, and assignee.
write - Parameters
- workspace, repo_slug, title, content, kind, priority, assignee
kosmo integrations:call bitbucket.bitbucket_create_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","title":"example_title","content":"example_content","kind":"example_kind","priority":"example_priority","assignee":"example_assignee"}' --json kosmo integrations:bitbucket bitbucket_create_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","title":"example_title","content":"example_content","kind":"example_kind","priority":"example_priority","assignee":"example_assignee"}' --json bitbucket.bitbucket_update_issue
Update an existing issue in a Bitbucket repository. Can change title, content, state, priority, and assignee.
write - Parameters
- workspace, repo_slug, issue_id, title, content, state, priority, assignee
kosmo integrations:call bitbucket.bitbucket_update_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1,"title":"example_title","content":"example_content","state":"example_state","priority":"example_priority","assignee":"example_assignee"}' --json kosmo integrations:bitbucket bitbucket_update_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1,"title":"example_title","content":"example_content","state":"example_state","priority":"example_priority","assignee":"example_assignee"}' --json bitbucket.bitbucket_list_pull_requests
List pull requests in a Bitbucket repository. Supports filtering by state and pagination.
read - Parameters
- workspace, repo_slug, state, pagelen
kosmo integrations:call bitbucket.bitbucket_list_pull_requests '{"workspace":"example_workspace","repo_slug":"example_repo_slug","state":"example_state","pagelen":1}' --json kosmo integrations:bitbucket bitbucket_list_pull_requests '{"workspace":"example_workspace","repo_slug":"example_repo_slug","state":"example_state","pagelen":1}' --json bitbucket.bitbucket_get_pull_request
Get details for a specific pull request in a Bitbucket repository.
read - Parameters
- workspace, repo_slug, pr_id
kosmo integrations:call bitbucket.bitbucket_get_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1}' --json kosmo integrations:bitbucket bitbucket_get_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1}' --json bitbucket.bitbucket_create_pull_request
Create a new pull request in a Bitbucket repository. Requires a title, source branch, and destination branch.
write - Parameters
- workspace, repo_slug, title, description, source_branch, destination_branch, close_source_branch
kosmo integrations:call bitbucket.bitbucket_create_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","title":"example_title","description":"example_description","source_branch":"example_source_branch","destination_branch":"example_destination_branch","close_source_branch":true}' --json kosmo integrations:bitbucket bitbucket_create_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","title":"example_title","description":"example_description","source_branch":"example_source_branch","destination_branch":"example_destination_branch","close_source_branch":true}' --json bitbucket.bitbucket_merge_pull_request
Merge a Bitbucket pull request. Optionally provide a merge commit message.
write - Parameters
- workspace, repo_slug, pr_id, merge_commit_message
kosmo integrations:call bitbucket.bitbucket_merge_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1,"merge_commit_message":"example_merge_commit_message"}' --json kosmo integrations:bitbucket bitbucket_merge_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1,"merge_commit_message":"example_merge_commit_message"}' --json bitbucket.bitbucket_list_branches
List branches in a Bitbucket repository. Supports pagination.
read - Parameters
- workspace, repo_slug, pagelen
kosmo integrations:call bitbucket.bitbucket_list_branches '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pagelen":1}' --json kosmo integrations:bitbucket bitbucket_list_branches '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pagelen":1}' --json bitbucket.bitbucket_create_branch
Create a new branch in a Bitbucket repository. Requires a branch name and the target commit hash.
write - Parameters
- workspace, repo_slug, name, target_hash
kosmo integrations:call bitbucket.bitbucket_create_branch '{"workspace":"example_workspace","repo_slug":"example_repo_slug","name":"example_name","target_hash":"example_target_hash"}' --json kosmo integrations:bitbucket bitbucket_create_branch '{"workspace":"example_workspace","repo_slug":"example_repo_slug","name":"example_name","target_hash":"example_target_hash"}' --json bitbucket.bitbucket_list_commits
List commits in a Bitbucket repository. Supports filtering by revision and path.
read - Parameters
- workspace, repo_slug, revision, path, pagelen
kosmo integrations:call bitbucket.bitbucket_list_commits '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","path":"example_path","pagelen":1}' --json kosmo integrations:bitbucket bitbucket_list_commits '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","path":"example_path","pagelen":1}' --json bitbucket.bitbucket_get_file
Get the raw content of a file from a Bitbucket repository at a specific revision.
read - Parameters
- workspace, repo_slug, revision, file_path
kosmo integrations:call bitbucket.bitbucket_get_file '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","file_path":"example_file_path"}' --json kosmo integrations:bitbucket bitbucket_get_file '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","file_path":"example_file_path"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
bitbucket.bitbucket_list_repos 4 parameters
kosmo integrations:schema bitbucket.bitbucket_list_repos --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
sort | string | no | Sort field (e.g. "-updated_on", "name", "-created_on"). |
pagelen | integer | no | Number of results per page (1-100). Default: 10. |
page | string | no | Page URL or page number for pagination. |
bitbucket.bitbucket_get_repo 2 parameters
kosmo integrations:schema bitbucket.bitbucket_get_repo --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
bitbucket.bitbucket_create_repo 5 parameters
kosmo integrations:schema bitbucket.bitbucket_create_repo --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The slug for the new repository. |
description | string | no | A short description of the repository. |
is_private | boolean | no | Whether the repository should be private. Default: true. |
language | string | no | The main language of the repository (e.g. "python", "javascript"). |
bitbucket.bitbucket_list_issues 6 parameters
kosmo integrations:schema bitbucket.bitbucket_list_issues --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
state | string | no | Filter by issue state: new, open, resolved, closed, on hold, wontfix, duplicate, invalid. |
kind | string | no | Filter by kind: bug, enhancement, proposal, task. |
priority | string | no | Filter by priority: trivial, minor, major, critical, blocker. |
pagelen | integer | no | Number of results per page (1-100). Default: 10. |
bitbucket.bitbucket_get_issue 3 parameters
kosmo integrations:schema bitbucket.bitbucket_get_issue --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
issue_id | integer | yes | The issue identifier. |
bitbucket.bitbucket_create_issue 7 parameters
kosmo integrations:schema bitbucket.bitbucket_create_issue --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
title | string | yes | The title of the issue. |
content | string | no | The issue description (Markdown supported). |
kind | string | no | Issue kind: bug, enhancement, proposal, task. Default: bug. |
priority | string | no | Issue priority: trivial, minor, major, critical, blocker. Default: major. |
assignee | string | no | The UUID of the user to assign the issue to. |
bitbucket.bitbucket_update_issue 8 parameters
kosmo integrations:schema bitbucket.bitbucket_update_issue --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
issue_id | integer | yes | The issue identifier. |
title | string | no | The new title of the issue. |
content | string | no | The new issue description (Markdown supported). |
state | string | no | New state: new, open, resolved, closed, on hold, wontfix, duplicate, invalid. |
priority | string | no | New priority: trivial, minor, major, critical, blocker. |
assignee | string | no | The UUID of the user to assign the issue to. |
bitbucket.bitbucket_list_pull_requests 4 parameters
kosmo integrations:schema bitbucket.bitbucket_list_pull_requests --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
state | string | no | Filter by state: OPEN, MERGED, DECLINED, SUPERSEDED. |
pagelen | integer | no | Number of results per page (1-100). Default: 10. |
bitbucket.bitbucket_get_pull_request 3 parameters
kosmo integrations:schema bitbucket.bitbucket_get_pull_request --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
pr_id | integer | yes | The pull request identifier. |
bitbucket.bitbucket_create_pull_request 7 parameters
kosmo integrations:schema bitbucket.bitbucket_create_pull_request --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
title | string | yes | The title of the pull request. |
description | string | no | The pull request description (Markdown supported). |
source_branch | string | yes | The name of the source branch. |
destination_branch | string | no | The name of the destination branch. Default: main. |
close_source_branch | boolean | no | Whether to close the source branch after merge. Default: false. |
bitbucket.bitbucket_merge_pull_request 4 parameters
kosmo integrations:schema bitbucket.bitbucket_merge_pull_request --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
pr_id | integer | yes | The pull request identifier. |
merge_commit_message | string | no | An optional message for the merge commit. |
bitbucket.bitbucket_list_branches 3 parameters
kosmo integrations:schema bitbucket.bitbucket_list_branches --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
pagelen | integer | no | Number of results per page (1-100). Default: 10. |
bitbucket.bitbucket_create_branch 4 parameters
kosmo integrations:schema bitbucket.bitbucket_create_branch --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
name | string | yes | The name for the new branch. |
target_hash | string | yes | The commit hash to branch from. |
bitbucket.bitbucket_list_commits 5 parameters
kosmo integrations:schema bitbucket.bitbucket_list_commits --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
revision | string | no | A commit hash, branch name, or tag to list commits for. |
path | string | no | Filter commits to those affecting a specific file path. |
pagelen | integer | no | Number of results per page (1-100). Default: 10. |
bitbucket.bitbucket_get_file 4 parameters
kosmo integrations:schema bitbucket.bitbucket_get_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
workspace | string | yes | The workspace slug or UUID. |
repo_slug | string | yes | The repository slug. |
revision | string | yes | A commit hash, branch name, or tag. |
file_path | string | yes | The path to the file within the repository. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.