Skip to main content
Glama

update_variable

Modify existing variables in Prefect workflows by updating their values or tags to maintain accurate configuration and metadata.

Instructions

Update a variable.

Args: name: The variable name value: New value tags: New tags

Returns: Details of the updated variable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
tagsNo
valueNo

Implementation Reference

  • The @mcp.tool decorated async function implementing the 'update_variable' MCP tool. It updates a Prefect variable by name, optionally changing its value and tags, using the Prefect client. Handles existence check, updates, and returns confirmation with updated details.
    @mcp.tool
    async def update_variable(
        name: str,
        value: Optional[Any] = None,
        tags: Optional[List[str]] = None,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Update a variable.
        
        Args:
            name: The variable name
            value: New value (can be any JSON-serializable type)
            tags: New tags
            
        Returns:
            Confirmation message or error
        """
        try:
            async with get_client() as client:
                from prefect.client.schemas.actions import VariableUpdate
                
                # 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))]
                
                # Prepare update data
                update_data = {}
                if value is not None:
                    update_data["value"] = value
                if tags is not None:
                    update_data["tags"] = tags
                
                # Create update object
                variable_update = VariableUpdate(name=name, **update_data)
                
                await client.update_variable(variable=variable_update)
                
                # Read the updated variable to return its details
                updated_variable = await client.read_variable_by_name(name)
                
                return [types.TextContent(type="text", text=json.dumps({
                    "message": f"Variable '{name}' updated successfully",
                    "variable": updated_variable.model_dump()
                }, indent=2, default=str))]
        except Exception as e:
            return [types.TextContent(type="text", text=json.dumps({"error": str(e)}, indent=2))]
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it updates a variable and returns details. It lacks critical behavioral details: whether this requires specific permissions, if it's idempotent, what happens on invalid inputs, or any rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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, followed by structured Args and Returns sections. It's efficient with minimal waste, though the Args section could be more integrated into the narrative 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?

For a mutation tool with 3 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It covers basic parameter semantics but misses behavioral context, error handling, and output details, making it insufficient for reliable agent use.

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?

Schema description coverage is 0%, so the description must compensate. It lists parameters (name, value, tags) and their purposes, adding meaning beyond the bare schema. However, it doesn't explain constraints (e.g., name format, tag structure) or that 'value' and 'tags' are optional with null defaults, leaving gaps in understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Update a variable' which clearly indicates the action and resource, but it's generic and doesn't distinguish from sibling tools like 'create_variable' or 'delete_variable'. It specifies what it does but lacks differentiation from alternatives.

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 on when to use this tool versus alternatives like 'create_variable' or 'delete_variable'. The description only states what it does without context for selection among siblings, leaving the agent to infer 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