MCPcopy
hub / github.com/Doorman11991/smallcode / recordToolCall

Method recordToolCall

bin/trace_recorder.js:40–57  ·  view source on GitHub ↗

* Record a tool call step.

(name, args, result, durationMs)

Source from the content-addressed store, hash-verified

38 * Record a tool call step.
39 */
40 recordToolCall(name, args, result, durationMs) {
41 if (!this.recording || !this.current) return;
42 // Redact args + result before persisting. Tool args from the model can
43 // include literal API keys (e.g. when user pastes an env var into the
44 // prompt) and tool results often contain file content with secrets.
45 const safeArgs = redactValue(args);
46 const safeResult = typeof result === 'string'
47 ? redactString(result).slice(0, 2000)
48 : JSON.stringify(redactValue(result)).slice(0, 2000);
49 this.current.steps.push({
50 type: 'tool_call',
51 name,
52 args: safeArgs,
53 result: safeResult,
54 durationMs,
55 timestamp: Date.now(),
56 });
57 }
58
59 /**
60 * Record a model response (text or tool decision).

Callers 1

runAgentLoopFunction · 0.80

Calls 2

redactStringFunction · 0.85
redactValueFunction · 0.50

Tested by

no test coverage detected