Skip to main content
Glama

get_variable

Retrieve specific variable details from Prefect's workflow automation platform by providing the variable name, enabling access to stored workflow configuration data.

Instructions

Get a variable by name.

Args: name: The variable name

Returns: Variable details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • The core handler function for the 'get_variable' MCP tool. It uses the Prefect client to read the variable by name and returns its details as JSON text content or an error message.
    @mcp.tool
    async def get_variable(
        name: str,
    ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]:
        """
        Get a variable by name.
        
        Args:
            name: The variable name
            
        Returns:
            Variable details or error message if not found
        """
        try:
            async with get_client() as client:
                variable = await client.read_variable_by_name(name)
                
                if variable is None:
                    return [types.TextContent(type="text", text=json.dumps({"error": f"Variable '{name}' not found"}, indent=2))]
                
                return [types.TextContent(type="text", text=json.dumps(variable.model_dump(), indent=2, default=str))]
        except Exception as e:
            return [types.TextContent(type="text", text=json.dumps({"error": str(e)}, indent=2))]
  • The import statement that loads the variable.py module, triggering registration of the get_variable tool via its @mcp.tool decorator.
    if APIType.VARIABLE.value in apis:
        info("Loading Variable API...")
        from . import variable
  • Docstring describing the input schema (name: str) and output (list of TextContent with JSON). The actual schema is inferred from the function signature by FastMCP.
    """
    Get a variable by name.
    
    Args:
        name: The variable name
        
    Returns:
        Variable details or error message if not found
    """
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a 'Get' operation which implies read-only, but doesn't specify authentication requirements, rate limits, error conditions, or what happens if the variable doesn't exist. The description is minimal and lacks important behavioral context for a read operation.

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 concise with clear sections for Args and Returns. The main purpose is stated upfront, and the structured format helps readability. However, the 'Returns' section is vague ('Variable details') which slightly reduces effectiveness.

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 read operation with no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It doesn't explain what 'Variable details' includes, error handling, authentication needs, or how this differs from the sibling 'get_variables' tool. The minimal information provided is insufficient for confident tool selection and invocation.

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

Parameters2/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 only states 'name: The variable name' which adds minimal semantic value beyond what's obvious from the parameter name. It doesn't explain naming conventions, format requirements, case sensitivity, or provide examples of valid variable names.

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 'Get' and resource 'variable by name', making the purpose immediately understandable. It distinguishes from sibling 'get_variables' (plural) by specifying retrieval of a single variable. However, it doesn't fully differentiate from other get_* tools that also retrieve specific resources.

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 'get_variable' versus 'get_variables' (which presumably lists multiple variables), nor does it specify prerequisites like needing to know the exact variable name versus searching. No exclusions or context for usage is provided.

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