Skip to content

Magic Variables

Magic variables are special input fields that trigger automatic behavior beyond normal context storage.

Updates the execution’s note field for tracking purposes.

{
"inputSchema": {
"type": "object",
"properties": {
"execution_note": {
"type": "string",
"description": "Note to identify this execution"
}
}
}
}

When agent provides execution_note:

  1. Value stored in context like normal
  2. Execution record’s note field updated in database
  3. Note visible in execution lists and session queries

Track what’s being worked on:

{
"directive": "Document what you're working on for tracking.",
"inputSchema": {
"properties": {
"execution_note": {
"type": "string",
"description": "Feature/task being developed"
}
},
"required": ["execution_note"]
}
}

Update note on task changes:

{
"directive": "Task requirements changed. Update the execution note.",
"inputSchema": {
"properties": {
"execution_note": { "type": "string" }
}
}
}

Notes appear in session queries:

mcp__moira__session({ action: "executions" });
// Returns executions with note field populated

These variables are automatically available in context:

Current process execution ID.

{{executionId}}

Current workflow identifier.

{{workflowId}}
{
"directive": "Process ID: {{executionId}}\nWorkflow: {{workflowId}}\n\nDocument this for reference."
}

Variables modified by expression nodes:

Set in initialData:

{
"initialData": {
"current_step_index": 1,
"current_iteration": 1
}
}

Modified by expression:

{
"type": "expression",
"expressions": ["current_step_index = current_step_index + 1", "current_iteration = 1"]
}

All magic and context variables work with templates:

{{variable_name}}
{{user.profile.name}}
{{items[0]}}
{{items[0].field}}
{{#if execution_note}}Note: {{execution_note}}{{/if}}