Skip to main content
Glama
RajuSudhar

Atlassian Bitbucket MCP Server

by RajuSudhar

bitbucket_get_branches

List all branches in a Bitbucket repository by specifying project key and repo slug. Supports pagination and result limits.

Instructions

List repository branches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesProject key
repoYesRepository slug
limitNoMax results
startNoPagination start

Implementation Reference

  • Handler function for bitbucket_get_branches tool. Parses input with repoPaginatedShape (project, repo, limit, start), checks 'read_repo' permission, calls repoApi.getBranches(), and returns the result.
    bitbucket_get_branches: async (args: unknown): Promise<McpToolResult> => {
      const start = Date.now();
      try {
        const input = z.object(repoPaginatedShape).parse(args);
        requirePermission(config, 'read_repo');
        log('info', 'tool start', {
          operation: 'tool_execute',
          toolName: 'bitbucket_get_branches',
        });
        const result = await repoApi.getBranches(
          input.project,
          input.repo,
          input.limit,
          input.start
        );
        log('info', 'tool end', {
          toolName: 'bitbucket_get_branches',
          durationMs: Date.now() - start,
        });
        return textResult(result);
      } catch (err) {
        log('error', 'tool error', {
          toolName: 'bitbucket_get_branches',
          error: String(err),
          durationMs: Date.now() - start,
        });
        return errorResult('GET_BRANCHES_FAILED', err instanceof Error ? err.message : String(err));
      }
    },
  • Input schema for bitbucket_get_branches: extends repoRefShape (project, repo) with optional limit and start pagination fields.
    export const repoPaginatedShape = { ...repoRefShape, limit, start } as const;
  • Registers bitbucket_get_branches tool with name, description, input shape repoPaginatedShape, and handler from repo tools.
    {
      name: 'bitbucket_get_branches',
      description: 'List repository branches',
      shape: repoPaginatedShape,
      handler: h.repo.bitbucket_get_branches,
    },
  • RepositoryApi.getBranches method - makes HTTP GET request to Bitbucket REST API /projects/{project}/repos/{repo}/branches with pagination params.
    async getBranches(
      project: string,
      repo: string,
      limit = 25,
      start = 0
    ): Promise<BitbucketPagedResponse<BitbucketBranch>> {
      return this.client.requestJson<BitbucketPagedResponse<BitbucketBranch>>(
        `/projects/${project}/repos/${repo}/branches`,
        { queryParams: { limit, start } }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must provide behavioral context. It only says 'List repository branches' without mentioning pagination, ordering, or what happens on empty results. This is minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no waste. It is front-loaded and appropriately concise for a simple listing tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema and no annotations; the description does not explain the return format, pagination behavior, or any edge cases. For a tool with 4 parameters, it is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already defines each parameter. The description adds no additional meaning beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the action (list) and resource (repository branches). It is distinct from sibling tools that list repositories or get repository details. However, it does not specify that it requires project and repo parameters, which is inferred from the schema but not described.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like bitbucket_list_repositories or bitbucket_get_repository. No exclusions or context are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RajuSudhar/atlassian-bitbucket-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server