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
| Name | Required | Description | Default |
|---|---|---|---|
| queueId | Yes | Queue item ID (from triggerBuild result) |
Implementation Reference
- src/tools/queue-management.js:250-286 (handler)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"); } }
- src/tools/index.js:309-323 (registration)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,
- src/tools/index.js:313-322 (schema)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"], },