Get n8n Variable
n8n_get_variableRetrieve 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "n8n_get_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The unique identifier of the resource |
Implementation Reference
- src/tools/variables.ts:93-101 (handler)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 }; } ); - src/tools/variables.ts:74-92 (registration)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 } },