Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add --order-by and --state filters to af runs list #72

@jlaneve

Description

@jlaneve

Summary

The af runs list command should support sorting and filtering parameters that the Airflow API already supports.

Current Behavior

af runs list -d code_agent -l 5

Returns runs in an arbitrary order, requiring jq post-processing to sort by date.

Proposed Changes

Add these options to af runs list:

  • --order-by - Sort by field (e.g., start_date, execution_date, state)
  • --state - Filter by run state (e.g., running, success, failed)
  • --start-date-gte / --start-date-lte - Filter by start date range

Implementation Notes

The adapter layer already supports **kwargs pass-through, so this is a low-complexity change:

  1. Add Typer options to src/astro_airflow_mcp/cli/runs.py
  2. Pass through to adapter.list_dag_runs()
  3. Update tool layer in src/astro_airflow_mcp/tools/dag_run.py

The Airflow REST API supports these parameters natively - no adapter changes needed.

Example Usage

# Most recent runs first
af runs list -d code_agent --order-by -start_date

# Only running DAGs
af runs list --state running

# Runs from today
af runs list --start-date-gte 2026-01-30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions