bitbucket_get_repository
Fetches repository details from Bitbucket by providing the project key and repository slug.
Instructions
Get repository details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project key | |
| repo | Yes | Repository slug |
Implementation Reference
- src/tools/repo-tools.ts:120-155 (handler)Handler for bitbucket_get_repository – parses input with repoRefShape, checks cache, calls repoApi.getRepository, and returns the repository details.
bitbucket_get_repository: async (args: unknown): Promise<McpToolResult> => { const start = Date.now(); try { const input = z.object(repoRefShape).parse(args); requirePermission(config, 'read_repo'); log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_get_repository', }); const ck = cacheKey(config.bitbucketUrl, 'repo', `${input.project}/${input.repo}`); const cached = cache.get(ck); if (cached !== null) { log('info', 'tool end (cached)', { toolName: 'bitbucket_get_repository', durationMs: Date.now() - start, }); return textResult(cached); } const result = await repoApi.getRepository(input.project, input.repo); cache.set(ck, result, config.cache.ttlRepoMeta); log('info', 'tool end', { toolName: 'bitbucket_get_repository', durationMs: Date.now() - start, }); return textResult(result); } catch (err) { log('error', 'tool error', { toolName: 'bitbucket_get_repository', error: String(err), durationMs: Date.now() - start, }); return errorResult('GET_REPO_FAILED', err instanceof Error ? err.message : String(err)); } }, - src/tools/schemas.ts:75-75 (schema)Input schema definition (repoRefShape) with project key and repo slug fields.
export const repoRefShape = { project, repo } as const; - src/tools/registry.ts:137-142 (registration)Registration entry linking the tool name 'bitbucket_get_repository' to its description, shape, and handler.
{ name: 'bitbucket_get_repository', description: 'Get repository details', shape: repoRefShape, handler: h.repo.bitbucket_get_repository, }, - RepositoryApi.getRepository – makes the actual Bitbucket REST API call to GET /projects/{project}/repos/{repo}.
async getRepository(project: string, repo: string): Promise<BitbucketRepository> { return this.client.requestJson<BitbucketRepository>(`/projects/${project}/repos/${repo}`); } - src/tools/schemas.ts:16-17 (schema)Individual zod schemas for 'project' and 'repo' fields used by repoRefShape.
const project = z.string().min(1).describe('Project key'); const repo = z.string().min(1).describe('Repository slug');