list_repositories
Retrieve and organize repositories in a specified Azure DevOps project using the project ID, with an option to include reference links for detailed access.
Instructions
List repositories in a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeLinks | No | Whether to include reference links | |
| projectId | Yes | The ID or name of the project |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"includeLinks": {
"description": "Whether to include reference links",
"type": "boolean"
},
"projectId": {
"description": "The ID or name of the project",
"type": "string"
}
},
"required": [
"projectId"
],
"type": "object"
}
Implementation Reference
- The core handler function that executes the list_repositories tool logic by fetching repositories from Azure DevOps Git API using the provided project ID and optional includeLinks flag.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: optional projectId, organizationId, and 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)Registration of the list_repositories tool in the repositoriesTools array, including name, description, and converted JSON schema.{ name: 'list_repositories', description: 'List repositories in a project', inputSchema: zodToJsonSchema(ListRepositoriesSchema), },
- src/features/repositories/index.ts:103-111 (registration)Handler switch case in handleRepositoriesRequest that parses arguments with ListRepositoriesSchema and calls the listRepositories handler function.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) }], };
- TypeScript interface defining the options parameter for the listRepositories handler function.export interface ListRepositoriesOptions { projectId: string; includeLinks?: boolean; }