Skip to main content
Glama
fortunto2

Prefect MCP Server

by fortunto2

get_deployment_by_name

Retrieve a specific deployment by its name to inspect or manage workflow automation configurations in Prefect.

Instructions

Get a deployment by its name.

Args:
    name: Name of the deployment to retrieve, in format "flow_name/deployment_name".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • Handler function for the 'get_deployment_by_name' tool. It retrieves a Prefect deployment by its name in 'flow_name/deployment_name' format using the Prefect client and DeploymentFilter. Returns the deployment details or an error.
    @mcp.tool()
    async def get_deployment_by_name(ctx: Context, name: str) -> Dict[str, Any]:
        """Get a deployment by its name.
    
        Args:
            name: Name of the deployment to retrieve, in format "flow_name/deployment_name".
        """
        if not name:
            return {"error": "Missing required argument: name"}
    
        if "/" not in name:
            return {"error": "Name should be in format 'flow_name/deployment_name'"}
    
        async with get_client() as client:
            try:
                flow_name, deployment_name = name.split("/", 1)
    
                # Use filters to find deployment by name
                deployment_filter = DeploymentFilter(
                    name={"equals": deployment_name}, flow_name={"equals": flow_name}
                )
                deployments = await client.read_deployments(
                    deployment_filter=deployment_filter
                )
    
                if not deployments:
                    return {"error": f"No deployment found with name: {name}"}
    
                # Return the first matching deployment
                return {"deployment": deployments[0].model_dump()}
            except Exception as e:
                return {"error": f"Failed to get deployment: {str(e)}"}

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