Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

get_pipeline_run

Retrieve detailed information about a specific Azure DevOps pipeline run, including its status, configuration, and execution results.

Instructions

Get details for a specific pipeline run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
runIdYesPipeline run identifier
pipelineIdNoOptional guard; validates the run belongs to this pipeline

Implementation Reference

  • The core handler function that implements the logic for retrieving pipeline run details, including API calls, artifact fetching, and error handling.
    export async function getPipelineRun(
      connection: WebApi,
      options: GetPipelineRunOptions,
    ): Promise<PipelineRunDetails> {
      try {
        const pipelinesApi = await connection.getPipelinesApi();
        const projectId = options.projectId ?? defaultProject;
        const runId = options.runId;
        const resolvedPipelineId = await resolvePipelineId(
          connection,
          projectId,
          runId,
          options.pipelineId,
        );
    
        const baseUrl = connection.serverUrl.replace(/\/+$/, '');
        const encodedProject = encodeURIComponent(projectId);
    
        const requestOptions = pipelinesApi.createRequestOptions(
          'application/json',
          API_VERSION,
        );
    
        const buildRunUrl = (pipelineId?: number) => {
          const route =
            typeof pipelineId === 'number'
              ? `${encodedProject}/_apis/pipelines/${pipelineId}/runs/${runId}`
              : `${encodedProject}/_apis/pipelines/runs/${runId}`;
          const url = new URL(`${route}`, `${baseUrl}/`);
          url.searchParams.set('api-version', API_VERSION);
          return url;
        };
    
        const urlsToTry: URL[] = [];
        if (typeof resolvedPipelineId === 'number') {
          urlsToTry.push(buildRunUrl(resolvedPipelineId));
        }
        urlsToTry.push(buildRunUrl());
    
        let response: {
          statusCode: number;
          result: PipelineRunDetails | null;
        } | null = null;
    
        for (const url of urlsToTry) {
          const attempt = await pipelinesApi.rest.get<PipelineRunDetails | null>(
            url.toString(),
            requestOptions,
          );
    
          if (attempt.statusCode !== 404 && attempt.result) {
            response = attempt;
            break;
          }
        }
    
        if (!response || !response.result) {
          throw new AzureDevOpsResourceNotFoundError(
            `Pipeline run ${runId} not found in project ${projectId}`,
          );
        }
    
        const run = pipelinesApi.formatResponse(
          response.result,
          TypeInfo.Run,
          false,
        ) as PipelineRunDetails;
    
        if (!run) {
          throw new AzureDevOpsResourceNotFoundError(
            `Pipeline run ${runId} not found in project ${projectId}`,
          );
        }
    
        const artifacts = await fetchRunArtifacts(
          connection,
          projectId,
          runId,
          resolvedPipelineId,
        );
    
        if (typeof options.pipelineId === 'number') {
          const runPipelineId = coercePipelineId(run.pipeline?.id);
          if (runPipelineId !== options.pipelineId) {
            throw new AzureDevOpsResourceNotFoundError(
              `Run ${runId} does not belong to pipeline ${options.pipelineId}`,
            );
          }
        }
    
        return artifacts.length > 0 ? { ...run, artifacts } : run;
      } catch (error) {
        if (error instanceof AzureDevOpsError) {
          throw error;
        }
    
        if (error instanceof Error) {
          const message = error.message.toLowerCase();
          if (
            message.includes('authentication') ||
            message.includes('unauthorized') ||
            message.includes('401')
          ) {
            throw new AzureDevOpsAuthenticationError(
              `Failed to authenticate: ${error.message}`,
            );
          }
    
          if (
            message.includes('not found') ||
            message.includes('does not exist') ||
            message.includes('404')
          ) {
            throw new AzureDevOpsResourceNotFoundError(
              `Pipeline run or project not found: ${error.message}`,
            );
          }
        }
    
        throw new AzureDevOpsError(
          `Failed to get pipeline run: ${
            error instanceof Error ? error.message : String(error)
          }`,
        );
      }
    }
  • Zod schema defining the input parameters for the get_pipeline_run tool.
    export const GetPipelineRunSchema = z.object({
      projectId: z
        .string()
        .optional()
        .describe(`The ID or name of the project (Default: ${defaultProject})`),
      runId: z.number().int().min(1).describe('Pipeline run identifier'),
      pipelineId: z
        .number()
        .int()
        .min(1)
        .optional()
        .describe('Optional guard; validates the run belongs to this pipeline'),
    });
  • Tool registration definition including name, description, and input schema conversion for MCP.
    {
      name: 'get_pipeline_run',
      description: 'Get details for a specific pipeline run',
      inputSchema: zodToJsonSchema(GetPipelineRunSchema),
      mcp_enabled: true,
    },
  • Request handler switch case that invokes the getPipelineRun handler after schema validation.
    case 'get_pipeline_run': {
      const args = GetPipelineRunSchema.parse(request.params.arguments);
      const result = await getPipelineRun(connection, {
        ...args,
        projectId: args.projectId ?? defaultProject,
      });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets details' but doesn't specify what details are included, whether it's a read-only operation, if authentication is required, or how errors are handled. This is inadequate for a tool with no annotation coverage.

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 unnecessary words. It's front-loaded and wastes no space, 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. It doesn't explain what details are returned, potential errors, or behavioral aspects like rate limits. For a tool that likely returns structured data about pipeline runs, this leaves significant gaps in understanding its full 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?

Schema description coverage is 100%, so the schema fully documents the parameters (projectId, runId, pipelineId). The description doesn't add any meaning beyond what the schema provides, such as explaining relationships between parameters or usage nuances, but the baseline of 3 is appropriate given the high schema coverage.

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 verb ('Get details') and resource ('a specific pipeline run'), making the purpose evident. However, it doesn't differentiate from sibling tools like 'get_pipeline' or 'list_pipeline_runs', which would require mentioning it retrieves detailed metadata for a single run rather than listing runs or getting pipeline definitions.

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. The description doesn't mention prerequisites, such as needing a valid runId, or contrast it with siblings like 'list_pipeline_runs' for browsing runs or 'get_pipeline_log' for logs, leaving usage context unclear.

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

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