Skip to main content
Glama

create_flow_run_from_deployment

Execute a Prefect workflow by triggering a flow run from an existing deployment, with optional parameters, tags, and idempotency controls.

Instructions

Create a flow run from a deployment.

Args: deployment_id: The deployment UUID parameters: Optional parameters to pass to the flow run name: Optional name for the flow run tags: Optional tags for the flow run idempotency_key: Optional idempotency key

Returns: Details of the created flow run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
idempotency_keyNo
nameNo
parametersNo
tagsNo

Implementation Reference

  • The handler function for the 'create_flow_run_from_deployment' tool, decorated with @mcp.tool for registration. It uses the Prefect client to create a flow run from the specified deployment, adds a UI URL, and returns the flow run details as text content.
    @mcp.tool
    async def create_flow_run_from_deployment(
        deployment_id: str,
        parameters: Optional[Dict[str, Any]] = None,
        name: Optional[str] = None,
        tags: Optional[List[str]] = None,
        idempotency_key: Optional[str] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Create a flow run from a deployment.
        
        Args:
            deployment_id: The deployment UUID
            parameters: Optional parameters to pass to the flow run
            name: Optional name for the flow run
            tags: Optional tags for the flow run
            idempotency_key: Optional idempotency key
            
        Returns:
            Details of the created flow run
        """
        async with get_client() as client:
            parameters = parameters or {}
            
            flow_run = await client.create_flow_run_from_deployment(
                deployment_id=UUID(deployment_id),
                parameters=parameters,
                name=name,
                tags=tags,
                idempotency_key=idempotency_key,
            )
            
            # Add URL
            flow_run_dict = flow_run.model_dump()
            flow_run_dict["ui_url"] = PREFECT_API_URL.replace("/api", "") + f"/flow-runs/{flow_run.id}"
            
            return [types.TextContent(type="text", text=str(flow_run_dict))]
  • The @mcp.tool decorator registers the create_flow_run_from_deployment function as an MCP tool.
    @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/allen-munsch/mcp-prefect'

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