(id: string, def: ToolDefinition)
| 54 | }) |
| 55 | |
| 56 | function fromPlugin(id: string, def: ToolDefinition): Tool.Info { |
| 57 | return { |
| 58 | id, |
| 59 | init: async () => ({ |
| 60 | parameters: z.object(def.args), |
| 61 | description: def.description, |
| 62 | execute: async (args, ctx) => { |
| 63 | const result = await def.execute(args as any, ctx) |
| 64 | return { |
| 65 | title: "", |
| 66 | output: result, |
| 67 | metadata: {}, |
| 68 | } |
| 69 | }, |
| 70 | }), |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | export async function register(tool: Tool.Info) { |
| 75 | const { custom } = await state() |