Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

cancel_flow

Stop a running forensic investigation flow in the Velociraptor platform by providing client and flow IDs to manage endpoint collection processes.

Instructions

Cancel a running collection flow.

Args: client_id: The client ID (e.g., 'C.1234567890abcdef') flow_id: The flow ID (e.g., 'F.1234567890')

Returns: Cancellation status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
flow_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler implementation for the 'cancel_flow' tool, which performs input validation and executes a VQL query to cancel a Velociraptor flow.
    async def cancel_flow(
        client_id: str,
        flow_id: str,
    ) -> list[TextContent]:
        """Cancel a running collection flow.
    
        Args:
            client_id: The client ID (e.g., 'C.1234567890abcdef')
            flow_id: The flow ID (e.g., 'F.1234567890')
    
        Returns:
            Cancellation status.
        """
        try:
            # Input validation
            client_id = validate_client_id(client_id)
            flow_id = validate_flow_id(flow_id)
            client = get_client()
    
            vql = f"SELECT cancel_flow(client_id='{client_id}', flow_id='{flow_id}') FROM scope()"
            results = client.query(vql)
    
            return [TextContent(
                type="text",
                text=json.dumps({
                    "client_id": client_id,
                    "flow_id": flow_id,
                    "action": "cancelled",
                    "result": results[0] if results else None,
                }, indent=2, default=str)
            )]
    
        except grpc.RpcError as e:
            error_response = map_grpc_error(e, f"cancelling flow {flow_id}")
            # Check if it's a not-found error
            if "NOT_FOUND" in error_response.get("grpc_status", ""):
                error_response["hint"] = f"Flow {flow_id} may not exist for client {client_id}. Use list_flows(client_id='{client_id}') to see available flows."
            return [TextContent(
                type="text",
                text=json.dumps(error_response)
            )]
        except ValueError as e:
            # Validation errors
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": str(e),
                    "hint": "Provide valid client ID (C.*) and flow ID (F.*)"
                })
            )]
    
        except Exception:
            # Generic errors - don't expose internals
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Failed to cancel flow",
                    "hint": "Check IDs and Velociraptor server connection"
                })
            )]
  • Registration of the 'cancel_flow' function as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()
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 but fails to explain critical mutation semantics—whether cancellation is graceful or immediate, if it affects client state, or error conditions (e.g., attempting to cancel completed flows). Only notes that it returns 'Cancellation status', which is minimally informative given an output schema exists.

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?

Uses structured docstring format (Args/Returns) that is easy to parse. The Args section is necessary and valuable given schema deficiencies. The Returns section is slightly redundant given has_output_schema=true, but remains brief and does not significantly detract from overall efficiency.

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?

Adequate for a two-parameter mutation tool: it covers the input parameters adequately and acknowledges the return value. However, given the lack of annotations and output schema details, it omits important context about side effects, idempotency, and the distinction between synchronous cancellation requests versus asynchronous termination confirmation.

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?

Excellent compensation for 0% schema description coverage: the Args section provides concrete examples for both parameters ('C.1234567890abcdef' for client_id, 'F.1234567890' for flow_id) that clarify expected formats and prefixes, adding significant meaning beyond the bare string types in the schema.

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 action ('Cancel') and target ('running collection flow'), providing sufficient specificity to distinguish from sibling tools like get_flow_status or list_flows. The adjective 'running' effectively scopes the intended state of the target resource.

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 explicit guidance is provided on when to use this tool versus alternatives, or preconditions for use (e.g., 'only cancel stuck flows' or 'prefer waiting for completion'). The description implies usage through the 'running' qualifier but lacks explicit when/when-not instructions.

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/wagonbomb/megaraptor-mcp'

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