MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / withIdempotencyKey

Function withIdempotencyKey

scripts/gen-governance-audit-examples.ts:30–34  ·  view source on GitHub ↗
(toolName: string, args: Record<string, unknown>)

Source from the content-addressed store, hash-verified

28type ToolCall = { tool: string; args: Record<string, unknown>; result: Record<string, unknown>; isError?: boolean };
29
30function withIdempotencyKey(toolName: string, args: Record<string, unknown>): Record<string, unknown> {
31 if (!MUTATING_TOOLS.has(toolName)) return args;
32 if (args.idempotency_key !== undefined) return args;
33 return { ...args, idempotency_key: `gen-${randomUUID()}` };
34}
35
36// FIXME(framework-migration): reaches into the MCP Server's private
37// `_requestHandlers` map. server/src/training-agent/FRAMEWORK_MIGRATION.md

Callers 1

callToolFunction · 0.70

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected