Skip to main content
Glama

delete_variable

Remove a specific variable from Prefect's workflow automation platform by providing its name to maintain clean and organized workflow configurations.

Instructions

Delete a variable by name.

Args: name: The variable name

Returns: Confirmation message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • The handler function for the 'delete_variable' tool. It checks if the variable exists, deletes it using the Prefect client if it does, and returns appropriate success or error messages in MCP TextContent format. The @mcp.tool decorator registers this function as an MCP tool.
    @mcp.tool
    async def delete_variable(
        name: str,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Delete a variable by name.
        
        Args:
            name: The variable name
            
        Returns:
            Confirmation message or error
        """
        try:
            async with get_client() as client:
                # Check if variable exists first
                existing_variable = await client.read_variable_by_name(name)
                if existing_variable is None:
                    return [types.TextContent(type="text", text=json.dumps({"error": f"Variable '{name}' not found"}, indent=2))]
                
                await client.delete_variable_by_name(name)
                
                return [types.TextContent(type="text", text=json.dumps({
                    "message": f"Variable '{name}' deleted successfully"
                }, indent=2))]
        except ObjectNotFound:
            return [types.TextContent(type="text", text=json.dumps({
                "error": f"Variable '{name}' not found"
            }, indent=2))]
        except Exception as e:
            return [types.TextContent(type="text", text=json.dumps({"error": str(e)}, indent=2))]
  • Creation of the FastMCP server instance 'mcp' to which tools are registered via decorators.
    mcp = FastMCP(f"MCP Prefect {__version__}")
  • Import of the variable module which triggers the registration of variable-related tools (including delete_variable) via their @mcp.tool decorators.
    from . import variable
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Delete' implies a destructive mutation, the description doesn't specify whether this action is reversible, requires specific permissions, or has side effects (e.g., affecting dependent flows). It also omits error handling (e.g., what happens if the variable doesn't exist) and response details beyond a generic 'confirmation message', leaving significant behavioral gaps.

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 core purpose in the first sentence. The Args/Returns sections are structured but somewhat redundant with the schema. There's no wasted text, though it could be more integrated (e.g., merging the first sentence with parameter details) for optimal flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature, no annotations, and no output schema, the description is incomplete. It lacks critical context such as safety warnings, error conditions, and detailed return values. For a deletion tool in a workflow system with many sibling tools, more guidance on dependencies and impact is needed to ensure safe and correct usage by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds minimal semantics by stating 'name: The variable name', which clarifies the parameter's purpose but provides no details on format, constraints, or examples (e.g., case sensitivity, allowed characters). This is adequate for a single parameter but doesn't fully address the coverage gap, earning a baseline score.

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 ('Delete') and target resource ('a variable by name'), making the purpose immediately understandable. It distinguishes from sibling tools like 'create_variable' and 'update_variable' by specifying deletion. However, it doesn't explicitly differentiate from other deletion tools (e.g., 'delete_flow', 'delete_work_queue'), which prevents a perfect score.

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 prerequisites (e.g., variable must exist), consequences (e.g., irreversible deletion), or relationships to sibling tools like 'get_variable' for verification or 'create_variable' for recreation. This lack of context leaves the agent guessing about appropriate usage scenarios.

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/allen-munsch/mcp-prefect'

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