Spaces:
Running
Running
fix(tools): tool call name must be a valid python variable name (#1466)
Browse files
src/lib/server/tools/index.ts
CHANGED
@@ -69,7 +69,11 @@ const toolInputSchema = toolInputBaseSchema.and(
|
|
69 |
|
70 |
export const editableToolSchema = z
|
71 |
.object({
|
72 |
-
name: z
|
|
|
|
|
|
|
|
|
73 |
// only allow huggingface spaces either through namespace or direct URLs
|
74 |
baseUrl: z.union([
|
75 |
z.string().regex(/^[^/]+\/[^/]+$/),
|
|
|
69 |
|
70 |
export const editableToolSchema = z
|
71 |
.object({
|
72 |
+
name: z
|
73 |
+
.string()
|
74 |
+
.regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/) // only allow letters, numbers, and underscores, and start with a letter or underscore
|
75 |
+
.min(1)
|
76 |
+
.max(40),
|
77 |
// only allow huggingface spaces either through namespace or direct URLs
|
78 |
baseUrl: z.union([
|
79 |
z.string().regex(/^[^/]+\/[^/]+$/),
|