Skip to main content
Glama
fortunto2

Prefect MCP Server

by fortunto2

cancel_flow_run

Stop an active workflow execution in Prefect by providing the flow run ID to halt processing and free resources.

Instructions

Cancel a flow run.

Args:
    flow_run_id: ID of the flow run to cancel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flow_run_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'cancel_flow_run' MCP tool. It is decorated with @mcp.tool() for automatic registration. The function validates the flow_run_id input, uses the Prefect client to cancel the flow run by UUID, and returns success or error details.
    @mcp.tool()
    async def cancel_flow_run(ctx: Context, flow_run_id: str) -> Dict[str, Any]:
        """Cancel a flow run.
    
        Args:
            flow_run_id: ID of the flow run to cancel.
        """
        if not flow_run_id:
            return {"error": "Missing required argument: flow_run_id"}
    
        async with get_client() as client:
            try:
                result = await client.cancel_flow_run(UUID(flow_run_id))
                return {"success": True, "result": str(result)}
            except Exception as e:
                return {"error": f"Failed to cancel flow run: {str(e)}"}
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 states the action ('Cancel') but lacks critical details: whether this is a destructive operation, if it requires specific permissions, what happens on success/failure, or any side effects (e.g., stopping associated processes). This is inadequate for a mutation tool.

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 front-loaded with the core purpose in the first sentence, followed by a parameter explanation. It's efficient with minimal waste, though the structure could be slightly improved by integrating the parameter info more seamlessly.

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 the tool's complexity (a mutation with no annotations) and the presence of an output schema (which likely covers return values), the description is minimally adequate. However, it lacks details on behavioral aspects like error conditions or idempotency, leaving gaps for safe agent use.

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 meaningful context for the single parameter ('flow_run_id: ID of the flow run to cancel'), clarifying its purpose beyond the schema's basic type information. Since schema description coverage is 0%, this compensates well, though it doesn't specify format constraints (e.g., UUID).

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 verb ('Cancel') and resource ('a flow run'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_flow_runs_by_state' or 'get_flow_run_by_id' which might also involve flow runs but serve different purposes.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention prerequisites (e.g., the flow run must be active), exclusions (e.g., cannot cancel completed runs), or how it differs from related tools like 'filter_flow_runs' or 'list_flow_runs'.

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