Skip to content

Commit c0c3d25

Browse files
committed
add tool set
1 parent 8b9cb88 commit c0c3d25

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/agent-runtime/src/tools/prompts.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,26 @@ Important: You only have access to the tools below. Do not use any other tools -
268268
${toolDescriptions.join('\n\n')}
269269
`.trim()
270270
}
271+
272+
export async function getToolSet(params: {
273+
toolNames: string[]
274+
additionalToolDefinitions: () => Promise<CustomToolDefinitions>
275+
}): Promise<ToolSet> {
276+
const { toolNames, additionalToolDefinitions } = params
277+
278+
const toolSet: ToolSet = {}
279+
for (const toolName of toolNames) {
280+
if (toolName in toolParams) {
281+
toolSet[toolName] = toolParams[toolName as ToolName]
282+
}
283+
}
284+
285+
const toolDefinitions = await additionalToolDefinitions()
286+
for (const [toolName, toolDefinition] of Object.entries(toolDefinitions)) {
287+
toolSet[toolName] = cloneDeep(toolDefinition) satisfies {
288+
inputSchema: { _zod: { input: any } }
289+
} as Omit<typeof toolDefinition, 'inputSchema'> & { inputSchema: z.ZodType }
290+
}
291+
292+
return toolSet
293+
}

0 commit comments

Comments
 (0)