git_list_repositories
List all Git repositories within a specified Azure DevOps project and organization, including hidden repositories when configured.
Instructions
Lists all Git repositories in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization | Yes | The name of the Azure DevOps organization | |
| project | Yes | Project ID or name | |
| includeHidden | No | Include hidden repositories |
Implementation Reference
- src/tools/repositories.ts:19-36 (handler)Executes the git_list_repositories tool: connects to Azure DevOps, fetches repositories for the project (optionally including hidden), maps to simplified format (id, name, url, defaultBranch, remoteUrl), and returns as JSON text in MCP format.async ({ organization, project, includeHidden }) => { const connection = await connectionManager.getConnection(organization); const gitApi = await connection.getGitApi(); const repos = await gitApi.getRepositories(project, includeHidden); const simplified = repos.map(r => ({ id: r.id, name: r.name, url: r.url, defaultBranch: r.defaultBranch, remoteUrl: r.remoteUrl })); return { content: [{ type: "text", text: JSON.stringify(simplified, null, 2) }], }; } );
- src/tools/repositories.ts:14-18 (schema)Input schema for git_list_repositories tool using Zod: organization (string), project (string), includeHidden (optional boolean).{ organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name"), includeHidden: z.boolean().optional().describe("Include hidden repositories"), },
- src/tools/repositories.ts:11-36 (registration)Registers the git_list_repositories tool on the McpServer within the registerRepositoryTools function, specifying name, description, input schema, and handler implementation.server.tool( "git_list_repositories", "Lists all Git repositories in a project", { organization: z.string().describe("The name of the Azure DevOps organization"), project: z.string().describe("Project ID or name"), includeHidden: z.boolean().optional().describe("Include hidden repositories"), }, async ({ organization, project, includeHidden }) => { const connection = await connectionManager.getConnection(organization); const gitApi = await connection.getGitApi(); const repos = await gitApi.getRepositories(project, includeHidden); const simplified = repos.map(r => ({ id: r.id, name: r.name, url: r.url, defaultBranch: r.defaultBranch, remoteUrl: r.remoteUrl })); return { content: [{ type: "text", text: JSON.stringify(simplified, null, 2) }], }; } );
- src/tools/index.ts:10-10 (registration)Top-level registration call in index.ts that invokes registerRepositoryTools, thereby registering git_list_repositories among other repository tools.registerRepositoryTools(server, connectionManager);