MCPcopy Index your code
hub / github.com/TanStack/ai / assertSafeToolName

Function assertSafeToolName

packages/ai-isolate-cloudflare/src/worker/wrap-code.ts:68–77  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

66])
67
68function assertSafeToolName(name: string): void {
69 if (!VALID_TOOL_NAME.test(name)) {
70 throw new Error(
71 `Invalid tool name '${name}': must match ${VALID_TOOL_NAME} (letters, digits, _, $; cannot start with a digit)`,
72 )
73 }
74 if (RESERVED_TOOL_NAMES.has(name)) {
75 throw new Error(`Invalid tool name '${name}': reserved JavaScript keyword`)
76 }
77}
78
79/**
80 * Generate tool wrapper code that collects calls or returns cached results.

Callers 1

generateToolWrappersFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected