Skip to main content
Glama

get_deployments

Retrieve and filter deployment lists from Prefect workflows using criteria like flow name, tags, schedule status, or work queue to manage and monitor automated processes.

Instructions

Get a list of deployments with optional filtering.

Args: limit: Maximum number of deployments to return offset: Number of deployments to skip flow_name: Filter by flow name name: Filter by deployment name tags: Filter by tags is_schedule_active: Filter by schedule active status work_queue_name: Filter by work queue name

Returns: A list of deployments with their details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flow_nameNo
is_schedule_activeNo
limitNo
nameNo
offsetNo
tagsNo
work_queue_nameNo

Implementation Reference

  • The @mcp.tool decorated handler function that implements the get_deployments tool logic. It queries Prefect deployments using filters and returns results with UI links.
    @mcp.tool
    async def get_deployments(
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        flow_name: Optional[str] = None,
        name: Optional[str] = None,
        tags: Optional[List[str]] = None,
        is_schedule_active: Optional[bool] = None,
        work_queue_name: Optional[str] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Get a list of deployments with optional filtering.
        
        Args:
            limit: Maximum number of deployments to return
            offset: Number of deployments to skip
            flow_name: Filter by flow name
            name: Filter by deployment name
            tags: Filter by tags
            is_schedule_active: Filter by schedule active status
            work_queue_name: Filter by work queue name
            
        Returns:
            A list of deployments with their details
        """
        try:
            async with get_client() as client:
                # Build deployment filter
                deployment_filter = None
                if any([name, tags, is_schedule_active, work_queue_name]):
                    from prefect.client.schemas.filters import DeploymentFilter
                    
                    filter_dict = {}
                    if name:
                        filter_dict["name"] = {"like_": f"%{name}%"}
                    if tags:
                        filter_dict["tags"] = {"all_": tags}
                    if is_schedule_active is not None:
                        filter_dict["is_schedule_active"] = {"eq_": is_schedule_active}
                    if work_queue_name:
                        filter_dict["work_queue_name"] = {"eq_": work_queue_name}
                    
                    deployment_filter = DeploymentFilter(**filter_dict)
                
                # Build flow filter if flow_name is specified
                flow_filter = None
                if flow_name:
                    from prefect.client.schemas.filters import FlowFilter
                    
                    flow_filter = FlowFilter(name={"like_": f"%{flow_name}%"})
                
                # Query using proper filter objects
                deployments = await client.read_deployments(
                    deployment_filter=deployment_filter,
                    flow_filter=flow_filter,
                    limit=limit,
                    offset=offset,
                )
                
                # Add UI links to each deployment
                deployments_result = {
                    "deployments": [
                        {
                            **deployment.model_dump(),
                            "ui_url": get_deployment_url(str(deployment.id))
                        }
                        for deployment in deployments
                    ]
                }
                
                return [types.TextContent(type="text", text=str(deployments_result))]
        except Exception as e:
            # Add proper error handling
            return [types.TextContent(type="text", text=str({"error": str(e)}))]
  • Conditional import of the deployment module in main.py, which triggers registration of all deployment tools including get_deployments via their @mcp.tool decorators.
    if APIType.DEPLOYMENT.value in apis:
        info("Loading Deployment API...")
        from . import deployment
  • Helper function used within get_deployments (and other deployment tools) to generate UI URLs for deployments.
    def get_deployment_url(deployment_id: str) -> str:
        base_url = PREFECT_API_URL.replace("/api", "")
        return f"{base_url}/deployments/{deployment_id}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'optional filtering' and lists parameters, but doesn't describe important behaviors like pagination mechanics (limit/offset interaction), default ordering, error conditions, authentication requirements, or rate limits. For a list operation with 7 parameters, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by organized parameter and return sections. It's appropriately sized for a tool with 7 parameters, though the 'Args:' and 'Returns:' headings could be more integrated with the natural language flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 7 parameters, no annotations, and no output schema, the description provides basic parameter semantics but lacks behavioral context. It covers what the tool does and what parameters exist, but doesn't explain how they work together, what the return structure looks like, or any operational constraints. This is minimally adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides a clear parameter list with brief explanations for all 7 parameters, adding significant value beyond the 0% schema description coverage. Each parameter gets a one-line explanation of its filtering purpose, though it doesn't provide format details (e.g., tag array structure) or interaction rules between filters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Get a list of deployments with optional filtering,' which is a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like 'get_deployment' (singular) or 'get_flows,' leaving some ambiguity about when to use this versus other list retrieval tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_deployment' (singular retrieval) and 'get_flows' (different resource), the agent receives no explicit comparison or context about when filtering deployments is preferred over other list operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/allen-munsch/mcp-prefect'

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