KosmoKrator

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.

15 functions 9 read 6 write API key auth

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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key BITBUCKET_API_KEY Secret secret yes App Password / OAuth Token

Call Bitbucket Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call bitbucket.bitbucket_list_repos '{
  "workspace": "example_workspace",
  "sort": "example_sort",
  "pagelen": 1,
  "page": "example_page"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:bitbucket bitbucket_list_repos '{
  "workspace": "example_workspace",
  "sort": "example_sort",
  "pagelen": 1,
  "page": "example_page"
}' --json

Agent Discovery Commands

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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Bitbucket.

bitbucket.bitbucket_list_repos

Read read

List repositories in a Bitbucket workspace. Supports sorting and pagination.

Parameters
workspace, sort, pagelen, page

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json

Provider shortcut

kosmo integrations:bitbucket bitbucket_list_repos '{"workspace":"example_workspace","sort":"example_sort","pagelen":1,"page":"example_page"}' --json

bitbucket.bitbucket_get_repo

Read read

Get details for a specific Bitbucket repository by workspace and repo slug.

Parameters
workspace, repo_slug

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_get_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug"}' --json

Provider shortcut

kosmo integrations:bitbucket bitbucket_get_repo '{"workspace":"example_workspace","repo_slug":"example_repo_slug"}' --json

bitbucket.bitbucket_create_repo

Write write

Create a new repository in a Bitbucket workspace. Optionally set description, visibility, and language.

Parameters
workspace, repo_slug, description, is_private, language

Generic CLI call

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

Provider shortcut

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

Read read

List issues in a Bitbucket repository. Supports filtering by state, kind, and priority.

Parameters
workspace, repo_slug, state, kind, priority, pagelen

Generic CLI call

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

Provider shortcut

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

Read read

Get details for a specific issue in a Bitbucket repository.

Parameters
workspace, repo_slug, issue_id

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_get_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1}' --json

Provider shortcut

kosmo integrations:bitbucket bitbucket_get_issue '{"workspace":"example_workspace","repo_slug":"example_repo_slug","issue_id":1}' --json

bitbucket.bitbucket_create_issue

Write write

Create a new issue in a Bitbucket repository. Requires a title; optionally set content, kind, priority, and assignee.

Parameters
workspace, repo_slug, title, content, kind, priority, assignee

Generic CLI call

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

Provider shortcut

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

Write write

Update an existing issue in a Bitbucket repository. Can change title, content, state, priority, and assignee.

Parameters
workspace, repo_slug, issue_id, title, content, state, priority, assignee

Generic CLI call

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

Provider shortcut

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

Read read

List pull requests in a Bitbucket repository. Supports filtering by state and pagination.

Parameters
workspace, repo_slug, state, pagelen

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_list_pull_requests '{"workspace":"example_workspace","repo_slug":"example_repo_slug","state":"example_state","pagelen":1}' --json

Provider shortcut

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

Read read

Get details for a specific pull request in a Bitbucket repository.

Parameters
workspace, repo_slug, pr_id

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_get_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1}' --json

Provider shortcut

kosmo integrations:bitbucket bitbucket_get_pull_request '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pr_id":1}' --json

bitbucket.bitbucket_create_pull_request

Write write

Create a new pull request in a Bitbucket repository. Requires a title, source branch, and destination branch.

Parameters
workspace, repo_slug, title, description, source_branch, destination_branch, close_source_branch

Generic CLI call

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

Provider shortcut

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

Write write

Merge a Bitbucket pull request. Optionally provide a merge commit message.

Parameters
workspace, repo_slug, pr_id, merge_commit_message

Generic CLI call

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

Provider shortcut

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

Read read

List branches in a Bitbucket repository. Supports pagination.

Parameters
workspace, repo_slug, pagelen

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_list_branches '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pagelen":1}' --json

Provider shortcut

kosmo integrations:bitbucket bitbucket_list_branches '{"workspace":"example_workspace","repo_slug":"example_repo_slug","pagelen":1}' --json

bitbucket.bitbucket_create_branch

Write write

Create a new branch in a Bitbucket repository. Requires a branch name and the target commit hash.

Parameters
workspace, repo_slug, name, target_hash

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_create_branch '{"workspace":"example_workspace","repo_slug":"example_repo_slug","name":"example_name","target_hash":"example_target_hash"}' --json

Provider shortcut

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

Read read

List commits in a Bitbucket repository. Supports filtering by revision and path.

Parameters
workspace, repo_slug, revision, path, pagelen

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_list_commits '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","path":"example_path","pagelen":1}' --json

Provider shortcut

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

Read read

Get the raw content of a file from a Bitbucket repository at a specific revision.

Parameters
workspace, repo_slug, revision, file_path

Generic CLI call

kosmo integrations:call bitbucket.bitbucket_get_file '{"workspace":"example_workspace","repo_slug":"example_repo_slug","revision":"example_revision","file_path":"example_file_path"}' --json

Provider shortcut

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

List repositories in a Bitbucket workspace. Supports sorting and pagination.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_list_repos --json
ParameterTypeRequiredDescription
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

Get details for a specific Bitbucket repository by workspace and repo slug.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_get_repo --json
ParameterTypeRequiredDescription
workspace string yes The workspace slug or UUID.
repo_slug string yes The repository slug.

bitbucket.bitbucket_create_repo

Create a new repository in a Bitbucket workspace. Optionally set description, visibility, and language.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_create_repo --json
ParameterTypeRequiredDescription
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

List issues in a Bitbucket repository. Supports filtering by state, kind, and priority.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_list_issues --json
ParameterTypeRequiredDescription
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

Get details for a specific issue in a Bitbucket repository.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_get_issue --json
ParameterTypeRequiredDescription
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

Create a new issue in a Bitbucket repository. Requires a title; optionally set content, kind, priority, and assignee.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_create_issue --json
ParameterTypeRequiredDescription
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

Update an existing issue in a Bitbucket repository. Can change title, content, state, priority, and assignee.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_update_issue --json
ParameterTypeRequiredDescription
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

List pull requests in a Bitbucket repository. Supports filtering by state and pagination.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_list_pull_requests --json
ParameterTypeRequiredDescription
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

Get details for a specific pull request in a Bitbucket repository.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_get_pull_request --json
ParameterTypeRequiredDescription
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

Create a new pull request in a Bitbucket repository. Requires a title, source branch, and destination branch.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_create_pull_request --json
ParameterTypeRequiredDescription
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

Merge a Bitbucket pull request. Optionally provide a merge commit message.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_merge_pull_request --json
ParameterTypeRequiredDescription
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

List branches in a Bitbucket repository. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_list_branches --json
ParameterTypeRequiredDescription
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

Create a new branch in a Bitbucket repository. Requires a branch name and the target commit hash.

Operation
Write write
Schema command
kosmo integrations:schema bitbucket.bitbucket_create_branch --json
ParameterTypeRequiredDescription
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

List commits in a Bitbucket repository. Supports filtering by revision and path.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_list_commits --json
ParameterTypeRequiredDescription
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

Get the raw content of a file from a Bitbucket repository at a specific revision.

Operation
Read read
Schema command
kosmo integrations:schema bitbucket.bitbucket_get_file --json
ParameterTypeRequiredDescription
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.