Skip to main content
Glama

download_build_artifact

Download a specific build artifact from TeamCity CI/CD server with configurable encoding options for integration into workflows.

Instructions

Download a single artifact with optional streaming output

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buildIdYesBuild ID
artifactPathYesArtifact path or name
encodingNoResponse encoding: 'base64' (default), 'text', or 'stream'base64
maxSizeNoMaximum artifact size (bytes) allowed before aborting
outputPathNoOptional absolute path to write streamed content; defaults to a temp file when streaming

Implementation Reference

  • Core handler function that performs the actual download of the build artifact from TeamCity API by constructing the artifact content URL and making an Axios GET request.
    async downloadBuildArtifact<T = ArrayBuffer>(
      buildId: string,
      artifactPath: string,
      options?: RawAxiosRequestConfig
    ): Promise<AxiosResponse<T>> {
      const normalizedPath = artifactPath
        .split('/')
        .map((segment) => encodeURIComponent(segment))
        .join('/');
      const requestOptions = {
        ...(options ?? {}),
        responseType: (options?.responseType ??
          'arraybuffer') as RawAxiosRequestConfig['responseType'],
      } as RawAxiosRequestConfig<T>;
    
      return this.axiosInstance.get<T>(
        `/app/rest/builds/id:${buildId}/artifacts/content/${normalizedPath}`,
        requestOptions
      );
    }
  • Type/schema defining the tool name 'download_build_artifact' and its expected arguments.
    interface ArtifactDownloadHandle {
      tool: 'download_build_artifact';
      args: {
        buildId: string;
        artifactPath: string;
        encoding?: 'stream';
        maxSize?: number;
      };
    }
  • Usage of the download_build_artifact tool handle to defer large artifact downloads in build results.
    artifactData.downloadHandle = {
      tool: 'download_build_artifact',
      args: {
        buildId,
        artifactPath,
        encoding: 'stream',
        ...(options.maxArtifactSize ? { maxSize: options.maxArtifactSize } : {}),
      },
    };
  • Adapter method wrapping the downloadBuildArtifact for use in TeamCity client managers.
    downloadArtifactContent: <T = ArrayBuffer>(
      buildId: string,
      artifactPath: string,
      requestOptions?: RawAxiosRequestConfig
    ) => api.downloadBuildArtifact<T>(buildId, artifactPath, requestOptions),

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/Daghis/teamcity-mcp'

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