MCPcopy Create free account
hub / github.com/Roy3838/Observer / getLastToolsForAgent

Method getLastToolsForAgent

app/src/utils/IterationStore.ts:403–420  ·  view source on GitHub ↗
(agentId: string, limit: number = 3)

Source from the content-addressed store, hash-verified

401 }
402
403 public getLastToolsForAgent(agentId: string, limit: number = 3): ToolCall[] {
404 const iterations = this.getIterationsForAgent(agentId);
405 const allTools: ToolCall[] = [];
406
407 // Collect all tools from all iterations, most recent first
408 for (let i = iterations.length - 1; i >= 0; i--) {
409 const iteration = iterations[i];
410 // Add tools in reverse order (most recent first within the iteration)
411 for (let j = iteration.tools.length - 1; j >= 0; j--) {
412 allTools.push(iteration.tools[j]);
413 if (allTools.length >= limit) {
414 return allTools;
415 }
416 }
417 }
418
419 return allTools;
420 }
421
422 public getToolsFromLastIteration(agentId: string): ToolCall[] {
423 const iterations = this.getIterationsForAgent(agentId);

Callers

nothing calls this directly

Calls 2

getIterationsForAgentMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected