Skip to main content
Glama

listBuildArtifacts

Retrieve all artifacts from a specific Jenkins build or the most recent build to access generated files and outputs for analysis or deployment.

Instructions

List all artifacts from a specific build or the last build

Input Schema

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

Implementation Reference

  • The main handler function that fetches and returns the list of artifacts from a Jenkins build using the Jenkins API. It handles both specific build numbers and the last build.
    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 tool registry, including 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 defining the expected 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"],
    },
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 the tool lists artifacts but doesn't describe what 'artifacts' include (e.g., files, metadata), how results are formatted, whether there are rate limits, or if authentication is required. This leaves significant gaps for an agent to understand the tool's 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 directly states the tool's purpose with zero wasted words. It is appropriately sized and front-loaded, making it easy for an agent 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 the lack of annotations and output schema, the description is incomplete. It doesn't explain what artifacts are, how they're returned (e.g., list format, pagination), or any behavioral traits like error handling. For a tool with no structured metadata, this leaves too many unknowns for reliable agent use.

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 input schema already documents both parameters thoroughly. The description adds minimal value by implying the optionality of 'buildNumber' ('specific build or the last build'), but this is already clear from the schema's optional designation and description. Baseline 3 is appropriate when the schema does most of the work.

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 ('List all artifacts') and resource ('from a specific build or the last build'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'readBuildArtifact' or 'getBuild', which prevents a perfect score.

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 like 'readBuildArtifact' (which likely retrieves a single artifact) or 'getBuild' (which might return build metadata). It also doesn't mention prerequisites or context for selecting between specific builds or the last build.

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

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