list_repositories
Retrieve and manage CodeUp repository lists from Alibaba Cloud DevOps platform to view and organize source code repositories by organization, with pagination, search, and sorting capabilities.
Instructions
[Code Management] Get the CodeUp Repository List.
A Repository serves as a unit for managing source code and is distinct from a Project.
Use Case:
View my repositories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID, can be found in the basic information page of the organization admin console | |
| page | No | Page number, default starts from 1, generally should not exceed 150 pages | |
| perPage | No | Items per page, default 20, value range [1, 100] | |
| orderBy | No | Sort field, options include {created_at, name, path, last_activity_at}, default is created_at | created_at |
| sort | No | Sort order, options include {asc, desc}, default is desc | desc |
| search | No | Search keyword, used to fuzzy match repository paths | |
| archived | No | Whether archived |
Implementation Reference
- tool-handlers/code-management.ts:168-182 (handler)Tool handler for list_repositories: parses input schema, calls the core listRepositoriesFunc, and returns JSON stringified result.case "list_repositories": { const args = types.ListRepositoriesSchema.parse(request.params.arguments); const repositoryList = await repositories.listRepositoriesFunc( args.organizationId, args.page, args.perPage, args.orderBy, args.sort, args.search ?? undefined, args.archived ); return { content: [{ type: "text", text: JSON.stringify(repositoryList, null, 2) }], }; }
- Core implementation of listRepositoriesFunc: builds API URL with query params, makes GET request to Yunxiao API, parses response with RepositorySchema.export async function listRepositoriesFunc( organizationId: string, page?: number, perPage?: number, orderBy?: string, sort?: string, search?: string, archived?: boolean ): Promise<z.infer<typeof RepositorySchema>[]> { const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/repositories`; const queryParams: Record<string, string | number | undefined> = {}; if (page !== undefined) { queryParams.page = page; } if (perPage !== undefined) { queryParams.perPage = perPage; } if (orderBy !== undefined) { queryParams.orderBy = orderBy; } if (sort !== undefined) { queryParams.sort = sort; } if (search !== undefined) { queryParams.search = search; } if (archived !== undefined) { queryParams.archived = String(archived); // Convert boolean to string } const url = buildUrl(baseUrl, queryParams); const response = await yunxiaoRequest(url, { method: "GET", }); if (!Array.isArray(response)) { return []; } return response.map(repo => RepositorySchema.parse(repo)); }
- operations/codeup/types.ts:253-261 (schema)Zod schema definition for ListRepositories input validation, defining parameters like organizationId, pagination, sorting, search, and archived filter.export const ListRepositoriesSchema = z.object({ organizationId: z.string().describe("Organization ID, can be found in the basic information page of the organization admin console"), page: z.number().int().default(1).optional().describe("Page number, default starts from 1, generally should not exceed 150 pages"), perPage: z.number().int().default(20).optional().describe("Items per page, default 20, value range [1, 100]"), orderBy: z.string().default("created_at").optional().describe("Sort field, options include {created_at, name, path, last_activity_at}, default is created_at"), sort: z.string().default("desc").optional().describe("Sort order, options include {asc, desc}, default is desc"), search: z.string().nullable().optional().describe("Search keyword, used to fuzzy match repository paths"), archived: z.boolean().default(false).optional().describe("Whether archived"), });
- tool-registry/code-management.ts:66-76 (registration)Registers the list_repositories tool in the tool registry with name, description, and input schema derived from ListRepositoriesSchema.{ name: "list_repositories", description: "[Code Management] Get the CodeUp Repository List.\n" + "\n" + "A Repository serves as a unit for managing source code and is distinct from a Project.\n" + "\n" + "Use Case:\n" + "\n" + "View my repositories", inputSchema: zodToJsonSchema(types.ListRepositoriesSchema), },