(name: string)
| 66 | ]) |
| 67 | |
| 68 | function 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. |
no test coverage detected