Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

download_pipeline_artifact

Retrieve text content from Azure DevOps pipeline artifacts by specifying the run ID and file path within the artifact.

Instructions

Download a file from a pipeline run artifact and return its textual content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
runIdYesPipeline run identifier
artifactPathYesPath to the desired file inside the artifact (format: <artifactName>/<path/to/file>)
pipelineIdNoOptional guard; validates the run belongs to this pipeline

Implementation Reference

  • Core handler function that orchestrates downloading a specific file from a pipeline run's artifact using Azure DevOps Build and Pipelines APIs, handling both container and zip-based artifacts.
    export async function downloadPipelineArtifact(
      connection: WebApi,
      options: DownloadPipelineArtifactOptions,
    ): Promise<PipelineArtifactContent> {
      try {
        const projectId = options.projectId ?? defaultProject;
        const runId = options.runId;
        const { artifactName, relativePath } = normalizeArtifactPath(
          options.artifactPath,
        );
    
        const buildApi = await connection.getBuildApi();
    
        let artifacts: BuildArtifact[];
        try {
          artifacts = await buildApi.getArtifacts(projectId, runId);
        } catch (error) {
          throw new AzureDevOpsResourceNotFoundError(
            `Pipeline run ${runId} not found in project ${projectId}: ${String(error)}`,
          );
        }
    
        const artifact = artifacts.find((item) => item.name === artifactName);
        if (!artifact) {
          throw new AzureDevOpsResourceNotFoundError(
            `Artifact ${artifactName} not found for run ${runId} in project ${projectId}.`,
          );
        }
    
        const containerResult = await downloadFromContainer(
          connection,
          projectId,
          artifactName,
          artifact,
          relativePath,
        );
    
        if (containerResult) {
          return containerResult;
        }
    
        return await downloadFromPipelineArtifact(
          connection,
          projectId,
          runId,
          artifactName,
          artifact,
          relativePath,
          options.pipelineId,
        );
      } 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 artifact or project not found: ${error.message}`,
            );
          }
        }
    
        throw new AzureDevOpsError(
          `Failed to download pipeline artifact: ${
            error instanceof Error ? error.message : String(error)
          }`,
        );
      }
    }
  • Zod schema defining the input parameters for the download_pipeline_artifact tool.
    export const DownloadPipelineArtifactSchema = 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'),
      artifactPath: z
        .string()
        .min(1)
        .describe(
          'Path to the desired file inside the artifact (format: <artifactName>/<path/to/file>)',
        ),
      pipelineId: z
        .number()
        .int()
        .min(1)
        .optional()
        .describe('Optional guard; validates the run belongs to this pipeline'),
    });
  • Tool definition registration including name, description, and input schema.
    {
      name: 'download_pipeline_artifact',
      description:
        'Download a file from a pipeline run artifact and return its textual content',
      inputSchema: zodToJsonSchema(DownloadPipelineArtifactSchema),
      mcp_enabled: true,
    },
  • Request handler switch case that parses arguments with the schema and invokes the downloadPipelineArtifact handler.
    case 'download_pipeline_artifact': {
      const args = DownloadPipelineArtifactSchema.parse(
        request.params.arguments,
      );
      const result = await downloadPipelineArtifact(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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool downloads and returns textual content, implying a read-only operation, but doesn't mention authentication requirements, rate limits, error conditions (e.g., if artifact doesn't exist), or whether it's idempotent. For a tool that accesses pipeline artifacts, this leaves significant gaps in understanding its behavior.

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 front-loads the core action and outcome. Every word earns its place: 'Download' (verb), 'a file from a pipeline run artifact' (resource), 'and return its textual content' (result). There's no redundancy or wasted phrasing.

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 complexity (accessing pipeline artifacts), lack of annotations, and no output schema, the description is incomplete. It doesn't explain return values (e.g., format of textual content, error responses), behavioral constraints, or how it fits with siblings. For a tool with 4 parameters and no structured safety hints, more context is needed to be fully helpful.

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 already documents all 4 parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't clarify artifactPath format beyond the schema's description). With high schema coverage, the baseline is 3, and the description doesn't compensate with extra insights.

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 ('Download a file') and resource ('from a pipeline run artifact'), with the specific outcome 'return its textual content'. It distinguishes from siblings like get_file_content (which likely gets from repositories) and get_pipeline_log (which gets logs, not artifacts). However, it doesn't explicitly mention what distinguishes it from other artifact-related tools (none listed), so it's not a perfect 5.

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 completed pipeline run), exclusions (e.g., not for binary files since it returns textual content), or comparisons to siblings like get_file_content (for repository files) or get_pipeline_log (for logs). Usage is implied but not explicitly stated.

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