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

Method record

src/tools/trust_decay.js:37–51  ·  view source on GitHub ↗

Record a tool outcome.

(toolName, success)

Source from the content-addressed store, hash-verified

35
36 /** Record a tool outcome. */
37 record(toolName, success) {
38 if (this.disabled || !toolName) return;
39 if (!this.scores.has(toolName)) {
40 this.scores.set(toolName, { consecutiveFails: 0, totalFails: 0, totalCalls: 0 });
41 }
42 const s = this.scores.get(toolName);
43 s.totalCalls++;
44 if (success) {
45 if (this.resetOnSuccess) s.consecutiveFails = 0;
46 // Don't touch totalFails — it tracks historical
47 } else {
48 s.consecutiveFails++;
49 s.totalFails++;
50 }
51 }
52
53 /**
54 * Get the trust level for a tool.

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected