Skip to main content
Glama

create_variable

Create a new variable in n8n workflows by providing a unique key and value, enabling dynamic data storage and management for workflow automation.

Instructions

Create a new variable (requires unique key)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes
valueYes

Implementation Reference

  • MCP tool handler for create_variable: delegates to n8nClient.createVariable and returns JSON response
    private async handleCreateVariable(args: { key: string; value: string }) { const variable = await this.n8nClient.createVariable(args); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(variable), null, 2) }] }; }
  • Input schema definition for create_variable tool: requires key (string) and value (string)
    { name: 'create_variable', description: 'Create a new variable (requires unique key)', inputSchema: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' } }, required: ['key', 'value'] } },
  • src/index.ts:281-282 (registration)
    Tool dispatch/registration in CallToolRequestHandler switch statement
    case 'create_variable': return await this.handleCreateVariable(request.params.arguments as { key: string; value: string });
  • N8nClient helper method: POST /api/v1/variables to create variable via n8n API
    async createVariable(variable: Omit<N8nVariable, 'id'>): Promise<N8nVariable> { const response = await this.api.post<N8nApiResponse<N8nVariable>>('/variables', variable); return response.data.data; }

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/get2knowio/n8n-mcp'

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