n8n_get_variable
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
| 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 } },