Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

build_run_build

Trigger automated builds in Azure DevOps using specified project and build definition IDs, with optional branch and custom parameters, via PAT-authenticated API.

Instructions

Triggers a new build for a specified definition.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
definitionIdYesID of the build definition to run
parametersNoCustom build parameters as key-value pairs
projectYesProject ID or name to run the build in
sourceBranchNoSource branch to run the build from. If not provided, the default branch will be used.

Implementation Reference

  • The handler function that executes the logic for the 'build_run_build' tool, triggering a new pipeline run in Azure DevOps and returning the build report.
    async ({ project, definitionId, sourceBranch, parameters }) => {
      const connection = await connectionProvider();
      const buildApi = await connection.getBuildApi();
      const pipelinesApi = await connection.getPipelinesApi();
      const definition = await buildApi.getDefinition(project, definitionId);
      const runRequest = {
        resources: {
          repositories: {
            self: {
              refName: sourceBranch || definition.repository?.defaultBranch || "refs/heads/main",
            },
          },
        },
        templateParameters: parameters,
      };
    
      const pipelineRun = await pipelinesApi.runPipeline(runRequest, project, definitionId);
      const queuedBuild = { id: pipelineRun.id };
      const buildId = queuedBuild.id;
      if (buildId === undefined) {
        throw new Error("Failed to get build ID from pipeline run");
      }
    
      const buildReport = await buildApi.getBuildReport(project, buildId);
      return {
        content: [{ type: "text", text: JSON.stringify(buildReport, null, 2) }],
      };
    }
  • Zod input schema defining parameters for the 'build_run_build' tool.
    {
      project: z.string().describe("Project ID or name to run the build in"),
      definitionId: z.number().describe("ID of the build definition to run"),
      sourceBranch: z.string().optional().describe("Source branch to run the build from. If not provided, the default branch will be used."),
      parameters: z.record(z.string(), z.string()).optional().describe("Custom build parameters as key-value pairs"),
    },
  • Registration of the 'build_run_build' tool via server.tool(), using the name mapped in BUILD_TOOLS.run_build.
    server.tool(
      BUILD_TOOLS.run_build,
      "Triggers a new build for a specified definition.",
      {
        project: z.string().describe("Project ID or name to run the build in"),
        definitionId: z.number().describe("ID of the build definition to run"),
        sourceBranch: z.string().optional().describe("Source branch to run the build from. If not provided, the default branch will be used."),
        parameters: z.record(z.string(), z.string()).optional().describe("Custom build parameters as key-value pairs"),
      },
      async ({ project, definitionId, sourceBranch, parameters }) => {
        const connection = await connectionProvider();
        const buildApi = await connection.getBuildApi();
        const pipelinesApi = await connection.getPipelinesApi();
        const definition = await buildApi.getDefinition(project, definitionId);
        const runRequest = {
          resources: {
            repositories: {
              self: {
                refName: sourceBranch || definition.repository?.defaultBranch || "refs/heads/main",
              },
            },
          },
          templateParameters: parameters,
        };
    
        const pipelineRun = await pipelinesApi.runPipeline(runRequest, project, definitionId);
        const queuedBuild = { id: pipelineRun.id };
        const buildId = queuedBuild.id;
        if (buildId === undefined) {
          throw new Error("Failed to get build ID from pipeline run");
        }
    
        const buildReport = await buildApi.getBuildReport(project, buildId);
        return {
          content: [{ type: "text", text: JSON.stringify(buildReport, null, 2) }],
        };
      }
    );
  • Constant mapping internal names to tool names, including 'run_build' to 'build_run_build'.
    const BUILD_TOOLS = {
      get_definitions: "build_get_definitions",
      get_definition_revisions: "build_get_definition_revisions",
      get_builds: "build_get_builds",
      get_log: "build_get_log",
      get_log_by_id: "build_get_log_by_id",
      get_changes: "build_get_changes",
      run_build: "build_run_build",
      get_status: "build_get_status",
      update_build_stage: "build_update_build_stage",
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool 'triggers a new build' which implies a write/mutation operation, but doesn't disclose critical behaviors like whether this requires specific permissions, if it's rate-limited, what happens on success/failure, or if it returns a build ID. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 that directly states the tool's purpose without any wasted words. It's appropriately sized for a tool with clear functionality and doesn't bury key information. Every word earns its place.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after triggering the build, what the expected response might be, error conditions, or authentication requirements. Given the complexity of build systems and the lack of structured behavioral information, the description should provide more operational context.

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?

The schema description coverage is 100%, with all parameters well-documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema descriptions (e.g., it doesn't explain relationships between parameters or provide usage examples). This meets the baseline of 3 when the schema does 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 ('Triggers a new build') and the target ('for a specified definition'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'build_get_builds' or 'build_update_build_stage', which would require mentioning this is specifically for initiating new builds rather than retrieving or modifying existing ones.

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 build definition), exclusions, or related tools like 'build_get_definitions' for finding definition IDs. This leaves the agent without context for appropriate tool selection.

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

Related 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/ennuiii/DevOpsMcpPAT'

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