Skip to main content
Glama
fortunto2

Prefect MCP Server

by fortunto2

create_flow_run_from_deployment

Trigger a workflow execution by launching a flow run from a Prefect deployment, with optional parameters, custom naming, and timeout settings.

Instructions

Create a new flow run for the specified deployment.

Args:
    deployment_id: ID of the deployment or name in format 'flow_name/deployment_name'.
    parameters: Dictionary with parameters for the flow run (optional).
    name: Optional name for the flow run.
    timeout: Timeout in seconds, 0 means no waiting for completion (default 0).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
parametersNo
nameNo
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The @mcp.tool()-decorated async handler function implementing the core logic of creating a flow run from a deployment using Prefect's run_deployment function.
    @mcp.tool()
    async def create_flow_run_from_deployment(
        ctx: Context,
        deployment_id: str,
        parameters: Optional[Dict[str, Any]] = None,
        name: Optional[str] = None,
        timeout: int = 0,
    ) -> Dict[str, Any]:
        """Create a new flow run for the specified deployment.
    
        Args:
            deployment_id: ID of the deployment or name in format 'flow_name/deployment_name'.
            parameters: Dictionary with parameters for the flow run (optional).
            name: Optional name for the flow run.
            timeout: Timeout in seconds, 0 means no waiting for completion (default 0).
        """
        if not deployment_id:
            return {"error": "Missing required argument: deployment_id"}
    
        from prefect.deployments import run_deployment
    
        try:
            # Создаем flow run с помощью функции run_deployment
            result = await run_deployment(
                name=deployment_id,  # В документации это "name", а не "deployment_id"
                parameters=parameters or {},
                timeout=timeout,
                flow_run_name=name,
            )
    
            return {"flow_run_id": str(result)}
        except Exception as e:
            return {"error": f"Failed to create flow run: {str(e)}"}
  • The @mcp.tool() decorator registers the create_flow_run_from_deployment function as an MCP tool.
    @mcp.tool()
  • Legacy wrapper tool 'create_flow_run' that delegates to the main 'create_flow_run_from_deployment' handler.
    @mcp.tool()
    async def create_flow_run(
        ctx: Context, deployment_id: str, parameters: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """Create a new flow run for the specified deployment (Legacy).
    
        Args:
            deployment_id: ID of the deployment to create a run for.
            parameters: Dictionary with parameters for the flow run (optional).
        """
        return await create_flow_run_from_deployment(ctx, deployment_id, parameters)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that timeout=0 means no waiting for completion, which adds some behavioral context. However, it doesn't cover important aspects like whether this is a mutation operation, what permissions are required, what happens on failure, or what the response contains. For a creation tool with zero annotation coverage, this is insufficient.

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 appropriately sized and front-loaded with the main purpose in the first sentence. The parameter explanations are clear and efficient, though the formatting with 'Args:' could be slightly more polished. Every sentence adds value without redundancy.

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 that there's an output schema (which means return values are documented elsewhere), the description covers the creation purpose and parameter semantics reasonably well. However, for a mutation tool with no annotations, it should provide more behavioral context about what 'create' entails operationally. The parameter explanations help, but overall completeness is adequate with 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 adds significant meaning beyond the input schema, which has 0% description coverage. It explains that deployment_id can be either an ID or name in 'flow_name/deployment_name' format, clarifies that parameters is optional and a dictionary, explains that name is optional, and specifies that timeout=0 means no waiting. This compensates well for the schema's lack of descriptions.

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 creates a new flow run for a specified deployment, providing a specific verb (create) and resource (flow run). It distinguishes from sibling tools like 'create_flow_run' by specifying 'from deployment', though it doesn't explicitly differentiate from other siblings like 'cancel_flow_run' or 'get_flow_run_by_id'.

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. It doesn't mention when to use 'create_flow_run_from_deployment' instead of 'create_flow_run' or other flow-related tools, nor does it specify prerequisites or exclusions for usage.

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/fortunto2/prefect-mcp-server'

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