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}`,
              }],
            };
          }
        }
      );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds minimal behavioral context beyond what's implied by the name and annotations. It mentions 'optional filters and pagination' which provides some operational context, but doesn't disclose important behavioral traits like rate limits, authentication requirements, or what happens when no filters are applied. With no annotations provided, the description carries the full burden but does only the bare minimum.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Retrieves a list of agent jobs') and then adds qualifying information about filters and pagination. Every word serves a purpose with zero redundancy or wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only list operation with excellent schema coverage (100%) but no output schema, the description provides the minimum viable context. It states what the tool does but lacks information about return format, pagination behavior details, error conditions, or how it differs from sibling tools. The absence of annotations means more behavioral disclosure would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the input schema already provides comprehensive documentation for all 12 parameters. The description adds no additional parameter semantics beyond mentioning that filters and pagination are 'optional' - which is already evident from the schema's lack of required parameters. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('list of agent jobs'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'get_job' or 'get_jobs_stats', which would require explicit comparison to achieve a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'optional filters and pagination' but provides no guidance on when to use this tool versus alternatives like 'get_job' (for single job details) or 'get_jobs_stats' (for aggregated statistics). There's no mention of prerequisites, typical use cases, or exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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