Skip to main content
Glama

update_variable

Modify existing variable values in n8n workflows to adjust workflow behavior and data flow during automation processes.

Instructions

Update an existing variable value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
valueYes

Implementation Reference

  • The main tool handler method that processes the update_variable tool call, extracts arguments, calls the N8nClient method, and formats the response.
    private async handleUpdateVariable(args: { id: string; value: string }) { const variable = await this.n8nClient.updateVariable(args.id, { value: args.value }); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(variable), null, 2) }] };
  • src/index.ts:283-284 (registration)
    The switch case registration that routes 'update_variable' tool calls to the handler method.
    case 'update_variable': return await this.handleUpdateVariable(request.params.arguments as { id: string; value: string });
  • The tool definition including name, description, and input schema for update_variable, returned by list_tools.
    { name: 'update_variable', description: 'Update an existing variable value', inputSchema: { type: 'object', properties: { id: { type: 'string' }, value: { type: 'string' } }, required: ['id', 'value'] } },
  • The N8nClient helper method that performs the actual API PUT request to update a variable in n8n.
    async updateVariable(id: string, variable: Partial<N8nVariable>): Promise<N8nVariable> { const response = await this.api.put<N8nApiResponse<N8nVariable>>(`/variables/${id}`, 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