Skip to main content
Glama
fortunto2
by fortunto2

search_flow_runs_by_state

Find Prefect workflow runs by their execution state to monitor progress, identify issues, or analyze performance. Filter by state type or name to focus on specific run categories.

Instructions

Search for flow runs by state.

Args: state_type: Optional state type (e.g., "COMPLETED", "FAILED", "CRASHED"). state_name: Optional state name (e.g., "Completed", "Failed"). limit: Maximum number of flow runs to return (default 20).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
state_typeNo
state_nameNo
limitNo

Implementation Reference

  • The handler function implementing the 'search_flow_runs_by_state' tool. It is decorated with @mcp.tool() for automatic registration in the MCP server. The function builds a FlowRunFilter based on state_type or state_name, queries the Prefect client for matching flow runs, and returns a dictionary with the list of flow runs and count.
    @mcp.tool() async def search_flow_runs_by_state( ctx: Context, state_type: Optional[str] = None, state_name: Optional[str] = None, limit: int = 20, ) -> Dict[str, Any]: """Search for flow runs by state. Args: state_type: Optional state type (e.g., "COMPLETED", "FAILED", "CRASHED"). state_name: Optional state name (e.g., "Completed", "Failed"). limit: Maximum number of flow runs to return (default 20). """ filter_dict = {} if state_type: filter_dict["state"] = {"type": {"equals": state_type}} if state_name: filter_dict["state"] = {"name": {"equals": state_name}} async with get_client() as client: flow_run_filter = FlowRunFilter(**filter_dict) if filter_dict else None flow_runs = await client.read_flow_runs( flow_run_filter=flow_run_filter, limit=limit ) return { "flow_runs": [run.model_dump() for run in flow_runs], "count": len(flow_runs), }

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/fortunto2/prefect-mcp-server'

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