filter_deployments
Filter and retrieve deployments on the Prefect MCP Server by applying specific criteria, such as active schedules, to streamline workflow management.
Instructions
Filter deployments based on specified criteria.
Args:
filter_criteria: Dictionary with filter criteria according to Prefect API.
Example: {"deployments": {"is_schedule_active": {"eq_": true}}}
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, registered via @mcp.tool() decorator. It uses Prefect client to filter deployments based on the provided filter_criteria dictionary, constructing a DeploymentFilter and calling read_deployments.@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]}