Skip to main content
Glama

listBuildArtifacts

Retrieve all artifacts from a Jenkins build job, specifying either a particular build number or the most recent build.

Instructions

List all artifacts from a specific build or the last build

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buildNumberNoBuild number (optional, defaults to last build)
jobFullNameYesFull path of the Jenkins job

Implementation Reference

  • The main asynchronous handler function that implements the logic to list build artifacts from a Jenkins job by querying the Jenkins API, processing the artifacts list, and returning a formatted success or failure response.
    export async function listBuildArtifacts(client, args) { const { jobFullName, buildNumber = null } = args; const jobPath = encodeJobPath(jobFullName); const buildPath = buildNumber || "lastBuild"; try { const response = await client.get( `/job/${jobPath}/${buildPath}/api/json?tree=artifacts[fileName,relativePath,displayPath],number,url,result,timestamp` ); if (response.status === 200) { const build = response.data; const artifacts = build.artifacts || []; return success("listBuildArtifacts", { buildNumber: build.number, buildUrl: build.url, buildResult: build.result, timestamp: build.timestamp, artifacts: artifacts.map((artifact) => ({ fileName: artifact.fileName, relativePath: artifact.relativePath, displayPath: artifact.displayPath || artifact.relativePath, downloadUrl: `${client.baseUrl}/job/${jobPath}/${build.number}/artifact/${artifact.relativePath}`, })), totalArtifacts: artifacts.length, }); } return failure( "listBuildArtifacts", `Build not found: ${jobFullName}#${buildPath}`, { statusCode: response.status } ); } catch (error) { return formatError(error, "list artifacts"); } }
  • The tool registration entry in the central toolRegistry object, defining the tool name, description, input schema for validation, and reference to the handler function.
    listBuildArtifacts: { name: "listBuildArtifacts", description: "List all artifacts from a specific build or the last build", inputSchema: { type: "object", properties: { jobFullName: { type: "string", description: "Full path of the Jenkins job", }, buildNumber: { type: "integer", description: "Build number (optional, defaults to last build)", }, }, required: ["jobFullName"], }, handler: listBuildArtifacts, },
  • The input schema definition for the listBuildArtifacts tool, specifying parameters jobFullName (required string) and optional buildNumber (integer).
    inputSchema: { type: "object", properties: { jobFullName: { type: "string", description: "Full path of the Jenkins job", }, buildNumber: { type: "integer", description: "Build number (optional, defaults to last build)", }, }, required: ["jobFullName"], },
  • Import statement registering the listBuildArtifacts handler function from artifact-management.js into the tools index module.
    import { listBuildArtifacts, readBuildArtifact, } from "./artifact-management.js";

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/umishra1504/Jenkins-mcp-server'

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