list_pipelines
Retrieve and display Azure DevOps pipeline configurations for a project, enabling users to view pipeline details, filter results, and manage CI/CD workflows.
Instructions
List pipelines in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The ID or name of the project (Default: MyProject) | |
| top | No | Maximum number of pipelines to return | |
| orderBy | No | Order by field and direction (e.g., "createdDate desc") |
Implementation Reference
- The main handler function implementing the list_pipelines tool logic by fetching pipelines via Azure DevOps Pipelines API with error handling.export async function listPipelines( connection: WebApi, options: ListPipelinesOptions, ): Promise<Pipeline[]> { try { const pipelinesApi = await connection.getPipelinesApi(); const { projectId, orderBy, top, continuationToken } = options; // Call the pipelines API to get the list of pipelines const pipelines = await pipelinesApi.listPipelines( projectId, orderBy, top, continuationToken, ); return pipelines; } catch (error) { // Handle specific error types if (error instanceof AzureDevOpsError) { throw error; } // Check for specific error types and convert to appropriate Azure DevOps errors if (error instanceof Error) { if ( error.message.includes('Authentication') || error.message.includes('Unauthorized') || error.message.includes('401') ) { throw new AzureDevOpsAuthenticationError( `Failed to authenticate: ${error.message}`, ); } if ( error.message.includes('not found') || error.message.includes('does not exist') || error.message.includes('404') ) { throw new AzureDevOpsResourceNotFoundError( `Project or resource not found: ${error.message}`, ); } } // Otherwise, wrap it in a generic error throw new AzureDevOpsError( `Failed to list pipelines: ${error instanceof Error ? error.message : String(error)}`, ); } }
- Zod schema for input validation of the list_pipelines tool parameters (projectId, top, orderBy).export const ListPipelinesSchema = z.object({ // The project to list pipelines from projectId: z .string() .optional() .describe(`The ID or name of the project (Default: ${defaultProject})`), // Maximum number of pipelines to return top: z.number().optional().describe('Maximum number of pipelines to return'), // Order by field and direction orderBy: z .string() .optional() .describe('Order by field and direction (e.g., "createdDate desc")'), });
- src/features/pipelines/tool-definitions.ts:16-20 (registration)ToolDefinition registration for list_pipelines, including name, description, input schema conversion, and MCP flag.{ name: 'list_pipelines', description: 'List pipelines in a project', inputSchema: zodToJsonSchema(ListPipelinesSchema), mcp_enabled: true,
- src/features/pipelines/index.ts:68-77 (registration)Dispatch handler in pipelines feature that handles list_pipelines requests by parsing arguments and calling the listPipelines function.case 'list_pipelines': { const args = ListPipelinesSchema.parse(request.params.arguments); const result = await listPipelines(connection, { ...args, projectId: args.projectId ?? defaultProject, }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- TypeScript interface defining the options structure used by the listPipelines handler.export interface ListPipelinesOptions { projectId: string; orderBy?: string; top?: number; continuationToken?: string; }