filter_deployments
Filter Prefect deployments by criteria like schedule status or tags to manage workflow automation efficiently.
Instructions
Filter deployments based on specified criteria.
Args:
filter_criteria: Dictionary with filter criteria according to Prefect API.
Example1: {"deployments": {"is_schedule_active": {"eq_": true}}}
Example2: {"deployments": {"tags": {"all_": ["production"]}}}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter_criteria | Yes |
Implementation Reference
- prefect_mcp_server_pkg/server.py:421-436 (handler)The handler function for the 'filter_deployments' tool. It is decorated with @mcp.tool() for registration and implements filtering of Prefect deployments using DeploymentFilter and the Prefect client.@mcp.tool() async def filter_deployments( ctx: Context, filter_criteria: Dict[str, Any] ) -> Dict[str, Any]: """Filter deployments based on specified criteria. Args: filter_criteria: Dictionary with filter criteria according to Prefect API. Example1: {"deployments": {"is_schedule_active": {"eq_": true}}} Example2: {"deployments": {"tags": {"all_": ["production"]}}} """ async with get_client() as client: deployment_filter = DeploymentFilter(**filter_criteria) deployments = await client.read_deployments(deployment_filter=deployment_filter) return {"deployments": [deployment.model_dump() for deployment in deployments]}