Skip to main content
Glama
nikydobrev

Azure DevOps Multi-Organization MCP Server

by nikydobrev

pipelines_get_builds

Retrieve and filter Azure DevOps pipeline builds across organizations by criteria like status, time, branch, or requester to monitor and analyze CI/CD execution.

Instructions

Gets a list of builds (pipeline runs) with filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationYesThe name of the Azure DevOps organization
projectYesProject ID or name to get builds for
definitionsNoArray of build definition IDs to filter builds
queuesNoArray of queue IDs to filter builds
buildNumberNoBuild number to filter builds
minTimeNoMinimum finish time to filter builds (ISO 8601 string)
maxTimeNoMaximum finish time to filter builds (ISO 8601 string)
requestedForNoUser ID or name who requested the build
reasonFilterNoReason filter for the build (see BuildReason enum)
statusFilterNoStatus filter for the build (see BuildStatus enum)
resultFilterNoResult filter for the build (see BuildResult enum)
tagFiltersNoArray of tags to filter builds
propertiesNoArray of property names to include in the results
topNoMaximum number of builds to return
continuationTokenNoToken for continuing paged results
maxBuildsPerDefinitionNoMaximum number of builds per definition
deletedFilterNoFilter for deleted builds (see QueryDeletedOption enum)
queryOrderNoOrder in which builds are returnedQueueTimeDescending
branchNameNoBranch name to filter builds
buildIdsNoArray of build IDs to retrieve
repositoryIdNoRepository ID to filter builds
repositoryTypeNoType of repository to filter builds

Implementation Reference

  • The asynchronous handler function implementing the core logic of the 'pipelines_get_builds' tool. It connects to Azure DevOps, queries builds with provided filters using the Build API, simplifies the response data, and returns it as JSON text.
    async ({ organization, project, definitions, queues, buildNumber, minTime, maxTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName, buildIds, repositoryId, repositoryType }) => {
        const connection = await connectionManager.getConnection(organization);
        const buildApi = await connection.getBuildApi();
    
        // Default to a summary view if properties are not specified to avoid hitting token limits
        // We select key fields that are most useful for status checks
        const defaultProperties = [
            "id", 
            "buildNumber", 
            "status", 
            "result", 
            "queueTime", 
            "startTime", 
            "finishTime", 
            "url", 
            "definition", 
            "project", 
            "sourceBranch", 
            "requestedFor"
        ];
        const selectedProperties = properties || defaultProperties;
        
        // Default top to 20 if not specified to prevent massive responses
        const limit = top || 20;
    
        const builds = await buildApi.getBuilds(
            project, 
            definitions, 
            queues, 
            buildNumber, 
            minTime ? new Date(minTime) : undefined, 
            maxTime ? new Date(maxTime) : undefined, 
            requestedFor, 
            reasonFilter, 
            statusFilter, 
            resultFilter, 
            tagFilters, 
            selectedProperties, 
            limit, 
            continuationToken, 
            maxBuildsPerDefinition, 
            deletedFilter, 
            safeEnumConvert(BuildQueryOrder, queryOrder), 
            branchName, 
            buildIds, 
            repositoryId, 
            repositoryType
        );
    
        // Simplify the output to reduce token usage
        const simplifiedBuilds = builds.map(b => ({
            id: b.id,
            buildNumber: b.buildNumber,
            status: b.status,
            result: b.result,
            queueTime: b.queueTime,
            startTime: b.startTime,
            finishTime: b.finishTime,
            definition: b.definition ? { id: b.definition.id, name: b.definition.name } : undefined,
            sourceBranch: b.sourceBranch,
            requestedFor: b.requestedFor ? { displayName: b.requestedFor.displayName } : undefined,
            url: b.url
        }));
    
        return {
            content: [{ type: "text", text: JSON.stringify(simplifiedBuilds, null, 2) }],
        };
    }
  • Zod schema defining the input parameters for the 'pipelines_get_builds' tool, including organization, project, various filters, and pagination options.
    {
        organization: z.string().describe("The name of the Azure DevOps organization"),
        project: z.string().describe("Project ID or name to get builds for"),
        definitions: z.array(z.number()).optional().describe("Array of build definition IDs to filter builds"),
        queues: z.array(z.number()).optional().describe("Array of queue IDs to filter builds"),
        buildNumber: z.string().optional().describe("Build number to filter builds"),
        minTime: z.string().optional().describe("Minimum finish time to filter builds (ISO 8601 string)"),
        maxTime: z.string().optional().describe("Maximum finish time to filter builds (ISO 8601 string)"),
        requestedFor: z.string().optional().describe("User ID or name who requested the build"),
        reasonFilter: z.number().optional().describe("Reason filter for the build (see BuildReason enum)"),
        statusFilter: z.number().optional().describe("Status filter for the build (see BuildStatus enum)"),
        resultFilter: z.number().optional().describe("Result filter for the build (see BuildResult enum)"),
        tagFilters: z.array(z.string()).optional().describe("Array of tags to filter builds"),
        properties: z.array(z.string()).optional().describe("Array of property names to include in the results"),
        top: z.number().optional().describe("Maximum number of builds to return"),
        continuationToken: z.string().optional().describe("Token for continuing paged results"),
        maxBuildsPerDefinition: z.number().optional().describe("Maximum number of builds per definition"),
        deletedFilter: z.number().optional().describe("Filter for deleted builds (see QueryDeletedOption enum)"),
        queryOrder: z
            .enum(getEnumKeys(BuildQueryOrder))
            .default("QueueTimeDescending")
            .optional()
            .describe("Order in which builds are returned"),
        branchName: z.string().optional().describe("Branch name to filter builds"),
        buildIds: z.array(z.number()).optional().describe("Array of build IDs to retrieve"),
        repositoryId: z.string().optional().describe("Repository ID to filter builds"),
        repositoryType: z.enum(["TfsGit", "GitHub", "BitbucketCloud"]).optional().describe("Type of repository to filter builds"),
    },
  • The server.tool() call that registers the 'pipelines_get_builds' tool, including its name, description, input schema, and handler function within the registerPipelineTools function.
    server.tool(
      "pipelines_get_builds",
      "Gets a list of builds (pipeline runs) with filtering options",
      {
          organization: z.string().describe("The name of the Azure DevOps organization"),
          project: z.string().describe("Project ID or name to get builds for"),
          definitions: z.array(z.number()).optional().describe("Array of build definition IDs to filter builds"),
          queues: z.array(z.number()).optional().describe("Array of queue IDs to filter builds"),
          buildNumber: z.string().optional().describe("Build number to filter builds"),
          minTime: z.string().optional().describe("Minimum finish time to filter builds (ISO 8601 string)"),
          maxTime: z.string().optional().describe("Maximum finish time to filter builds (ISO 8601 string)"),
          requestedFor: z.string().optional().describe("User ID or name who requested the build"),
          reasonFilter: z.number().optional().describe("Reason filter for the build (see BuildReason enum)"),
          statusFilter: z.number().optional().describe("Status filter for the build (see BuildStatus enum)"),
          resultFilter: z.number().optional().describe("Result filter for the build (see BuildResult enum)"),
          tagFilters: z.array(z.string()).optional().describe("Array of tags to filter builds"),
          properties: z.array(z.string()).optional().describe("Array of property names to include in the results"),
          top: z.number().optional().describe("Maximum number of builds to return"),
          continuationToken: z.string().optional().describe("Token for continuing paged results"),
          maxBuildsPerDefinition: z.number().optional().describe("Maximum number of builds per definition"),
          deletedFilter: z.number().optional().describe("Filter for deleted builds (see QueryDeletedOption enum)"),
          queryOrder: z
              .enum(getEnumKeys(BuildQueryOrder))
              .default("QueueTimeDescending")
              .optional()
              .describe("Order in which builds are returned"),
          branchName: z.string().optional().describe("Branch name to filter builds"),
          buildIds: z.array(z.number()).optional().describe("Array of build IDs to retrieve"),
          repositoryId: z.string().optional().describe("Repository ID to filter builds"),
          repositoryType: z.enum(["TfsGit", "GitHub", "BitbucketCloud"]).optional().describe("Type of repository to filter builds"),
      },
      async ({ organization, project, definitions, queues, buildNumber, minTime, maxTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName, buildIds, repositoryId, repositoryType }) => {
          const connection = await connectionManager.getConnection(organization);
          const buildApi = await connection.getBuildApi();
    
          // Default to a summary view if properties are not specified to avoid hitting token limits
          // We select key fields that are most useful for status checks
          const defaultProperties = [
              "id", 
              "buildNumber", 
              "status", 
              "result", 
              "queueTime", 
              "startTime", 
              "finishTime", 
              "url", 
              "definition", 
              "project", 
              "sourceBranch", 
              "requestedFor"
          ];
          const selectedProperties = properties || defaultProperties;
          
          // Default top to 20 if not specified to prevent massive responses
          const limit = top || 20;
    
          const builds = await buildApi.getBuilds(
              project, 
              definitions, 
              queues, 
              buildNumber, 
              minTime ? new Date(minTime) : undefined, 
              maxTime ? new Date(maxTime) : undefined, 
              requestedFor, 
              reasonFilter, 
              statusFilter, 
              resultFilter, 
              tagFilters, 
              selectedProperties, 
              limit, 
              continuationToken, 
              maxBuildsPerDefinition, 
              deletedFilter, 
              safeEnumConvert(BuildQueryOrder, queryOrder), 
              branchName, 
              buildIds, 
              repositoryId, 
              repositoryType
          );
    
          // Simplify the output to reduce token usage
          const simplifiedBuilds = builds.map(b => ({
              id: b.id,
              buildNumber: b.buildNumber,
              status: b.status,
              result: b.result,
              queueTime: b.queueTime,
              startTime: b.startTime,
              finishTime: b.finishTime,
              definition: b.definition ? { id: b.definition.id, name: b.definition.name } : undefined,
              sourceBranch: b.sourceBranch,
              requestedFor: b.requestedFor ? { displayName: b.requestedFor.displayName } : undefined,
              url: b.url
          }));
    
          return {
              content: [{ type: "text", text: JSON.stringify(simplifiedBuilds, null, 2) }],
          };
      }
    );
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. While 'Gets a list' implies a read-only operation, it doesn't address important behavioral aspects like pagination (implied by 'continuationToken' parameter but not explained), rate limits, authentication requirements, or what happens when filters return no results. The description is too minimal for a tool with 22 parameters.

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 extremely concise at just one sentence with 9 words. It's front-loaded with the core purpose and wastes no words. Every element of the description ('Gets a list of builds', 'pipeline runs', 'filtering options') serves a clear purpose in communicating the tool's function.

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 complex tool with 22 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (build objects with what properties?), how results are structured, pagination behavior, or error conditions. The agent would struggle to use this tool effectively without significant trial and error or external documentation.

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%, meaning all parameters are documented in the schema itself. The description adds minimal value beyond the schema by mentioning 'filtering options', which aligns with the many filter parameters in the schema. However, it doesn't provide additional context about parameter interactions or usage patterns that would help an agent understand how to effectively use these filters together.

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 ('Gets a list of builds') and the resource ('pipeline runs'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'pipelines_list_runs' or 'pipelines_get_build_status', which appear to serve similar functions in the same domain.

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 mentions 'with filtering options' which implies some context for usage, but provides no explicit guidance on when to use this tool versus alternatives like 'pipelines_list_runs' or 'pipelines_get_build_status'. There's no mention of prerequisites, performance considerations, or specific scenarios where this tool is preferred.

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

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