Skip to main content
Glama
stefanskiasan

Azure DevOps MCP Server for Cline

trigger_pipeline

Start a pipeline run in Azure DevOps by specifying the pipeline ID, branch, and optional variables to automate build and deployment processes.

Instructions

Trigger a pipeline run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pipelineIdYesPipeline ID to trigger
branchNoBranch to run the pipeline on (optional, defaults to default branch)
variablesNoPipeline variables to override (optional)

Implementation Reference

  • The core handler function that triggers the Azure DevOps pipeline using the Build API, handling arguments validation, pipeline definition retrieval, build queuing, and error handling.
    export async function triggerPipeline(args: TriggerPipelineArgs, config: AzureDevOpsConfig) {
      if (!args.pipelineId) {
        throw new McpError(ErrorCode.InvalidParams, 'Pipeline ID is required');
      }
    
      AzureDevOpsConnection.initialize(config);
      const connection = AzureDevOpsConnection.getInstance();
      const pipelineApi = await connection.getBuildApi();
    
      try {
        // Get pipeline definition first
        const definition = await pipelineApi.getDefinition(
          config.project,
          args.pipelineId
        );
    
        if (!definition) {
          throw new McpError(
            ErrorCode.InvalidParams,
            `Pipeline with ID ${args.pipelineId} not found`
          );
        }
    
        // Create build parameters
        const build = {
          definition: {
            id: args.pipelineId,
          },
          project: definition.project,
          sourceBranch: args.branch || definition.repository?.defaultBranch || 'main',
          parameters: args.variables ? JSON.stringify(args.variables) : undefined,
        };
    
        // Queue new build
        const queuedBuild = await pipelineApi.queueBuild(build, config.project);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(queuedBuild, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        if (error instanceof McpError) throw error;
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to trigger pipeline: ${errorMessage}`
        );
      }
    }
  • The MCP tool definition including name, description, and inputSchema for validating trigger_pipeline arguments.
    {
      name: 'trigger_pipeline',
      description: 'Trigger a pipeline run',
      inputSchema: {
        type: 'object',
        properties: {
          pipelineId: {
            type: 'number',
            description: 'Pipeline ID to trigger',
          },
          branch: {
            type: 'string',
            description: 'Branch to run the pipeline on (optional, defaults to default branch)',
          },
          variables: {
            type: 'object',
            description: 'Pipeline variables to override (optional)',
            additionalProperties: {
              type: 'string',
            },
          },
        },
        required: ['pipelineId'],
      },
    },
  • Exports the pipeline tools module with initialize function that provides the triggerPipeline handler wrapper and tool definitions.
    export const pipelineTools = {
      initialize: (config: AzureDevOpsConfig) => ({
        getPipelines: (args: any) => getPipelines(args, config),
        triggerPipeline: (args: any) => triggerPipeline(args, config),
        definitions,
      }),
      definitions,
    };
  • src/index.ts:163-167 (registration)
    Registers the tool handler in the main MCP server switch statement, routing 'trigger_pipeline' calls to the pipeline tools instance.
    case 'trigger_pipeline':
      result = await tools.pipeline.triggerPipeline(
        validateArgs(request.params.arguments, 'Pipeline trigger arguments required')
      );
      break;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is a write operation (likely, but not confirmed), what happens on trigger (e.g., runs immediately, requires permissions), or any side effects like rate limits or costs. This leaves significant gaps for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded and directly states the tool's purpose without unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a mutation-like tool. It doesn't cover behavioral traits (e.g., what 'trigger' does operationally), expected outcomes, or error handling. For a tool with 3 parameters and likely write actions, this minimal description leaves too much undefined.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional meaning beyond implying 'pipelineId' is required (matching schema), but it doesn't explain parameter interactions or usage nuances. Baseline 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Trigger a pipeline run' clearly states the action (trigger) and resource (pipeline run), but it's vague about what 'trigger' entails—does it start, schedule, or initiate? It doesn't differentiate from sibling tools like 'list_pipelines', which is a read operation, but the distinction is implied rather than explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention prerequisites (e.g., needing a valid pipeline ID) or contrast with siblings like 'list_pipelines' for viewing pipelines. The description lacks context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/stefanskiasan/azure-devops-mcp-server'

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