Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

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
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
topNoMaximum number of pipelines to return
orderByNoOrder 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")'),
    });
  • 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,
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Tiberriver256/mcp-server-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server