get_repository
Retrieve detailed information about a specific Azure DevOps repository by providing its ID or name, including project and organization details.
Instructions
Get details of a specific repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The ID or name of the project (Default: MyProject) | |
| organizationId | No | The ID or name of the organization (Default: mycompany) | |
| repositoryId | Yes | The ID or name of the repository |
Implementation Reference
- src/features/repositories/index.ts:78-88 (handler)MCP tool handler implementation for 'get_repository': parses arguments with schema, calls core getRepository function using connection and defaults, returns JSON-formatted repository details.case 'get_repository': { const args = GetRepositorySchema.parse(request.params.arguments); const result = await getRepository( connection, args.projectId ?? defaultProject, args.repositoryId, ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- Core helper function that executes the Azure DevOps API call to fetch repository details by ID or name within a project, with error handling.export async function getRepository( connection: WebApi, projectId: string, repositoryId: string, ): Promise<GitRepository> { try { const gitApi = await connection.getGitApi(); const repository = await gitApi.getRepository(repositoryId, projectId); if (!repository) { throw new AzureDevOpsResourceNotFoundError( `Repository '${repositoryId}' not found in project '${projectId}'`, ); } return repository; } catch (error) { if (error instanceof AzureDevOpsError) { throw error; } throw new Error( `Failed to get repository: ${error instanceof Error ? error.message : String(error)}`, ); } }
- Zod schema defining input validation for get_repository tool: projectId (optional), organizationId (optional), repositoryId (required).export const GetRepositorySchema = z.object({ projectId: z .string() .optional() .describe(`The ID or name of the project (Default: ${defaultProject})`), organizationId: z .string() .optional() .describe(`The ID or name of the organization (Default: ${defaultOrg})`), repositoryId: z.string().describe('The ID or name of the repository'), });
- src/features/repositories/tool-definitions.ts:19-23 (registration)Tool definition registration including name, description, and input schema for the 'get_repository' tool.{ name: 'get_repository', description: 'Get details of a specific repository', inputSchema: zodToJsonSchema(GetRepositorySchema), },