Skip to main content
Glama
us-all

airflow-mcp-server

by us-all

airflow-list-runs

List recent runs of an Airflow DAG, filtered by state (success, running, failed, etc.), ordered newest first.

Instructions

List recent runs of one Airflow DAG, optionally filtered by state, ordered newest first

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dagIdYesAirflow DAG id
stateNoFilter by state (success | running | failed | queued | up_for_retry | ...)
limitNo

Implementation Reference

  • The main handler function for the 'airflow-list-runs' tool. Calls Airflow REST API v2 endpoint /dags/{dagId}/dagRuns with optional state filter and orders by -logical_date.
    export async function airflowListRuns(args: z.infer<typeof airflowListRunsSchema>): Promise<unknown> {
      const qs = new URLSearchParams();
      qs.set("limit", String(args.limit));
      // Airflow 3.x v2 uses logical_date (formerly execution_date in v1)
      qs.set("order_by", "-logical_date");
      if (args.state) qs.append("state", args.state);
      const data = await airflowFetch<{ dag_runs: AirflowDagRun[]; total_entries: number }>(
        `/dags/${encodeURIComponent(args.dagId)}/dagRuns?${qs.toString()}`,
      );
      return {
        dagId: args.dagId,
        totalEntries: data.total_entries,
        count: data.dag_runs.length,
        runs: data.dag_runs.map((r) => ({
          dagRunId: r.dag_run_id,
          state: r.state,
          logicalDate: r.logical_date ?? r.execution_date,
          runType: r.run_type,
          startDate: r.start_date,
          endDate: r.end_date,
          duration: r.duration,
          queuedAt: r.queued_at,
          runAfter: r.run_after,
          triggeredBy: r.triggered_by,
          triggeringUser: r.triggering_user_name,
          conf: r.conf,
          note: r.note,
        })),
      };
    }
  • The Zod input schema for the 'airflow-list-runs' tool. Defines parameters: dagId (required string), state (optional filter string), limit (number 1-200, default 20).
    export const airflowListRunsSchema = z.object({
      dagId: z.string().describe("Airflow DAG id"),
      state: z.string().optional().describe("Filter by state (success | running | failed | queued | up_for_retry | ...)"),
      limit: z.coerce.number().int().min(1).max(200).default(20),
    });
  • src/index.ts:47-47 (registration)
    Registration of the 'airflow-list-runs' tool on the MCP server via the helper function `tool()`. Links the schema (airflowListRunsSchema.shape) and handler (wrapToolHandler(airflowListRuns)).
    tool("airflow-list-runs", "List recent runs of one Airflow DAG, optionally filtered by state, ordered newest first", airflowListRunsSchema.shape, wrapToolHandler(airflowListRuns));
  • The `tool()` helper function that wraps registration: it calls registry.register() and conditionally registers with the MCP server based on category enablement.
    function tool(name: string, description: string, schema: any, handler: any): void {
      registry.register(name, description, currentCategory);
      if (registry.isEnabled(currentCategory)) {
        server.tool(name, description, schema, handler);
      }
    }
  • The wrapToolHandler helper that wraps the handler with error handling (redaction patterns and error extractors for WriteBlockedError and AirflowApiError).
    export const wrapToolHandler = createWrapToolHandler({
      redactionPatterns: [
        /AIRFLOW_PASSWORD/i,
        /Authorization:\s*Basic\s+[A-Za-z0-9+/=]+/i,
      ],
      errorExtractors: [
        {
          match: (error) => error instanceof WriteBlockedError,
          extract: (error) => ({
            kind: "passthrough",
            text: (error as WriteBlockedError).message,
          }),
        },
        {
          match: (error) => error instanceof AirflowApiError,
          extract: (error) => {
            const err = error as AirflowApiError;
            return {
              kind: "structured",
              data: { message: err.message, status: err.status, details: err.body },
            };
          },
        },
      ],
    });
Behavior3/5

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

No annotations provided, so description must carry behavioral info. It states list operation (implied read-only) and ordering, but does not clarify 'recent' time window, pagination, or rate limits. Adequate for a straightforward list tool but not rich.

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?

Single sentence of 14 words, efficient and front-loaded. Every word contributes: verb (list), scope (recent runs of one DAG), filter (optionally by state), ordering (newest first). No wasted text.

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?

Adequate for a basic list tool with no output schema, but 'recent' is vague and no pagination or time-window details. Sibling tools may cover more granular queries. Could be more complete with a note on default time range.

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?

Schema description coverage is 67% (dagId and state have descriptions; limit has none). The tool description adds 'recent' and 'ordered newest first' but does not explain 'limit' semantics beyond schema defaults. Modest value added.

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

Purpose5/5

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

Description clearly states 'list recent runs of one Airflow DAG' with optional state filter and ordering. It distinguishes from siblings like 'airflow-list-dags' (lists DAGs) and 'airflow-get-task-instances' (task instances within a run).

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

Usage Guidelines3/5

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

Description implies usage for viewing runs of a specific DAG, but does not explicitly mention when not to use or which sibling alternatives to consider. It provides context like 'recent' and 'ordered newest first', but lacks 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/us-all/airflow-mcp-server'

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