list_repositories
Retrieve a list of repositories within an Azure DevOps project to manage and access source code collections.
Instructions
List repositories in a project
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) | |
| includeLinks | No | Whether to include reference links |
Implementation Reference
- Core handler function that executes the list_repositories tool logic: connects to Azure DevOps Git API and retrieves repositories for the given project.export async function listRepositories( connection: WebApi, options: ListRepositoriesOptions, ): Promise<GitRepository[]> { try { const gitApi = await connection.getGitApi(); const repositories = await gitApi.getRepositories( options.projectId, options.includeLinks, ); return repositories; } catch (error) { if (error instanceof AzureDevOpsError) { throw error; } throw new Error( `Failed to list repositories: ${error instanceof Error ? error.message : String(error)}`, ); } }
- Zod schema defining the input parameters for the list_repositories tool: projectId, organizationId, includeLinks.export const ListRepositoriesSchema = 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})`), includeLinks: z .boolean() .optional() .describe('Whether to include reference links'), });
- src/features/repositories/tool-definitions.ts:30-34 (registration)Tool registration in the repositoriesTools array, specifying name, description, and input schema.{ name: 'list_repositories', description: 'List repositories in a project', inputSchema: zodToJsonSchema(ListRepositoriesSchema), },
- src/features/repositories/index.ts:103-112 (registration)Dispatcher/registration in handleRepositoriesRequest switch statement that parses args and invokes the listRepositories handler.case 'list_repositories': { const args = ListRepositoriesSchema.parse(request.params.arguments); const result = await listRepositories(connection, { ...args, projectId: args.projectId ?? defaultProject, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }