search_deployments_by_status
Filter and retrieve deployments on the Prefect MCP Server based on their schedule status, with options to set a limit for the number of results returned.
Instructions
Search for deployments by schedule status.
Args:
is_schedule_active: Filter deployments by whether their schedule is active.
limit: Maximum number of deployments to return (default 20).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| is_schedule_active | No | ||
| limit | No |
Implementation Reference
- prefect_mcp_server_pkg/server.py:325-350 (handler)The handler function for the 'search_deployments_by_status' tool. It is decorated with @mcp.tool(), which registers the tool in the MCP server. The function filters Prefect deployments by schedule active status using the Prefect client API and returns a dictionary with deployments and count.@mcp.tool() async def search_deployments_by_status( ctx: Context, is_schedule_active: Optional[bool] = None, limit: int = 20 ) -> Dict[str, Any]: """Search for deployments by schedule status. Args: is_schedule_active: Filter deployments by whether their schedule is active. limit: Maximum number of deployments to return (default 20). """ filter_dict = {} if is_schedule_active is not None: filter_dict["is_schedule_active"] = {"equals": is_schedule_active} async with get_client() as client: deployment_filter = DeploymentFilter(**filter_dict) if filter_dict else None deployments = await client.read_deployments( deployment_filter=deployment_filter, limit=limit ) return { "deployments": [depl.model_dump() for depl in deployments], "count": len(deployments), }
- prefect_mcp_server_pkg/server.py:325-325 (registration)The @mcp.tool() decorator registers the search_deployments_by_status function as an MCP tool.@mcp.tool()