Skip to main content
Glama

trigger-pipeline

Start Azure DevOps build pipelines using definition IDs, names, or branch specifications to automate software deployment processes.

Instructions

Trigger a build pipeline in Azure DevOps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
definitionIdNoBuild definition ID to trigger
definitionNameNoBuild definition name (alternative to ID)
sourceBranchNoSource branch to build (default: default branch)
parametersNoPipeline parameters as key-value pairs

Implementation Reference

  • The core handler function that implements the 'trigger-pipeline' tool. It resolves the build definition ID if a name is provided, constructs the build request with optional source branch and parameters, and triggers the pipeline via a POST to the Azure DevOps builds API.
    private async triggerPipeline(args: any): Promise<any> {
      try {
        let definitionId = args.definitionId;
        
        // If definition name is provided instead of ID, look up the ID
        if (!definitionId && args.definitionName) {
          const definitions = await this.makeApiRequest('/build/definitions?api-version=7.1');
          const definition = definitions.value.find((def: any) => 
            def.name.toLowerCase() === args.definitionName.toLowerCase()
          );
          
          if (!definition) {
            throw new Error(`Build definition '${args.definitionName}' not found`);
          }
          
          definitionId = definition.id;
        }
        
        if (!definitionId) {
          throw new Error('Either definitionId or definitionName must be provided');
        }
    
        // Prepare the build request
        const buildRequest: any = {
          definition: {
            id: definitionId
          }
        };
    
        // Add source branch if specified
        if (args.sourceBranch) {
          buildRequest.sourceBranch = args.sourceBranch.startsWith('refs/') 
            ? args.sourceBranch 
            : `refs/heads/${args.sourceBranch}`;
        }
    
        // Add parameters if specified
        if (args.parameters && typeof args.parameters === 'object') {
          buildRequest.parameters = JSON.stringify(args.parameters);
        }
    
        const result = await this.makeApiRequest(
          '/build/builds?api-version=7.1',
          'POST',
          buildRequest
        );
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              build: {
                id: result.id,
                buildNumber: result.buildNumber,
                status: result.status,
                queueTime: result.queueTime,
                definition: {
                  id: result.definition.id,
                  name: result.definition.name
                },
                sourceBranch: result.sourceBranch,
                url: result._links?.web?.href || `${this.currentConfig!.organizationUrl}/${this.currentConfig!.project}/_build/results?buildId=${result.id}`,
                requestedBy: {
                  displayName: result.requestedBy?.displayName || 'API Request',
                  uniqueName: result.requestedBy?.uniqueName || 'api'
                }
              }
            }, null, 2),
          }],
        };
      } catch (error) {
        throw new Error(`Failed to trigger pipeline: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • src/index.ts:286-310 (registration)
    MCP tool registration including the tool name, description, and input schema definition returned by the listTools handler.
    {
      name: 'trigger-pipeline',
      description: 'Trigger a build pipeline in Azure DevOps',
      inputSchema: {
        type: 'object',
        properties: {
          definitionId: {
            type: 'number',
            description: 'Build definition ID to trigger',
          },
          definitionName: {
            type: 'string',
            description: 'Build definition name (alternative to ID)',
          },
          sourceBranch: {
            type: 'string',
            description: 'Source branch to build (default: default branch)',
          },
          parameters: {
            type: 'object',
            description: 'Pipeline parameters as key-value pairs',
          },
        },
      },
    },
  • Dispatch case in the central handleToolCall method that routes 'trigger-pipeline' calls to the specific triggerPipeline implementation.
    case 'trigger-pipeline':
      return await this.triggerPipeline(args || {});
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('trigger') but doesn't cover critical traits like whether this is a mutation (likely yes), authentication requirements, rate limits, side effects (e.g., starting a build consumes resources), or response format, leaving significant gaps.

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 waste. It's front-loaded with the core action and resource, making it easy to parse quickly without unnecessary elaboration.

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 the tool's complexity (triggering a build pipeline is a mutation with potential side effects), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects, usage context, or what to expect after invocation, which are crucial for an agent to use it correctly.

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 the input schema fully documents all 4 parameters. The description adds no parameter-specific information beyond implying a pipeline is triggered, which is already covered by the tool name and purpose. 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.

Purpose4/5

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

The description clearly states the action ('trigger') and resource ('build pipeline in Azure DevOps'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from potential siblings like 'get-builds' or 'get-pipeline-status' that might also interact with pipelines, missing explicit distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid definition), exclusions, or compare it to sibling tools like 'get-builds' for monitoring, leaving the agent to infer usage context.

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/wangkanai/devops-enhanced-mcp'

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