File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
packages/agent-runtime/src/tools Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments