Skip to main content
Glama
fortunto2
by fortunto2

list_deployments

Retrieve a list of deployments from the Prefect API, allowing filtering by flow ID and pagination with limit and offset parameters for efficient results management.

Instructions

Get a list of deployments from the Prefect API.

Args: limit: Maximum number of deployments to return (default 20). offset: Number of deployments to skip (default 0). flow_id: Optional ID of the flow to filter deployments by.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flow_idNo
limitNo
offsetNo

Implementation Reference

  • The main handler function for the 'list_deployments' tool. It fetches deployments from the Prefect API using the client, applies an optional flow_id filter via DeploymentFilter, paginates with limit/offset, and returns the list of deployments (model_dump) along with the count.
    @mcp.tool() async def list_deployments( ctx: Context, limit: int = 20, offset: int = 0, flow_id: Optional[str] = None ) -> Dict[str, Any]: """Get a list of deployments from the Prefect API. Args: limit: Maximum number of deployments to return (default 20). offset: Number of deployments to skip (default 0). flow_id: Optional ID of the flow to filter deployments by. """ filter_dict = {} if flow_id: filter_dict["flow_id"] = {"equals": flow_id} 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, offset=offset ) return { "deployments": [depl.model_dump() for depl in deployments], "count": len(deployments), }
  • Registers the list_deployments function as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()

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