Skip to main content
Glama

getQueueItem

Retrieve details of a specific queued Jenkins job to check if it has transitioned to an active build, using the queue ID from a previously triggered build.

Instructions

Get a specific queued item by queueId and see whether it transitioned to a build

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queueIdYesQueue item ID (from triggerBuild result)

Implementation Reference

  • The main handler function that implements the getQueueItem tool logic, fetching details of a specific queue item from the Jenkins API and checking if it has transitioned to a build.
    export async function getQueueItem(client, args = {}) {
    	const { queueId } = args;
    	if (queueId === undefined || queueId === null) {
    		return failure("getQueueItem", "queueId is required");
    	}
    	try {
    		const res = await client.get(
    			`${client.baseUrl}/queue/item/${queueId}/api/json`
    		);
    		if (res.status === 200) {
    			// Determine if it has transitioned to a build
    			const executable = res.data?.executable;
    			return success("getQueueItem", {
    				queueId,
    				blocked: res.data?.blocked || false,
    				buildable: res.data?.buildable !== false,
    				stuck: res.data?.stuck || false,
    				why: res.data?.why || "Waiting",
    				params: res.data?.params,
    				taskName: res.data?.task?.name,
    				taskUrl: res.data?.task?.url,
    				executable: executable
    					? {
    							number: executable.number,
    							url: executable.url,
    					  }
    					: null,
    				transitioned: Boolean(executable),
    			});
    		}
    		return failure("getQueueItem", `Queue item not found: ${queueId}`, {
    			statusCode: res.status,
    		});
    	} catch (error) {
    		return formatError(error, "getQueueItem");
    	}
    }
  • The tool registration entry in the central registry, including name, description, input schema, and reference to the handler function.
    getQueueItem: {
    	name: "getQueueItem",
    	description:
    		"Get a specific queued item by queueId and see whether it transitioned to a build",
    	inputSchema: {
    		type: "object",
    		properties: {
    			queueId: {
    				type: "integer",
    				description: "Queue item ID (from triggerBuild result)",
    			},
    		},
    		required: ["queueId"],
    	},
    	handler: getQueueItem,
  • The input schema defining the expected parameters for the getQueueItem tool (queueId as integer).
    inputSchema: {
    	type: "object",
    	properties: {
    		queueId: {
    			type: "integer",
    			description: "Queue item ID (from triggerBuild result)",
    		},
    	},
    	required: ["queueId"],
    },

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