Skip to main content
Glama

getJobs

Retrieve a paginated list of Jenkins jobs to view and manage automation workflows, with options to filter by folder and control result display.

Instructions

Get a paginated list of Jenkins jobs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parentFullNameNoFull path of the parent folder (optional)
skipNoNumber of items to skip (default: 0)
limitNoMaximum number of items to return (default: 10, max: 10)

Implementation Reference

  • The handler function for the 'getJobs' tool. Fetches a list of Jenkins jobs from the specified parent folder (or root), sorts them alphabetically, applies pagination based on skip and limit parameters, and returns a formatted success response with the jobs list, total count, skip, and limit values. Handles errors appropriately.
    export async function getJobs(client, args = {}) { let { parentFullName = "", skip = 0, limit = 10 } = args; skip = Math.max(0, parseInt(skip, 10) || 0); limit = Math.min(10, Math.max(1, parseInt(limit, 10) || 10)); const basePath = parentFullName ? `/job/${encodeJobPath(parentFullName)}` : ""; try { const response = await client.get( `${basePath}/api/json?tree=jobs[name,url,description,buildable,color]` ); if (response.status === 200) { const jobs = response.data.jobs || []; const sortedJobs = jobs.sort((a, b) => a.name.localeCompare(b.name) ); const paginatedJobs = sortedJobs.slice(skip, skip + limit); return success("getJobs", { jobs: paginatedJobs, total: jobs.length, skip, limit, }); } return failure("getJobs", "Failed to get jobs", { statusCode: response.status, }); } catch (error) { return formatError(error, "getJobs"); } }
  • The registration of the 'getJobs' tool in the central tool registry. Includes the tool name, description, input schema for parameters (parentFullName, skip, limit), and reference to the handler function imported from job-info.js.
    getJobs: { name: "getJobs", description: "Get a paginated list of Jenkins jobs", inputSchema: { type: "object", properties: { parentFullName: { type: "string", description: "Full path of the parent folder (optional)", }, skip: { type: "integer", description: "Number of items to skip (default: 0)", }, limit: { type: "integer", description: "Maximum number of items to return (default: 10, max: 10)", }, }, }, handler: getJobs, },

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