|
4 | 4 | * Tool names SHOULD be between 1 and 128 characters in length (inclusive). |
5 | 5 | * Tool names are case-sensitive. |
6 | 6 | * Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits |
7 | | - * (0-9), underscore (_), dash (-), dot (.), and forward slash (/). |
| 7 | + * (0-9), underscore (_), dash (-), and dot (.). |
8 | 8 | * Tool names SHOULD NOT contain spaces, commas, or other special characters. |
9 | 9 | */ |
10 | 10 |
|
11 | 11 | /** |
12 | 12 | * Regular expression for valid tool names according to SEP-986 specification |
13 | 13 | */ |
14 | | -const TOOL_NAME_REGEX = /^[A-Za-z0-9._/-]{1,128}$/; |
| 14 | +const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/; |
15 | 15 |
|
16 | 16 | /** |
17 | 17 | * Validates a tool name according to the SEP specification |
@@ -56,21 +56,17 @@ export function validateToolName(name: string): { |
56 | 56 | if (name.startsWith('.') || name.endsWith('.')) { |
57 | 57 | warnings.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"); |
58 | 58 | } |
59 | | - |
60 | | - if (name.startsWith('/') || name.endsWith('/')) { |
61 | | - warnings.push("Tool name starts or ends with a slash, which may cause parsing issues in some contexts"); |
62 | | - } |
63 | | - |
| 59 | + |
64 | 60 | // Check for invalid characters |
65 | 61 | if (!TOOL_NAME_REGEX.test(name)) { |
66 | 62 | const invalidChars = name |
67 | 63 | .split('') |
68 | | - .filter(char => !/[A-Za-z0-9._/-]/.test(char)) |
| 64 | + .filter(char => !/[A-Za-z0-9._-]/.test(char)) |
69 | 65 | .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates |
70 | | - |
| 66 | + |
71 | 67 | warnings.push( |
72 | 68 | `Tool name contains invalid characters: ${invalidChars.map(c => `"${c}"`).join(', ')}`, |
73 | | - "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), dot (.), and forward slash (/)" |
| 69 | + "Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)" |
74 | 70 | ); |
75 | 71 |
|
76 | 72 | return { |
|
0 commit comments