Skip to content

Commit ae91f2c

Browse files
committed
fix refine message for tools
1 parent 43e9010 commit ae91f2c

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

common/src/types/dynamic-agent-template.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,7 @@ export const DynamicAgentDefinitionSchema = z.object({
103103
model: z.string(),
104104

105105
// Tools and spawnable agents
106-
toolNames: z
107-
.array(z.enum(toolNames))
108-
.optional()
109-
.default([])
110-
.refine((tools) => {
111-
if (!tools) return true
112-
const validToolNames = toolNames as readonly string[]
113-
const invalidTools = tools.filter(
114-
(tool) => !validToolNames.includes(tool),
115-
)
116-
return invalidTools.length === 0
117-
})
118-
.refine((tools) => {
119-
if (!tools) return { message: 'Tools array is undefined' }
120-
const validToolNames = toolNames as readonly string[]
121-
const invalidTools = tools.filter(
122-
(tool) => !validToolNames.includes(tool),
123-
)
124-
return {
125-
message: `Invalid tool names: ${invalidTools.join(', ')}. Available tools: ${toolNames.join(', ')}`,
126-
}
127-
}),
106+
toolNames: z.array(z.enum(toolNames)).optional().default([]),
128107
spawnableAgents: z.array(z.string()).optional().default([]),
129108

130109
// Input and output

0 commit comments

Comments
 (0)