Skip to main content
Glama

list_jobs

Retrieve agent jobs with filters for status, schedule, type, or channel to monitor and manage asynchronous tasks in the AI Connect platform.

Instructions

Retrieves a list of agent jobs, with optional filters and pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
org_idNoFilter by organization ID. If not provided, the default from the environment is used.
statusNoFilter by job status. Possible values are: 'waiting', 'scheduled', 'running', 'completed', 'failed', 'canceled'.
scheduled_atNoFilter by the exact scheduled time in ISO 8601 format (e.g., '2024-07-23T10:00:00Z').
scheduled_at_gteNoFilter for jobs scheduled at or after a specific time (ISO 8601).
scheduled_at_lteNoFilter for jobs scheduled at or before a specific time (ISO 8601).
created_at_gteNoFilter for jobs created at or after a specific time (ISO 8601).
created_at_lteNoFilter for jobs created at or before a specific time (ISO 8601).
job_type_idNoFilter by the specific job type ID (e.g., 'daily-report').
channel_codeNoFilter by the channel code (e.g., 'C123456' for a Slack channel).
limitNoMaximum number of jobs to return (e.g.,20). Default is 20.
offsetNoNumber of jobs to skip, used for pagination. Default is 0.
sortNoField to sort by and direction. Format is 'field:direction'. Example: 'created_at:desc'.

Implementation Reference

  • The core handler function for the 'list_jobs' tool. Builds query parameters from inputs, fetches jobs via agentJobsClient.getWithMeta('/services/agent-jobs'), processes data and meta, formats output using formatJobList, handles errors, and returns structured text content.
    async (params) => { mcpDebugger.toolCall("list_jobs", params); const endpoint = `/services/agent-jobs`; // Build query parameters object from provided params const queryParams: Record<string, any> = {}; for (const [key, value] of Object.entries(params)) { if (value !== undefined) { queryParams[key] = value; } } mcpDebugger.debug("Built query parameters", { endpoint, queryParams }); try { const apiResponse = await withTiming( () => agentJobsClient.getWithMeta(endpoint, queryParams), "list_jobs API call" ); // Access the full API response structure const jobs = apiResponse.data || []; const meta = apiResponse.meta || {}; mcpDebugger.debug("Raw API response", { fullResponse: apiResponse, jobsCount: jobs.length, meta, firstJob: jobs[0] || null }); const result = { content: [{ type: "text" as const, text: formatJobList(jobs, meta), }] }; mcpDebugger.toolResponse("list_jobs", { jobsReturned: jobs.length, resultLength: result.content[0].text.length }); return result; } catch (error: any) { mcpDebugger.toolError("list_jobs", error); return { content: [{ type: "text" as const, text: `Error listing jobs: ${error.message}`, }], }; } }
  • Zod-based input schema defining all parameters for filtering, pagination, and sorting jobs in the list_jobs tool.
    inputSchema: { org_id: z.string().optional().describe("Filter by organization ID. If not provided, the default from the environment is used."), status: jobStatusSchema.optional().describe("Filter by job status. Possible values are: 'waiting', 'scheduled', 'running', 'completed', 'failed', 'canceled'."), scheduled_at: flexibleDateTimeSchema.optional().describe("Filter by the exact scheduled time in ISO 8601 format (e.g., '2024-07-23T10:00:00Z')."), scheduled_at_gte: flexibleDateTimeSchema.optional().describe("Filter for jobs scheduled at or after a specific time (ISO 8601)."), scheduled_at_lte: flexibleDateTimeSchema.optional().describe("Filter for jobs scheduled at or before a specific time (ISO 8601)."), created_at_gte: flexibleDateTimeSchema.optional().describe("Filter for jobs created at or after a specific time (ISO 8601)."), created_at_lte: flexibleDateTimeSchema.optional().describe("Filter for jobs created at or before a specific time (ISO 8601)."), job_type_id: z.string().optional().describe("Filter by the specific job type ID (e.g., 'daily-report')."), channel_code: z.string().optional().describe("Filter by the channel code (e.g., 'C123456' for a Slack channel)."), limit: z.number().int().positive().optional().describe("Maximum number of jobs to return (e.g.,20). Default is 20."), offset: z.number().int().nonnegative().optional().describe("Number of jobs to skip, used for pagination. Default is 0."), sort: z.string().optional().describe("Field to sort by and direction. Format is 'field:direction'. Example: 'created_at:desc'.") }
  • Zod enum schema for job statuses, referenced in the input schema for status filtering.
    // Define the schema for job status based on docs/agent-jobs-api.md:246-251 const jobStatusSchema = z.enum([ "waiting", "scheduled", "running", "completed", "failed", "canceled" ]);
  • Module that registers the 'list_jobs' tool with the MCP server, including name, spec (description, annotations, inputSchema), and handler function.
    export default (server: McpServer) => { server.registerTool( "list_jobs", { description: "Retrieves a list of agent jobs, with optional filters and pagination.", annotations: { title: "List Agent Jobs" }, inputSchema: { org_id: z.string().optional().describe("Filter by organization ID. If not provided, the default from the environment is used."), status: jobStatusSchema.optional().describe("Filter by job status. Possible values are: 'waiting', 'scheduled', 'running', 'completed', 'failed', 'canceled'."), scheduled_at: flexibleDateTimeSchema.optional().describe("Filter by the exact scheduled time in ISO 8601 format (e.g., '2024-07-23T10:00:00Z')."), scheduled_at_gte: flexibleDateTimeSchema.optional().describe("Filter for jobs scheduled at or after a specific time (ISO 8601)."), scheduled_at_lte: flexibleDateTimeSchema.optional().describe("Filter for jobs scheduled at or before a specific time (ISO 8601)."), created_at_gte: flexibleDateTimeSchema.optional().describe("Filter for jobs created at or after a specific time (ISO 8601)."), created_at_lte: flexibleDateTimeSchema.optional().describe("Filter for jobs created at or before a specific time (ISO 8601)."), job_type_id: z.string().optional().describe("Filter by the specific job type ID (e.g., 'daily-report')."), channel_code: z.string().optional().describe("Filter by the channel code (e.g., 'C123456' for a Slack channel)."), limit: z.number().int().positive().optional().describe("Maximum number of jobs to return (e.g.,20). Default is 20."), offset: z.number().int().nonnegative().optional().describe("Number of jobs to skip, used for pagination. Default is 0."), sort: z.string().optional().describe("Field to sort by and direction. Format is 'field:direction'. Example: 'created_at:desc'.") } }, async (params) => { mcpDebugger.toolCall("list_jobs", params); const endpoint = `/services/agent-jobs`; // Build query parameters object from provided params const queryParams: Record<string, any> = {}; for (const [key, value] of Object.entries(params)) { if (value !== undefined) { queryParams[key] = value; } } mcpDebugger.debug("Built query parameters", { endpoint, queryParams }); try { const apiResponse = await withTiming( () => agentJobsClient.getWithMeta(endpoint, queryParams), "list_jobs API call" ); // Access the full API response structure const jobs = apiResponse.data || []; const meta = apiResponse.meta || {}; mcpDebugger.debug("Raw API response", { fullResponse: apiResponse, jobsCount: jobs.length, meta, firstJob: jobs[0] || null }); const result = { content: [{ type: "text" as const, text: formatJobList(jobs, meta), }] }; mcpDebugger.toolResponse("list_jobs", { jobsReturned: jobs.length, resultLength: result.content[0].text.length }); return result; } catch (error: any) { mcpDebugger.toolError("list_jobs", error); return { content: [{ type: "text" as const, text: `Error listing jobs: ${error.message}`, }], }; } } ); }

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/aiconnect-cloud/agentjobs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server