Skip to main content
Glama
garc33

Bitbucket Server MCP

by garc33

list_repositories

Browse repositories within a Bitbucket project or across all accessible projects to find repository slugs, explore codebases, and understand repository structure.

Instructions

Browse and discover repositories within a specific project or across all accessible projects. Use this to find repository slugs, explore codebases, or understand the repository structure. Returns repository names, slugs, clone URLs, and project associations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoBitbucket project key to list repositories from. If omitted, uses BITBUCKET_DEFAULT_PROJECT or lists all accessible repositories across projects.
limitNoNumber of repositories to return (default: 25, max: 1000)
startNoStart index for pagination (default: 0)

Implementation Reference

  • The primary handler function that fetches and formats the list of repositories from Bitbucket Server/Data Center API, either from a specific project or all accessible repositories.
    private async listRepositories(options: ListRepositoriesOptions = {}) {
      const { project, limit = 25, start = 0 } = options;
      
      let endpoint: string;
      const params = { limit, start };
    
      if (project || this.config.defaultProject) {
        // List repositories for a specific project
        const projectKey = project || this.config.defaultProject;
        endpoint = `/projects/${projectKey}/repos`;
      } else {
        // List all accessible repositories
        endpoint = '/repos';
      }
    
      const response = await this.api.get(endpoint, { params });
    
      const repositories = response.data.values || [];
      const summary = {
        project: project || this.config.defaultProject || 'all',
        total: response.data.size || repositories.length,
        showing: repositories.length,
        repositories: repositories.map((repo: { 
          slug: string; 
          name: string; 
          description?: string; 
          project?: { key: string }; 
          public: boolean; 
          links?: { clone?: { name: string; href: string }[] }; 
          state: string 
        }) => ({
          slug: repo.slug,
          name: repo.name,
          description: repo.description,
          project: repo.project?.key,
          public: repo.public,
          cloneUrl: repo.links?.clone?.find((link: { name: string; href: string }) => link.name === 'http')?.href,
          state: repo.state
        }))
      };
    
      return {
        content: [{ 
          type: 'text', 
          text: JSON.stringify(summary, null, 2) 
        }]
      };
    }
  • src/index.ts:178-188 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for list_repositories.
      name: 'list_repositories',
      description: 'Browse and discover repositories within a specific project or across all accessible projects. Use this to find repository slugs, explore codebases, or understand the repository structure. Returns repository names, slugs, clone URLs, and project associations.',
      inputSchema: {
        type: 'object',
        properties: {
          project: { type: 'string', description: 'Bitbucket project key to list repositories from. If omitted, uses BITBUCKET_DEFAULT_PROJECT or lists all accessible repositories across projects.' },
          limit: { type: 'number', description: 'Number of repositories to return (default: 25, max: 1000)' },
          start: { type: 'number', description: 'Start index for pagination (default: 0)' }
        }
      }
    },
  • Dispatch handler in the CallToolRequestSchema switch statement that routes calls to list_repositories to the implementation function.
    case 'list_repositories': {
      return await this.listRepositories({
        project: args.project as string,
        limit: args.limit as number,
        start: args.start as number
      });
    }
  • TypeScript interface defining the input options for the listRepositories handler, extending ListOptions.
    interface ListRepositoriesOptions extends ListOptions {
      project?: string;
    }
  • src/index.ts:162-162 (registration)
    Inclusion of list_repositories in the read-only tools whitelist, allowing it in read-only mode.
    const readOnlyTools = ['list_projects', 'list_repositories', 'get_pull_request', 'get_diff', 'get_reviews', 'get_activities', 'get_comments', 'search', 'get_file_content', 'browse_repository'];
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions what the tool returns ('repository names, slugs, clone URLs, and project associations'), which is helpful. However, it doesn't disclose important behavioral traits such as whether this is a read-only operation (implied but not stated), pagination behavior (hinted at by 'limit' and 'start' parameters but not explained in description), authentication requirements, rate limits, or error conditions. For a tool with no annotations, this leaves significant gaps.

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 appropriately sized with three sentences that are front-loaded with the core purpose. Each sentence adds value: the first states what the tool does, the second provides usage context, and the third describes the return values. There's minimal waste, though it could be slightly more structured (e.g., separating purpose from usage more clearly).

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose, usage hints, and return values, but lacks details on behavioral aspects like pagination, authentication, or error handling. With no output schema, the description's mention of return values is helpful, but it doesn't fully compensate for the missing annotations and behavioral context. It's adequate but has clear gaps.

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?

The input schema has 100% description coverage, providing clear documentation for all three parameters ('project', 'limit', 'start'). The description adds no additional parameter-specific information beyond what's in the schema. According to the rules, when schema_description_coverage is high (>80%), the baseline score is 3 even with no param info in the description, which applies here.

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?

The description clearly states the tool's purpose: 'Browse and discover repositories within a specific project or across all accessible projects.' It specifies the verb ('browse and discover') and resource ('repositories'), and mentions the scope ('specific project or across all accessible projects'). However, it doesn't explicitly differentiate from sibling tools like 'browse_repository' or 'list_projects', which would be needed for a score of 5.

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

Usage Guidelines3/5

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

The description implies usage context by stating 'Use this to find repository slugs, explore codebases, or understand the repository structure,' which suggests when this tool might be appropriate. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'browse_repository' or 'list_projects', nor does it mention any exclusions or prerequisites. The guidance is present but not comprehensive.

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/garc33/bitbucket-server-mcp-server'

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