Skip to main content
Glama

getQueueInfo

Retrieve details about queued Jenkins builds to monitor pending jobs and manage build pipelines effectively.

Instructions

Get information about queued builds

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobFullNameNoFull path of the Jenkins job (optional, returns all queued items if not provided)

Implementation Reference

  • The handler function that retrieves Jenkins queue information, optionally filters by jobFullName, processes queue items with details like wait time, status, and returns formatted success or failure response.
    export async function getQueueInfo(client, args = {}) {
    	const { jobFullName = null } = args;
    	try {
    		const queueResponse = await client.get(
    			`${client.baseUrl}/queue/api/json`
    		);
    
    		if (queueResponse.status !== 200) {
    			return failure(
    				"getQueueInfo",
    				"Failed to fetch queue information",
    				{ statusCode: queueResponse.status }
    			);
    		}
    
    		const allItems = queueResponse.data.items || [];
    
    		// If jobFullName is specified, filter for that job
    		if (jobFullName) {
    			const jobPath = encodeJobPath(jobFullName);
    
    			const filteredItems = allItems.filter((item) => {
    				if (item.task && item.task.url) {
    					const itemJobPath = item.task.url
    						.replace(client.baseUrl, "")
    						.replace(/^\//, "")
    						.replace(/\/$/, "");
    					const targetJobPath = `job/${jobPath}`.replace(/\/$/, "");
    					return itemJobPath === targetJobPath;
    				}
    
    				if (item.task && item.task.name) {
    					const jobName = jobFullName.split("/").pop();
    					return (
    						item.task.name === jobFullName ||
    						item.task.name === jobName
    					);
    				}
    
    				return false;
    			});
    
    			return success("getQueueInfo", {
    				jobName: jobFullName,
    				queueItems: filteredItems.map((item) => ({
    					id: item.id,
    					why: item.why || "Waiting",
    					stuck: item.stuck || false,
    					blocked: item.blocked || false,
    					buildable: item.buildable !== false,
    					inQueueSince: new Date(item.inQueueSince).toISOString(),
    					queuedFor:
    						Math.floor((Date.now() - item.inQueueSince) / 1000) +
    						" seconds",
    					params: item.params,
    					taskName: item.task?.name,
    					taskUrl: item.task?.url,
    				})),
    				totalInQueue: filteredItems.length,
    			});
    		}
    
    		// Return all queue items
    		return success("getQueueInfo", {
    			queueItems: allItems.map((item) => ({
    				id: item.id,
    				taskName: item.task?.name || "Unknown",
    				taskUrl: item.task?.url,
    				why: item.why || "Waiting",
    				stuck: item.stuck || false,
    				blocked: item.blocked || false,
    				buildable: item.buildable !== false,
    				inQueueSince: new Date(item.inQueueSince).toISOString(),
    				queuedFor:
    					Math.floor((Date.now() - item.inQueueSince) / 1000) +
    					" seconds",
    				params: item.params,
    			})),
    			totalInQueue: allItems.length,
    			summary: {
    				total: allItems.length,
    				stuck: allItems.filter((i) => i.stuck).length,
    				blocked: allItems.filter((i) => i.blocked).length,
    				buildable: allItems.filter((i) => i.buildable !== false).length,
    			},
    		});
    	} catch (error) {
    		return formatError(error, "get queue info");
    	}
    }
  • Registration of the getQueueInfo tool in the central toolRegistry, including name, description, inputSchema for jobFullName (optional), and reference to the handler function.
    getQueueInfo: {
    	name: "getQueueInfo",
    	description: "Get information about queued builds",
    	inputSchema: {
    		type: "object",
    		properties: {
    			jobFullName: {
    				type: "string",
    				description:
    					"Full path of the Jenkins job (optional, returns all queued items if not provided)",
    			},
    		},
    	},
    	handler: getQueueInfo,
    },
  • Input schema definition for the getQueueInfo tool, specifying optional jobFullName parameter.
    inputSchema: {
    	type: "object",
    	properties: {
    		jobFullName: {
    			type: "string",
    			description:
    				"Full path of the Jenkins job (optional, returns all queued items if not provided)",
    		},
    	},
    },
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 retrieves information, implying a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns paginated results, or details the format of the returned information. This leaves significant gaps in understanding 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, clear sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and efficiently communicates the core functionality, making it easy 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 'information' includes (e.g., status, timestamps, job details), how results are structured, or any error conditions. For a tool with no structured behavioral data, this leaves too much ambiguity for effective 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?

The input schema has 100% description coverage, with the parameter 'jobFullName' documented as optional and specifying it returns all queued items if not provided. The description doesn't add any additional meaning beyond this, such as examples or edge cases, so it meets the baseline for high schema coverage without compensating further.

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 ('Get information') and resource ('queued builds'), making the tool's purpose immediately understandable. However, it doesn't differentiate itself from sibling tools like 'getQueueItem' or 'getBuild', which might also retrieve build-related information, so it doesn't achieve full sibling differentiation.

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 'getQueueItem' or 'getBuild'. It mentions 'queued builds' but doesn't specify if this is for all queued items or filtered views, nor does it explain prerequisites or exclusions for usage.

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