Skip to main content
Glama

getJobs

Retrieve a paginated list of Jenkins jobs with optional parent folder filtering and configurable result limits for job management.

Instructions

Get a paginated list of Jenkins jobs

Input Schema

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

Implementation Reference

  • The main handler function that executes the getJobs tool logic. It fetches a paginated, sorted list of jobs from Jenkins API, handles pagination parameters, and returns formatted success or error responses.
    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"); } }
  • Tool registration in the central toolRegistry, defining the tool's name, description, input schema for validation, and linking to the handler function.
    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, },
  • Input schema defining the parameters for the getJobs tool: parentFullName (optional), skip, and limit for pagination.
    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)", }, }, },

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