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

Function idempotentWriteKey

src/tools/dedup.js:64–67  ·  view source on GitHub ↗

* Compute a stable hash for (toolName, args). Same scheme used by lookup() * — sorted-keys JSON so callers can re-derive the key without instantiating * a ToolDedup.

(name, args)

Source from the content-addressed store, hash-verified

62 * a ToolDedup.
63 */
64function idempotentWriteKey(name, args) {
65 const norm = JSON.stringify(args || {}, Object.keys(args || {}).sort());
66 return crypto.createHash('sha1').update(name + '|' + norm).digest('hex').slice(0, 16);
67}
68
69class ToolDedup {
70 constructor(options = {}) {

Callers 3

hasMethod · 0.85
recordMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected