@@ -31,20 +31,20 @@ describe('validateToolName', () => {
31
31
expect ( result . warnings ) . toHaveLength ( 0 ) ;
32
32
} ) ;
33
33
34
- test ( 'should reject names with dots' , ( ) => {
34
+ test ( 'should accept names with dots' , ( ) => {
35
35
const result = validateToolName ( 'admin.tools.list' ) ;
36
- expect ( result . isValid ) . toBe ( false ) ;
37
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "."' ) ;
36
+ expect ( result . isValid ) . toBe ( true ) ;
37
+ expect ( result . warnings ) . toHaveLength ( 0 ) ;
38
38
} ) ;
39
39
40
- test ( 'should reject names with forward slashes' , ( ) => {
40
+ test ( 'should accept names with forward slashes' , ( ) => {
41
41
const result = validateToolName ( 'user/profile/update' ) ;
42
- expect ( result . isValid ) . toBe ( false ) ;
43
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "/"' ) ;
42
+ expect ( result . isValid ) . toBe ( true ) ;
43
+ expect ( result . warnings ) . toHaveLength ( 0 ) ;
44
44
} ) ;
45
45
46
46
test ( 'should accept mixed character names' , ( ) => {
47
- const result = validateToolName ( 'DATA_EXPORT_v2- 1' ) ;
47
+ const result = validateToolName ( 'DATA_EXPORT_v2. 1' ) ;
48
48
expect ( result . isValid ) . toBe ( true ) ;
49
49
expect ( result . warnings ) . toHaveLength ( 0 ) ;
50
50
} ) ;
@@ -55,8 +55,8 @@ describe('validateToolName', () => {
55
55
expect ( result . warnings ) . toHaveLength ( 0 ) ;
56
56
} ) ;
57
57
58
- test ( 'should accept 64 character names' , ( ) => {
59
- const name = 'a' . repeat ( 64 ) ;
58
+ test ( 'should accept 128 character names' , ( ) => {
59
+ const name = 'a' . repeat ( 128 ) ;
60
60
const result = validateToolName ( name ) ;
61
61
expect ( result . isValid ) . toBe ( true ) ;
62
62
expect ( result . warnings ) . toHaveLength ( 0 ) ;
@@ -70,11 +70,11 @@ describe('validateToolName', () => {
70
70
expect ( result . warnings ) . toContain ( 'Tool name cannot be empty' ) ;
71
71
} ) ;
72
72
73
- test ( 'should reject names longer than 64 characters' , ( ) => {
74
- const name = 'a' . repeat ( 65 ) ;
73
+ test ( 'should reject names longer than 128 characters' , ( ) => {
74
+ const name = 'a' . repeat ( 129 ) ;
75
75
const result = validateToolName ( name ) ;
76
76
expect ( result . isValid ) . toBe ( false ) ;
77
- expect ( result . warnings ) . toContain ( 'Tool name exceeds maximum length of 64 characters (current: 65 )' ) ;
77
+ expect ( result . warnings ) . toContain ( 'Tool name exceeds maximum length of 128 characters (current: 129 )' ) ;
78
78
} ) ;
79
79
80
80
test ( 'should reject names with spaces' , ( ) => {
@@ -92,7 +92,7 @@ describe('validateToolName', () => {
92
92
test ( 'should reject names with other special characters' , ( ) => {
93
93
const result = validateToolName ( 'user@domain.com' ) ;
94
94
expect ( result . isValid ) . toBe ( false ) ;
95
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "@", "." ' ) ;
95
+ expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "@"' ) ;
96
96
} ) ;
97
97
98
98
test ( 'should reject names with multiple invalid characters' , ( ) => {
@@ -133,22 +133,22 @@ describe('validateToolName', () => {
133
133
expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dash, which may cause parsing issues in some contexts' ) ;
134
134
} ) ;
135
135
136
- test ( 'should reject names starting with dot' , ( ) => {
136
+ test ( 'should warn about names starting with dot' , ( ) => {
137
137
const result = validateToolName ( '.get.user' ) ;
138
- expect ( result . isValid ) . toBe ( false ) ;
139
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "." ' ) ;
138
+ expect ( result . isValid ) . toBe ( true ) ;
139
+ expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dot, which may cause parsing issues in some contexts ' ) ;
140
140
} ) ;
141
141
142
- test ( 'should reject names ending with dot' , ( ) => {
142
+ test ( 'should warn about names ending with dot' , ( ) => {
143
143
const result = validateToolName ( 'get.user.' ) ;
144
- expect ( result . isValid ) . toBe ( false ) ;
145
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "." ' ) ;
144
+ expect ( result . isValid ) . toBe ( true ) ;
145
+ expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dot, which may cause parsing issues in some contexts ' ) ;
146
146
} ) ;
147
147
148
- test ( 'should reject names with both leading and trailing dots' , ( ) => {
148
+ test ( 'should warn about names with both leading and trailing dots' , ( ) => {
149
149
const result = validateToolName ( '.get.user.' ) ;
150
- expect ( result . isValid ) . toBe ( false ) ;
151
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "." ' ) ;
150
+ expect ( result . isValid ) . toBe ( true ) ;
151
+ expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dot, which may cause parsing issues in some contexts ' ) ;
152
152
} ) ;
153
153
} ) ;
154
154
} ) ;
@@ -202,18 +202,18 @@ describe('validateAndWarnToolName', () => {
202
202
} ) ;
203
203
204
204
test ( 'should return false for names exceeding length limit' , ( ) => {
205
- const longName = 'a' . repeat ( 65 ) ;
205
+ const longName = 'a' . repeat ( 129 ) ;
206
206
const result = validateAndWarnToolName ( longName ) ;
207
207
expect ( result ) . toBe ( false ) ;
208
208
expect ( warnSpy ) . toHaveBeenCalled ( ) ; // Now issues warnings instead of errors
209
209
} ) ;
210
210
} ) ;
211
211
212
212
describe ( 'edge cases and robustness' , ( ) => {
213
- test ( 'should reject names with only dots' , ( ) => {
213
+ test ( 'should warn about names with only dots' , ( ) => {
214
214
const result = validateToolName ( '...' ) ;
215
- expect ( result . isValid ) . toBe ( false ) ;
216
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "." ' ) ;
215
+ expect ( result . isValid ) . toBe ( true ) ;
216
+ expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dot, which may cause parsing issues in some contexts ' ) ;
217
217
} ) ;
218
218
219
219
test ( 'should handle names with only dashes' , ( ) => {
@@ -222,10 +222,10 @@ describe('edge cases and robustness', () => {
222
222
expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a dash, which may cause parsing issues in some contexts' ) ;
223
223
} ) ;
224
224
225
- test ( 'should reject names with only forward slashes' , ( ) => {
225
+ test ( 'should warn about names with only forward slashes' , ( ) => {
226
226
const result = validateToolName ( '///' ) ;
227
- expect ( result . isValid ) . toBe ( false ) ;
228
- expect ( result . warnings ) . toContain ( 'Tool name contains invalid characters: "/" ' ) ;
227
+ expect ( result . isValid ) . toBe ( true ) ;
228
+ expect ( result . warnings ) . toContain ( 'Tool name starts or ends with a slash, which may cause parsing issues in some contexts ' ) ;
229
229
} ) ;
230
230
231
231
test ( 'should handle names with mixed valid and invalid characters' , ( ) => {
0 commit comments