bitbucket_list_repositories
List repositories in a Bitbucket project using the project key, with pagination support.
Instructions
List repositories in a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project key | |
| limit | No | Max results | |
| start | No | Pagination start |
Implementation Reference
- src/tools/repo-tools.ts:79-118 (handler)Handler function that executes the bitbucket_list_repositories tool logic. Parses args using projectListShape, checks 'read_repo' permission, uses cache, and calls repoApi.listRepositories().
bitbucket_list_repositories: async (args: unknown): Promise<McpToolResult> => { const start = Date.now(); try { const input = z.object(projectListShape).parse(args); requirePermission(config, 'read_repo'); log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_list_repositories', }); const ck = cacheKey( config.bitbucketUrl, 'repos', `${input.project}:${input.limit ?? 25}:${input.start ?? 0}` ); const cached = cache.get(ck); if (cached !== null) { log('info', 'tool end (cached)', { toolName: 'bitbucket_list_repositories', durationMs: Date.now() - start, }); return textResult(cached); } const result = await repoApi.listRepositories(input.project, input.limit, input.start); cache.set(ck, result, config.cache.ttlRepos); log('info', 'tool end', { toolName: 'bitbucket_list_repositories', durationMs: Date.now() - start, }); return textResult(result); } catch (err) { log('error', 'tool error', { toolName: 'bitbucket_list_repositories', error: String(err), durationMs: Date.now() - start, }); return errorResult('LIST_REPOS_FAILED', err instanceof Error ? err.message : String(err)); } }, - src/tools/schemas.ts:73-73 (schema)Input schema definition for bitbucket_list_repositories: project (required), limit (optional), start (optional).
export const projectListShape = { project, limit, start } as const; - src/tools/registry.ts:131-136 (registration)Tool registration entry pairing the tool name 'bitbucket_list_repositories' with its description, shape (projectListShape), and handler.
{ name: 'bitbucket_list_repositories', description: 'List repositories in a project', shape: projectListShape, handler: h.repo.bitbucket_list_repositories, }, - Helper API method that makes the actual HTTP request to GET /projects/{project}/repos with pagination params.
async listRepositories( project: string, limit = 25, start = 0 ): Promise<BitbucketPagedResponse<BitbucketRepository>> { return this.client.requestJson<BitbucketPagedResponse<BitbucketRepository>>( `/projects/${project}/repos`, { queryParams: { limit, start } } ); }