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
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Bitbucket project key to list repositories from. If omitted, uses BITBUCKET_DEFAULT_PROJECT or lists all accessible repositories across projects. | |
| limit | No | Number of repositories to return (default: 25, max: 1000) | |
| start | No | Start index for pagination (default: 0) |
Implementation Reference
- src/index.ts:625-672 (handler)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)' } } } },
- src/index.ts:430-436 (handler)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 }); }
- src/index.ts:75-77 (schema)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'];