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
| Name | Required | Description | Default |
|---|---|---|---|
| buildId | Yes | Build ID | |
| artifactPath | Yes | Artifact path or name | |
| encoding | No | Response encoding: 'base64' (default), 'text', or 'stream' | base64 |
| maxSize | No | Maximum artifact size (bytes) allowed before aborting | |
| outputPath | No | Optional absolute path to write streamed content; defaults to a temp file when streaming |
Implementation Reference
- src/api-client.ts:438-457 (handler)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),