Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

Get n8n Variable

n8n_get_variable
Read-onlyIdempotent

Retrieve a specific variable by its unique ID to access stored data values for workflow automation in n8n.

Instructions

Get a specific variable by ID.

Args:

  • id (string): Variable ID

Returns: Variable details with id, key, and value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe unique identifier of the resource

Implementation Reference

  • The handler function for 'n8n_get_variable' that fetches a variable by ID from the n8n API.
      async (params: z.infer<typeof IdParamSchema>) => {
        const variable = await get<N8nVariable>(`/variables/${params.id}`);
        
        return {
          content: [{ type: 'text', text: formatVariable(variable) }],
          structuredContent: variable
        };
      }
    );
  • Registration of the 'n8n_get_variable' tool using the IdParamSchema input schema.
      server.registerTool(
        'n8n_get_variable',
        {
          title: 'Get n8n Variable',
          description: `Get a specific variable by ID.
    
    Args:
      - id (string): Variable ID
    
    Returns:
      Variable details with id, key, and value.`,
          inputSchema: IdParamSchema,
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false
          }
        },
Behavior4/5

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

Annotations already provide strong hints (readOnlyHint=true, destructiveHint=false, idempotentHint=true, openWorldHint=false), covering safety and idempotency. The description adds value by specifying the return format ('Variable details with id, key, and value'), which isn't covered by annotations. However, it doesn't mention potential errors (e.g., if ID doesn't exist) or rate limits, keeping it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured: a clear purpose statement followed by Args and Returns sections. Every sentence earns its place, with no wasted words, making it easy to parse and understand quickly.

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

Completeness4/5

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

Given the tool's low complexity (1 parameter, no output schema), annotations provide strong behavioral context, and the description adds return format details. It's mostly complete but could improve by mentioning error cases or linking to sibling tools. The lack of output schema is mitigated by the return description.

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 100%, with the 'id' parameter well-documented in the schema ('The unique identifier of the resource'). The description adds minimal semantics beyond this, only restating 'Variable ID' without extra context like format examples or validation rules. This meets the baseline for high schema coverage.

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 tool's purpose: 'Get a specific variable by ID.' It specifies the verb ('Get') and resource ('variable'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'n8n_list_variables' or 'n8n_get_workflow', which would require a 5.

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 sibling tools like 'n8n_list_variables' for listing all variables or 'n8n_get_workflow' for other get operations, nor does it specify prerequisites or exclusions. This leaves the agent without context for tool selection.

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/DrBalls/n8n-mcp-server-v2'

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