mcpgraph 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,6 +26,11 @@ server:
26
26
  version: "1.0.0"
27
27
  description: "File utilities"
28
28
 
29
+ # Optional: Execution limits to prevent infinite loops
30
+ executionLimits:
31
+ maxNodeExecutions: 1000 # Maximum total node executions (default: 1000)
32
+ maxExecutionTimeMs: 300000 # Maximum execution time in milliseconds (default: 300000 = 5 minutes)
33
+
29
34
  # Tool Definitions
30
35
  tools:
31
36
  - name: "count_files"
@@ -108,25 +113,26 @@ This graph:
108
113
 
109
114
  mcpGraph maintains a complete execution history for each tool execution, enabling powerful debugging and introspection capabilities:
110
115
 
111
- - **Execution History**: Every node execution is recorded with timing, inputs, outputs, and a unique `executionIndex`
116
+ - **Execution History**: Every node execution is recorded with timing, outputs, and a unique `executionIndex` (sequential: 0, 1, 2, ...)
117
+ - **Context Structure**: Context for expressions is built from history - a flat structure where each node ID maps to its latest output
118
+ - Simple notation: `$.node_id` accesses the latest output of a node
119
+ - When nodes execute multiple times (loops), context shows the most recent execution
120
+ - History functions provide access to all executions, not just the latest
112
121
  - **Time-Travel Debugging**: Get the context that was available to any specific execution using `getContextForExecution(executionIndex)`
113
122
  - **History Functions**: Use JSONata functions to access execution history:
114
123
  - `$previousNode()` - Get the previous node's output
124
+ - `$previousNode(index)` - Get the node that executed N steps before current
115
125
  - `$executionCount(nodeName)` - Count how many times a node executed
116
- - `$nodeExecution(nodeName, index)` - Get a specific execution of a node
126
+ - `$nodeExecution(nodeName, index)` - Get a specific execution of a node (0 = first, -1 = last)
117
127
  - `$nodeExecutions(nodeName)` - Get all executions of a node as an array
118
- - **Loop Support**: Nodes can execute multiple times in loops, with each execution tracked separately
128
+ - **Loop Support**: Nodes can execute multiple times in loops, with each execution tracked separately in history
119
129
 
120
130
  See [docs/introspection-debugging.md](docs/introspection-debugging.md) for detailed documentation on debugging features.
121
131
 
122
132
  **Context Access:**
123
133
  - All node outputs are accessible by node ID (e.g., `$.entry_count_files.directory`, `$.list_directory_node`)
124
- - History functions are available in all JSONata expressions:
125
- - `$previousNode()` - Get the previous node's output
126
- - `$previousNode(index)` - Get the node that executed N steps before current
127
- - `$executionCount(nodeName)` - Count executions of a node
128
- - `$nodeExecution(nodeName, index)` - Get a specific execution of a node
129
- - `$nodeExecutions(nodeName)` - Get all executions of a node as an array
134
+ - Latest execution wins: `$.increment_node` returns the most recent output when a node executes multiple times
135
+ - History functions are available in all JSONata expressions (including those used in JSON Logic `var` operations)
130
136
 
131
137
  ## For Developers
132
138
 
@@ -148,6 +154,35 @@ npm install mcpgraph
148
154
 
149
155
  ## Configuration
150
156
 
157
+ ### Execution Limits
158
+
159
+ mcpGraph supports cyclical graphs, which requires guardrails to prevent infinite loops. Execution limits can be configured at the graph level:
160
+
161
+ ```yaml
162
+ version: "1.0"
163
+
164
+ server:
165
+ name: "myServer"
166
+ version: "1.0.0"
167
+ description: "My MCP server"
168
+
169
+ # Optional: Execution limits to prevent infinite loops
170
+ executionLimits:
171
+ maxNodeExecutions: 1000 # Maximum total node executions (default: 1000)
172
+ maxExecutionTimeMs: 300000 # Maximum execution time in milliseconds (default: 300000 = 5 minutes)
173
+
174
+ tools:
175
+ # ... tool definitions ...
176
+ ```
177
+
178
+ **Execution Limits:**
179
+ - **`maxNodeExecutions`** (optional): Maximum number of node executions across the entire graph. Default: `1000`. If execution reaches this limit, an error is thrown.
180
+ - **`maxExecutionTimeMs`** (optional): Maximum wall-clock time for graph execution in milliseconds. Default: `300000` (5 minutes). If execution exceeds this time, an error is thrown.
181
+
182
+ Both limits are checked before each node execution. If either limit is exceeded, execution stops immediately with a clear error message indicating which limit was hit.
183
+
184
+ **Note:** These limits are optional. If not specified, the defaults apply. They can be set to higher values for long-running batch jobs or lower values for quick operations.
185
+
151
186
  ### As an MCP Server
152
187
 
153
188
  To use `mcpgraph` as an MCP server in an MCP client (such as Claude Desktop), add it to your MCP client's configuration file.
@@ -66,6 +66,16 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
66
66
  headers?: Record<string, string> | undefined;
67
67
  requestInit?: Record<string, unknown> | undefined;
68
68
  }>]>>>;
69
+ executionLimits: z.ZodOptional<z.ZodObject<{
70
+ maxNodeExecutions: z.ZodOptional<z.ZodNumber>;
71
+ maxExecutionTimeMs: z.ZodOptional<z.ZodNumber>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ maxNodeExecutions?: number | undefined;
74
+ maxExecutionTimeMs?: number | undefined;
75
+ }, {
76
+ maxNodeExecutions?: number | undefined;
77
+ maxExecutionTimeMs?: number | undefined;
78
+ }>>;
69
79
  tools: z.ZodArray<z.ZodObject<{
70
80
  name: z.ZodString;
71
81
  description: z.ZodString;
@@ -365,6 +375,10 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
365
375
  headers?: Record<string, string> | undefined;
366
376
  requestInit?: Record<string, unknown> | undefined;
367
377
  }> | undefined;
378
+ executionLimits?: {
379
+ maxNodeExecutions?: number | undefined;
380
+ maxExecutionTimeMs?: number | undefined;
381
+ } | undefined;
368
382
  }, {
369
383
  version: string;
370
384
  server: {
@@ -444,6 +458,10 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
444
458
  headers?: Record<string, string> | undefined;
445
459
  requestInit?: Record<string, unknown> | undefined;
446
460
  }> | undefined;
461
+ executionLimits?: {
462
+ maxNodeExecutions?: number | undefined;
463
+ maxExecutionTimeMs?: number | undefined;
464
+ } | undefined;
447
465
  }>;
448
466
  export type McpGraphConfigSchema = z.infer<typeof mcpGraphConfigSchema>;
449
467
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8GxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -94,10 +94,15 @@ const toolDefinitionSchema = z.object({
94
94
  inputSchema: jsonSchemaSchema,
95
95
  outputSchema: jsonSchemaSchema,
96
96
  });
97
+ const executionLimitsSchema = z.object({
98
+ maxNodeExecutions: z.number().int().positive().optional(),
99
+ maxExecutionTimeMs: z.number().int().positive().optional(),
100
+ });
97
101
  export const mcpGraphConfigSchema = z.object({
98
102
  version: z.string(),
99
103
  server: serverMetadataSchema,
100
104
  servers: z.record(serverConfigSchema).optional(),
105
+ executionLimits: executionLimitsSchema.optional(),
101
106
  tools: z.array(toolDefinitionSchema),
102
107
  nodes: z.array(nodeSchema),
103
108
  });
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE;IACzD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAA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,cAAc;IAI3B,OAAO,CAAC,eAAe;IAOjB,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC;IA6V3B,OAAO,CAAC,cAAc;CAgCvB"}
@@ -74,12 +74,35 @@ export class GraphExecutor {
74
74
  }
75
75
  const startTime = Date.now();
76
76
  let currentNodeId = entryNode.id;
77
+ // Get execution limits with defaults
78
+ const limits = this.config.executionLimits || {};
79
+ const maxNodeExecutions = limits.maxNodeExecutions ?? 1000;
80
+ const maxExecutionTimeMs = limits.maxExecutionTimeMs ?? 300000; // 5 minutes
77
81
  try {
78
82
  if (this.controller) {
79
83
  this.controller.setStatus("running");
80
84
  }
81
85
  // Execute nodes until we reach the exit node
82
86
  while (true) {
87
+ // Check execution limits before processing next node
88
+ const currentHistoryLength = context.getHistory().length;
89
+ if (currentHistoryLength >= maxNodeExecutions) {
90
+ const error = new Error(`Execution limit exceeded: maximum node executions (${maxNodeExecutions}) reached. Current execution count: ${currentHistoryLength}`);
91
+ if (this.controller) {
92
+ this.controller.setStatus("error");
93
+ this.controller.setCurrentNode(null);
94
+ }
95
+ throw error;
96
+ }
97
+ const elapsedTime = Date.now() - startTime;
98
+ if (elapsedTime >= maxExecutionTimeMs) {
99
+ const error = new Error(`Execution limit exceeded: maximum execution time (${maxExecutionTimeMs}ms) reached. Elapsed time: ${elapsedTime}ms`);
100
+ if (this.controller) {
101
+ this.controller.setStatus("error");
102
+ this.controller.setCurrentNode(null);
103
+ }
104
+ throw error;
105
+ }
83
106
  // Check for stop request before processing next node
84
107
  if (this.controller && this.controller.shouldStop()) {
85
108
  if (this.controller) {
@@ -104,9 +127,11 @@ export class GraphExecutor {
104
127
  this.controller.setStatus("paused");
105
128
  // Wait for resume - this creates the promise and blocks until resume() is called
106
129
  const pausePromise = this.controller.waitIfPaused();
130
+ // Get execution index before node executes (this will be the index after we add this execution)
131
+ const executionIndex = context.getHistory().length;
107
132
  // Call onPause hook to notify that we've paused (status is "paused", waiting for resume)
108
133
  if (hooks?.onPause) {
109
- await hooks.onPause(currentNodeId, context);
134
+ await hooks.onPause(executionIndex, currentNodeId, context);
110
135
  }
111
136
  // Wait for resume to be called
112
137
  await pausePromise;
@@ -123,9 +148,11 @@ export class GraphExecutor {
123
148
  throw new Error("Execution was stopped");
124
149
  }
125
150
  }
151
+ // Get execution index before node executes (this will be the index after we add this execution)
152
+ const executionIndex = context.getHistory().length;
126
153
  // Call onNodeStart hook
127
154
  if (hooks?.onNodeStart) {
128
- const shouldContinue = await hooks.onNodeStart(currentNodeId, node, context);
155
+ const shouldContinue = await hooks.onNodeStart(executionIndex, currentNodeId, node, context);
129
156
  // Check for stop after hook (hook may have called stop())
130
157
  if (this.controller && this.controller.shouldStop()) {
131
158
  if (this.controller) {
@@ -139,7 +166,7 @@ export class GraphExecutor {
139
166
  if (this.controller) {
140
167
  // Call onPause hook before waiting
141
168
  if (hooks?.onPause) {
142
- await hooks.onPause(currentNodeId, context);
169
+ await hooks.onPause(executionIndex, currentNodeId, context);
143
170
  }
144
171
  await this.controller.waitIfPaused();
145
172
  // Call onResume hook after resuming
@@ -170,9 +197,11 @@ export class GraphExecutor {
170
197
  break;
171
198
  case "exit":
172
199
  result = executeExitNode(node, context, nodeStartTime);
200
+ // Get execution index after exit node has been added to history
201
+ const exitExecutionIndex = context.getHistory().length - 1;
173
202
  // Call onNodeComplete hook for exit node
174
203
  if (hooks?.onNodeComplete && inputContext !== undefined) {
175
- await hooks.onNodeComplete(currentNodeId, node, inputContext, result.output, Date.now() - nodeStartTime);
204
+ await hooks.onNodeComplete(exitExecutionIndex, currentNodeId, node, inputContext, result.output, Date.now() - nodeStartTime);
176
205
  }
177
206
  if (this.controller) {
178
207
  this.controller.setStatus("finished");
@@ -216,9 +245,11 @@ export class GraphExecutor {
216
245
  default:
217
246
  throw new Error(`Unknown node type: ${node.type}`);
218
247
  }
248
+ // Get execution index after node has been added to history
249
+ const nodeExecutionIndex = context.getHistory().length - 1;
219
250
  // Call onNodeComplete hook
220
251
  if (hooks?.onNodeComplete && inputContext !== undefined) {
221
- await hooks.onNodeComplete(currentNodeId, node, inputContext, result.output, Date.now() - nodeStartTime);
252
+ await hooks.onNodeComplete(nodeExecutionIndex, currentNodeId, node, inputContext, result.output, Date.now() - nodeStartTime);
222
253
  }
223
254
  // Mark step complete if stepping
224
255
  if (this.controller) {
@@ -234,9 +265,11 @@ export class GraphExecutor {
234
265
  if (!lastRecord || lastRecord.nodeId !== currentNodeId) {
235
266
  context.addHistory(currentNodeId, node.type, null, nodeStartTime, nodeEndTime, nodeError);
236
267
  }
268
+ // Get execution index after error has been added to history
269
+ const errorExecutionIndex = context.getHistory().length - 1;
237
270
  // Call onNodeError hook
238
271
  if (hooks?.onNodeError) {
239
- await hooks.onNodeError(currentNodeId, node, nodeError, context);
272
+ await hooks.onNodeError(errorExecutionIndex, currentNodeId, node, nodeError, context);
240
273
  }
241
274
  if (this.controller) {
242
275
  this.controller.setStatus("error");
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/execution/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,cAA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ACf,CAAC;QACH,CAAC;QAED,OAAO;YACL,aAAa,EAAE,OAAO,GAAG,SAAS;YAClC,aAAa;YACb,UAAU;YACV,UAAU;SACX,CAAC;IACJ,CAAC;CACF"}
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * Type definitions for mcpGraph configuration
3
3
  */
4
+ export interface ExecutionLimits {
5
+ maxNodeExecutions?: number;
6
+ maxExecutionTimeMs?: number;
7
+ }
4
8
  export interface McpGraphConfig {
5
9
  version: string;
6
10
  server: ServerMetadata;
7
11
  servers?: Record<string, ServerConfig>;
12
+ executionLimits?: ExecutionLimits;
8
13
  tools: ToolDefinition[];
9
14
  nodes: NodeDefinition[];
10
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,eAAe,GACf,0BAA0B,CAAC;AAE/B,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM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ACtB;AAED,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,aAAa,GACb,UAAU,CAAC;AAEf,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAEd;AAED,MAAM,WAAW,OAAQ,SAAQ,QAAQ;IACvC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC"}
@@ -24,21 +24,39 @@ export interface ExecutionState {
24
24
  export interface ExecutionHooks {
25
25
  /**
26
26
  * Called before a node executes
27
- * Return false to pause execution (breakpoint)
27
+ * @param executionIndex - The unique execution index for this node execution (0, 1, 2, ...)
28
+ * @param nodeId - The ID of the node being executed
29
+ * @param node - The node definition
30
+ * @param context - The execution context
31
+ * @returns Return false to pause execution (breakpoint)
28
32
  */
29
- onNodeStart?: (nodeId: string, node: NodeDefinition, context: ExecutionContext) => Promise<boolean>;
33
+ onNodeStart?: (executionIndex: number, nodeId: string, node: NodeDefinition, context: ExecutionContext) => Promise<boolean>;
30
34
  /**
31
35
  * Called after a node completes successfully
36
+ * @param executionIndex - The unique execution index for this node execution (0, 1, 2, ...)
37
+ * @param nodeId - The ID of the node that completed
38
+ * @param node - The node definition
39
+ * @param input - The input context available to the node when it started
40
+ * @param output - The output from the node
41
+ * @param duration - The duration of the node execution in milliseconds
32
42
  */
33
- onNodeComplete?: (nodeId: string, node: NodeDefinition, input: unknown, output: unknown, duration: number) => Promise<void>;
43
+ onNodeComplete?: (executionIndex: number, nodeId: string, node: NodeDefinition, input: unknown, output: unknown, duration: number) => Promise<void>;
34
44
  /**
35
45
  * Called when a node encounters an error
46
+ * @param executionIndex - The unique execution index for this node execution (0, 1, 2, ...)
47
+ * @param nodeId - The ID of the node that encountered the error
48
+ * @param node - The node definition
49
+ * @param error - The error that occurred
50
+ * @param context - The execution context
36
51
  */
37
- onNodeError?: (nodeId: string, node: NodeDefinition, error: Error, context: ExecutionContext) => Promise<void>;
52
+ onNodeError?: (executionIndex: number, nodeId: string, node: NodeDefinition, error: Error, context: ExecutionContext) => Promise<void>;
38
53
  /**
39
54
  * Called when execution pauses (breakpoint hit or manual pause)
55
+ * @param executionIndex - The unique execution index for the current node execution (0, 1, 2, ...)
56
+ * @param nodeId - The ID of the node where execution paused
57
+ * @param context - The execution context
40
58
  */
41
- onPause?: (nodeId: string, context: ExecutionContext) => Promise<void>;
59
+ onPause?: (executionIndex: number, nodeId: string, context: ExecutionContext) => Promise<void>;
42
60
  /**
43
61
  * Called when execution resumes
44
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":"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C;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;IACxC,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC"}
package/docs/design.md CHANGED
@@ -124,12 +124,16 @@ Graph definitions should feel like Kubernetes manifests or GitHub Actions - decl
124
124
  The YAML configuration centers around MCP server and tool definitions:
125
125
 
126
126
  1. **MCP Server Metadata**: Defines the MCP server information (name, version, description)
127
- 2. **Tools**: Array of tool definitions, each containing:
127
+ 2. **Execution Limits** (optional): Guardrails to prevent infinite loops in cyclical graphs:
128
+ - **`maxNodeExecutions`** (optional): Maximum total node executions across the entire graph. Default: `1000`. If execution reaches this limit, an error is thrown.
129
+ - **`maxExecutionTimeMs`** (optional): Maximum wall-clock time for graph execution in milliseconds. Default: `300000` (5 minutes). If execution exceeds this time, an error is thrown.
130
+ - Both limits are checked before each node execution. If either limit is exceeded, execution stops immediately with a clear error message.
131
+ 3. **Tools**: Array of tool definitions, each containing:
128
132
  - Standard MCP tool metadata (name, description)
129
133
  - Input parameters schema (MCP tool parameter definitions)
130
134
  - Output schema (what the tool returns)
131
135
  - Note: Entry and exit nodes are defined in the nodes section with a `tool` field indicating which tool they belong to
132
- 3. **Nodes**: The directed graph of nodes that execute when tools are called. Node types include:
136
+ 4. **Nodes**: The directed graph of nodes that execute when tools are called. Node types include:
133
137
  - **`entry`**: Entry point for a tool's graph execution. Receives tool arguments and initializes execution context.
134
138
  - **Output**: The tool input arguments (passed through as-is)
135
139
  - **`mcp`**: Calls an MCP tool on an internal or external MCP server using `callTool`
@@ -154,6 +158,11 @@ server:
154
158
  version: "1.0.0"
155
159
  description: "File utilities"
156
160
 
161
+ # Optional: Execution limits to prevent infinite loops
162
+ executionLimits:
163
+ maxNodeExecutions: 1000 # Maximum total node executions (default: 1000)
164
+ maxExecutionTimeMs: 300000 # Maximum execution time in milliseconds (default: 300000 = 5 minutes)
165
+
157
166
  # Tool Definitions
158
167
  tools:
159
168
  - name: "count_files"
@@ -228,5 +237,10 @@ nodes:
228
237
  2. **Programmatic API**: Exports `McpGraphApi` class for programmatic use (e.g., by visualizer applications)
229
238
  3. **Graph Executor**: Core orchestration engine that executes the directed graph sequentially
230
239
  4. **Execution Context**: Tracks execution state, data flow, and history
240
+ - **Execution History**: Single source of truth - ordered array of all node executions with unique `executionIndex`
241
+ - **Context Building**: Context for expressions is built from history (most recent execution of each node wins)
242
+ - **Flat Structure**: Simple `{ "node_id": output }` structure - backward compatible with `$.node_id` notation
243
+ - **Loop Handling**: When nodes execute multiple times, context shows latest; history functions provide access to all executions
244
+ - **Time-Travel Debugging**: Can reconstruct context at any point in execution history
231
245
  5. **Visual Editor**: Tools to visually view and edit the graph (future)
232
246
  6. **Execution Observer**: Ability to observe and debug graph execution (future - see `docs/future-introspection-debugging.md`)
@@ -33,6 +33,7 @@ The implementation creates a working MCP server that can:
33
33
  All TypeScript interfaces defined:
34
34
  - `McpGraphConfig` - Root configuration structure
35
35
  - `ServerMetadata` - MCP server metadata
36
+ - `ExecutionLimits` - Optional execution limits configuration (maxNodeExecutions, maxExecutionTimeMs)
36
37
  - `ToolDefinition` - Tool definition with input/output schemas (entry/exit nodes are defined in nodes with `tool` field)
37
38
  - `NodeDefinition` - Base node interface
38
39
  - `EntryNode` - Entry point node that receives tool arguments
@@ -212,11 +213,15 @@ Exit node execution:
212
213
  **File: `src/execution/context.ts`**
213
214
 
214
215
  Execution state management:
215
- - Current node tracking
216
- - Data context (node outputs stored by node ID, e.g., `$.entry_node_id.*`, `$.mcp_node_id.*`)
217
- - Execution history
218
- - Error state
219
- - Data access for expressions (all data referenced by node ID)
216
+ - **Execution History**: Single source of truth - ordered array of `NodeExecutionRecord` objects
217
+ - Each record includes: `executionIndex` (unique sequential ID), `nodeId`, `nodeType`, `startTime`, `endTime`, `duration`, `output`, `error`
218
+ - No `input` field - input context is derived from history when needed
219
+ - **Context Building**: Context for JSONata/JSON Logic is built from history once per node execution
220
+ - Walks backwards through history, most recent execution of each node wins
221
+ - Flat context structure: `{ "node_id": output, ... }` - backward compatible with `$.node_id` notation
222
+ - Supports time-travel debugging via `getContextForExecution(executionIndex)` - builds context up to a specific point
223
+ - **Data Access**: All data referenced by node ID (e.g., `$.entry_node_id.*`, `$.mcp_node_id.*`)
224
+ - **Loop Support**: When same node executes multiple times, context contains latest execution; history functions provide access to all executions
220
225
 
221
226
  ### 6.2 Graph Executor
222
227
 
@@ -231,7 +236,11 @@ Main graph execution orchestrator:
231
236
  - Track execution history (node inputs/outputs)
232
237
  - Handle errors with context
233
238
 
234
- **Note:** The execution loop supports cycles (directed graphs with cycles), but infinite loops are prevented by the exit node check. Future loop node types can leverage this cycle support.
239
+ **Note:** The execution loop supports cycles (directed graphs with cycles). To prevent infinite loops, execution limits are enforced:
240
+ - **`maxNodeExecutions`**: Maximum total node executions across the entire graph (default: 1000)
241
+ - **`maxExecutionTimeMs`**: Maximum wall-clock time for graph execution in milliseconds (default: 300000 = 5 minutes)
242
+ - Both limits are checked before each node execution. If either limit is exceeded, execution stops immediately with a clear error message.
243
+ - Limits are configurable in the YAML configuration via the optional `executionLimits` section.
235
244
 
236
245
  ### 6.3 Execution Flow
237
246
 
@@ -26,14 +26,14 @@ const api = new McpGraphApi('config.yaml');
26
26
  const { promise, controller } = api.executeTool('count_files', {
27
27
  directory: './tests/files'
28
28
  }, {
29
- hooks: {
30
- onNodeStart: async (nodeId, node) => {
31
- console.log(`Starting node: ${nodeId} (${node.type})`);
32
- },
33
- onNodeComplete: async (nodeId, node, input, output, duration) => {
34
- console.log(`Node ${nodeId} completed in ${duration}ms`);
35
- }
36
- },
29
+ hooks: {
30
+ onNodeStart: async (executionIndex, nodeId, node) => {
31
+ console.log(`Starting node: ${nodeId} (${node.type}) at execution index ${executionIndex}`);
32
+ },
33
+ onNodeComplete: async (executionIndex, nodeId, node, input, output, duration) => {
34
+ console.log(`Node ${nodeId} (execution ${executionIndex}) completed in ${duration}ms`);
35
+ }
36
+ },
37
37
  enableTelemetry: true
38
38
  });
39
39
 
@@ -110,21 +110,23 @@ All hooks are async functions. If you don't need async operations, you can simpl
110
110
  ```typescript
111
111
  const hooks: ExecutionHooks = {
112
112
  // Async function - no await needed if you don't have async operations
113
- onNodeStart: async (nodeId, node, context) => {
113
+ onNodeStart: async (executionIndex, nodeId, node, context) => {
114
114
  // Update UI synchronously
115
115
  updateNodeStatus(nodeId, 'running');
116
116
  highlightNode(nodeId);
117
+ // executionIndex uniquely identifies this execution instance (important for loops)
117
118
  return true; // Continue execution
118
119
  },
119
120
 
120
121
  // Async function - can use await if needed
121
- onNodeComplete: async (nodeId, node, input, output, duration) => {
122
+ onNodeComplete: async (executionIndex, nodeId, node, input, output, duration) => {
122
123
  // Update UI synchronously
123
124
  updateNodeResult(nodeId, {
124
125
  input,
125
126
  output,
126
127
  duration,
127
- status: 'completed'
128
+ status: 'completed',
129
+ executionIndex // Track which execution instance this was
128
130
  });
129
131
  updateNodeVisualization(nodeId, output);
130
132
 
@@ -132,10 +134,11 @@ const hooks: ExecutionHooks = {
132
134
  // await logToServer(nodeId, output);
133
135
  },
134
136
 
135
- onNodeError: async (nodeId, node, error, context) => {
137
+ onNodeError: async (executionIndex, nodeId, node, error, context) => {
136
138
  // Error handling
137
139
  showError(nodeId, error);
138
140
  updateNodeStatus(nodeId, 'error');
141
+ // executionIndex can be used to get context: api.getContextForExecution(executionIndex)
139
142
  }
140
143
  };
141
144
 
@@ -214,8 +217,8 @@ interface ExecutionController {
214
217
 
215
218
  ```typescript
216
219
  const hooks: ExecutionHooks = {
217
- onPause: async (nodeId, context) => {
218
- console.log(`Paused at node: ${nodeId}`);
220
+ onPause: async (executionIndex, nodeId, context) => {
221
+ console.log(`Paused at node: ${nodeId} (execution index: ${executionIndex})`);
219
222
  // Show debugger UI
220
223
  showDebuggerUI();
221
224
  },
@@ -290,8 +293,9 @@ if (controller) {
290
293
 
291
294
  ```typescript
292
295
  const hooks: ExecutionHooks = {
293
- onNodeStart: async (nodeId, node, context) => {
296
+ onNodeStart: async (executionIndex, nodeId, node, context) => {
294
297
  // Conditional breakpoint logic
298
+ // executionIndex can be used to identify specific execution instances in loops
295
299
  if (shouldBreak(nodeId, context)) {
296
300
  return false; // Pause execution
297
301
  }
@@ -499,26 +503,29 @@ class GraphVisualizer {
499
503
 
500
504
  async executeWithVisualization(toolName: string, args: Record<string, unknown>) {
501
505
  const hooks: ExecutionHooks = {
502
- onNodeStart: async (nodeId, node, context) => {
506
+ onNodeStart: async (executionIndex, nodeId, node, context) => {
503
507
  this.updateNodeStatus(nodeId, 'running');
504
508
  this.highlightNode(nodeId);
509
+ // executionIndex uniquely identifies this execution (important for loops)
505
510
  return true;
506
511
  },
507
512
 
508
- onNodeComplete: async (nodeId, node, input, output, duration) => {
513
+ onNodeComplete: async (executionIndex, nodeId, node, input, output, duration) => {
509
514
  this.updateNodeStatus(nodeId, 'completed');
510
- this.updateNodeData(nodeId, { input, output, duration });
515
+ this.updateNodeData(nodeId, { input, output, duration, executionIndex });
511
516
  this.unhighlightNode(nodeId);
512
517
  },
513
518
 
514
- onNodeError: async (nodeId, node, error, context) => {
519
+ onNodeError: async (executionIndex, nodeId, node, error, context) => {
515
520
  this.updateNodeStatus(nodeId, 'error');
516
521
  this.showError(nodeId, error);
522
+ // Can use executionIndex to get context: api.getContextForExecution(executionIndex)
517
523
  },
518
524
 
519
- onPause: async (nodeId, context) => {
525
+ onPause: async (executionIndex, nodeId, context) => {
520
526
  this.showDebuggerControls();
521
527
  this.updateExecutionStatus('paused');
528
+ // executionIndex identifies which execution instance is paused
522
529
  },
523
530
 
524
531
  onResume: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpgraph",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "MCP server that executes directed graphs of MCP server calls",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -1,284 +0,0 @@
1
- # Execution Context & History Redesign
2
-
3
- ## Rationale
4
-
5
- The current execution context design has several limitations that become apparent when considering loops, debugging, and observability:
6
-
7
- ### Current Issues
8
-
9
- 1. **No execution history**: Only current context is maintained; no record of past executions
10
- 2. **Previous node tracking is a hack**: Tracked separately (`previousNodeId`) instead of being derived from history
11
- 3. **Loops overwrite data**: Same node executing multiple times overwrites previous outputs in context
12
- 4. **Context structure doesn't distinguish iterations**: Using node ID as key doesn't handle multiple executions of the same node
13
- 5. **Can't reconstruct historical context**: No way to see what context was available to a node at the time it executed (for debugging)
14
-
15
- ### Goals
16
-
17
- 1. **Single source of truth**: Execution history should be the authoritative record
18
- 2. **Handle loops gracefully**: Multiple executions of the same node should be accessible
19
- 3. **Derive previous node from history**: No separate tracking needed
20
- 4. **Time-travel debugging**: Reconstruct context at any point in execution
21
- 5. **Powerful JSONata access**: Access all executions, not just latest
22
- 6. **Backward compatibility**: Existing expressions should continue to work
23
-
24
- ## Current Implementation
25
-
26
- ### What We Have Now
27
-
28
- - **Execution History**: `NodeExecutionRecord[]` stored in `ExecutionContext`
29
- - Each record: `nodeId`, `nodeType`, `startTime`, `endTime`, `duration`, `input`, `output`, `error`
30
- - Used for telemetry and debugging hooks
31
-
32
- - **Current Context**: Separate `data` object keyed by node ID
33
- - `this.data[nodeId] = output` (overwrites on loops)
34
- - Used for JSONata/JSON Logic evaluation
35
-
36
- - **Previous Node Tracking**: Separate `previousNodeId` variable passed around
37
-
38
- ### Problems
39
-
40
- 1. **Redundancy**: Both history and context store node outputs
41
- 2. **Input storage**: Storing `input` (full context) is redundant - can be derived from history
42
- 3. **Loop handling**: Context overwrites, history has multiple records but can't distinguish them
43
- 4. **Previous node**: Tracked separately instead of derived from history
44
-
45
- ## Proposed Design
46
-
47
- ### Core Insight
48
-
49
- **If execution is sequential (no parallelism), the execution history is just an ordered array of node executions where:**
50
- - Each execution's input is the context built from all previous executions
51
- - Previous node is just `history[index - 1]`
52
- - Context is built from history once per node execution (when node starts)
53
- - History is the single source of truth
54
-
55
- ### Execution History Structure
56
-
57
- **Structure:**
58
- ```typescript
59
- interface NodeExecutionRecord {
60
- executionIndex: number; // Position in overall execution history (0, 1, 2, ...) - unique identifier
61
- nodeId: string;
62
- nodeType: string;
63
- startTime: number;
64
- endTime: number;
65
- duration: number;
66
- output: unknown; // Only store output, derive input from history
67
- error?: Error;
68
- }
69
-
70
- class ExecutionContext {
71
- private history: NodeExecutionRecord[] = [];
72
-
73
- getData(): Record<string, unknown> {
74
- // Build context from history - called once per node execution
75
- // The context is built when the node starts and used throughout its execution
76
- return this.buildContextFromHistory();
77
- }
78
-
79
- getPreviousNode(currentIndex: number): NodeExecutionRecord | null {
80
- return currentIndex > 0 ? this.history[currentIndex - 1] : null;
81
- }
82
- }
83
- ```
84
-
85
- **Key Points:**
86
- - History array is the single source of truth
87
- - No separate `data` object
88
- - No `input` field in records (derivable from history)
89
- - Context built fresh from history once per node execution
90
- - Previous node derived from history index
91
-
92
- ### Context Structure for JSONata Access
93
-
94
- We use a **flat context structure** with **history access functions**:
95
-
96
- **Context Building:**
97
- ```typescript
98
- private buildContextFromHistory(): Record<string, unknown> {
99
- const context: Record<string, unknown> = {};
100
- // Walk backwards, most recent execution of each node wins
101
- for (let i = this.history.length - 1; i >= 0; i--) {
102
- const record = this.history[i];
103
- if (!(record.nodeId in context)) {
104
- context[record.nodeId] = record.output;
105
- }
106
- }
107
- return context;
108
- }
109
- ```
110
-
111
- **Example Context Object:**
112
- ```json
113
- {
114
- "entry_count_files": { "directory": "/path/to/dir" },
115
- "list_directory_node": "[FILE] file1.txt\n[FILE] file2.txt",
116
- "count_files_node": { "count": 2 }
117
- }
118
- ```
119
-
120
- **If same node executes multiple times (loop):**
121
- ```json
122
- {
123
- "entry_loop": { "value": 0 },
124
- "increment_node": { "value": 3 } // Only latest execution
125
- }
126
- ```
127
-
128
- **JSONata Access:**
129
- - `$.node_name` → latest output (backward compatible, simple notation)
130
- - `$.node_name.foo` → property access
131
-
132
- **Custom JSONata Functions (access history directly):**
133
- - `$previousNode()` → previous node's output (from history)
134
- - `$previousNode(index)` → node that executed N steps before current
135
- - `$executionCount(nodeName)` → count of executions for a node
136
- - `$nodeExecution(nodeName, index)` → specific execution by index (0 = first, -1 = last)
137
- - `$nodeExecutions(nodeName)` → array of all executions for a node
138
-
139
- **Example Usage:**
140
- ```jsonata
141
- // Get previous node's output
142
- $previousNode()
143
-
144
- // Get execution count
145
- $executionCount("increment_node") // Returns 3 if executed 3 times
146
-
147
- // Get first execution
148
- $nodeExecution("increment_node", 0) // Returns { "value": 1 }
149
-
150
- // Get all executions
151
- $nodeExecutions("increment_node") // Returns [{ "value": 1 }, { "value": 2 }, { "value": 3 }]
152
-
153
- // Get second-to-last execution
154
- $nodeExecution("increment_node", -2) // Returns { "value": 2 }
155
- ```
156
-
157
- **Implementation Note:**
158
- Functions receive the execution history array and current execution index as parameters, allowing them to query history directly without exposing it in the context structure.
159
-
160
- **Benefits:**
161
- - Simple, flat context structure (backward compatible)
162
- - Fast to build
163
- - Clean notation: `$.node_name` for latest
164
- - History access is explicit and clear
165
- - No namespace conflicts (no special keys in context)
166
- - Functions can provide powerful queries beyond simple data access
167
- - History queries are separate from context structure
168
-
169
- ## Design Decisions
170
-
171
- ### Input Storage
172
-
173
- **Decision**: Don't store `input` in `NodeExecutionRecord` - derive from history when needed.
174
-
175
- **Rationale**: No redundancy, can always derive input by building context from history up to that point.
176
-
177
- ### Previous Node Resolution
178
-
179
- **Decision**: `$previousNode()` is a custom JSONata function that queries the history array.
180
-
181
- **Rationale**: Cleaner, more flexible, and keeps history access explicit.
182
-
183
- ### Entry Node Handling
184
-
185
- **Decision**: Entry node's input is the tool input. When building context for the entry node, tool input is available as the entry node's output (stored in history).
186
-
187
- **Rationale**: Consistent with other nodes - tool input is the input to the entry node.
188
-
189
- ### Execution Index
190
-
191
- **Decision**: Add `executionIndex` field to `NodeExecutionRecord` to uniquely identify each execution.
192
-
193
- **Rationale**:
194
- - Provides a unique identifier for each execution (even when same node executes multiple times)
195
- - Enables API endpoints to reference specific executions (e.g., "get context for execution at index 5")
196
- - Makes it easy for debuggers to reference and query specific executions
197
- - The index represents the position in the overall execution history array (0, 1, 2, ...)
198
-
199
- ## Implementation Plan
200
-
201
- ### Phase 1: Refactor ExecutionContext
202
-
203
- 1. Remove `data` object, keep only `history`
204
- 2. Remove `input` from `NodeExecutionRecord` (derive from history)
205
- 3. Add `executionIndex` to `NodeExecutionRecord` (set when adding to history)
206
- 4. Implement `buildContextFromHistory(upToIndex?: number)` method:
207
- - If `upToIndex` is provided, build context from history up to that index (for debugging)
208
- - If not provided, build context from entire history (for current execution)
209
- 5. Update `getData()` to build context from history once per node execution
210
-
211
- ### Phase 2: Update Node Executors
212
-
213
- 1. Remove `previousNodeId` parameter from all node executors
214
- 2. Update `addHistory()` to include `executionIndex` (current history length)
215
- 3. Update `addHistory()` calls to not pass `input` (or derive it)
216
- 4. Update exit node to get previous node from history instead of `previousNodeId`
217
-
218
- ### Phase 3: Update Expression Evaluation
219
-
220
- 1. Context stays flat - no changes needed to context structure
221
- 2. Add custom JSONata functions that receive history and current index:
222
- - `$previousNode()` - returns previous node's output (from history)
223
- - `$previousNode(index)` - returns node that executed N steps before current
224
- - `$executionCount(nodeName)` - count of executions for a node
225
- - `$nodeExecution(nodeName, index)` - specific execution by index (0 = first, -1 = last)
226
- - `$nodeExecutions(nodeName)` - array of all executions for a node
227
- 3. Update `evaluateJsonLogic()` to work with flat context and new functions
228
- 4. Functions need access to:
229
- - Execution history array
230
- - Current execution index (to determine "previous")
231
-
232
- ### Phase 4: Update Hooks and Telemetry
233
-
234
- 1. Update hooks to derive input from history when needed
235
- 2. Verify telemetry still works correctly (it already uses history structure, but verify after removing `input` field)
236
- 3. Update introspection/debugging docs
237
-
238
- ### Phase 5: Add Debugging API Endpoint
239
-
240
- 1. Add `getContextForExecution(executionIndex: number)` method to API:
241
- - Takes an `executionIndex` to identify a specific execution
242
- - Builds context from history up to that execution index
243
- - Returns the context that was available to that node when it executed
244
- - Useful for time-travel debugging - "what context did this node see?"
245
- 2. Add helper method `getExecutionByIndex(executionIndex: number)` to easily access a specific record
246
-
247
- ### Phase 6: Testing & Documentation
248
-
249
- 1. Add tests for loop scenarios
250
- 2. Add tests for `$previousNode()` and other custom functions
251
- 3. Add tests for `getContextForExecution()` API endpoint
252
- 4. Update examples to show new capabilities
253
- 5. Update documentation
254
-
255
- ## Open Questions
256
-
257
- 1. **Performance**: Is building context from history too slow? (Answer: No - we build it once per node execution when the node starts, and it's a simple loop through the history array)
258
-
259
- 2. **Backward Compatibility**: Do we need to support old flat context structure? (Answer: Yes - the flat context structure maintains full backward compatibility - `$.node_name` works exactly as before)
260
-
261
- 3. **History Persistence**: Should history be persisted across executions? (Answer: Not in scope for this redesign, but structure supports it)
262
-
263
- 4. **Parallel Execution**: If we add parallel execution later, how does this design handle it? (Answer: Would need execution IDs or iteration numbers, but structure can accommodate)
264
-
265
- ## Next Steps
266
-
267
- 1. **Implementation**: Phase 1 (refactor ExecutionContext)
268
- - Remove `data` object
269
- - Remove `input` from `NodeExecutionRecord`
270
- - Add `executionIndex` to `NodeExecutionRecord`
271
- - Implement `buildContextFromHistory(upToIndex?)` method
272
- 2. **Implementation**: Phase 2 (update node executors)
273
- - Remove `previousNodeId` parameter from all node executors
274
- - Update `addHistory()` to include `executionIndex` (current history length)
275
- - Update exit node to get previous node from history instead of `previousNodeId`
276
- 3. **Implementation**: Phase 3 (add history functions)
277
- - Design function signatures (how to pass history/index to functions)
278
- - Implement `$previousNode()`, `$executionCount()`, `$nodeExecution()`, `$nodeExecutions()`
279
- 4. **Implementation**: Phase 5 (add debugging API)
280
- - Add `getContextForExecution(executionIndex: number)` to API
281
- - Add `getExecutionByIndex(executionIndex: number)` helper
282
- 5. **Testing**: Ensure all existing tests pass
283
- 6. **Testing**: Add loop tests, new function tests, and API endpoint tests
284
-