(client: AxiosInstance)
| 6 | * Create tools API functions bound to a client instance |
| 7 | */ |
| 8 | export function bindToolsApi(client: AxiosInstance) { |
| 9 | return { |
| 10 | /** |
| 11 | * Get all available tools |
| 12 | */ |
| 13 | getAllTools: async (nodeName = 'toolAgentflow'): Promise<Tool[]> => { |
| 14 | const response = await client.post(`/node-load-method/${encodeURIComponent(nodeName)}`, { loadMethod: 'listTools' }) |
| 15 | return response.data |
| 16 | }, |
| 17 | |
| 18 | /** |
| 19 | * Get input argument names for the currently selected tool. |
| 20 | * Passes current node inputs as `currentNode.inputs` so the server can resolve the selected tool. |
| 21 | */ |
| 22 | getToolInputArgs: async (inputs: Record<string, unknown>, nodeName = 'toolAgentflow'): Promise<Tool[]> => { |
| 23 | const response = await client.post(`/node-load-method/${encodeURIComponent(nodeName)}`, { |
| 24 | loadMethod: 'listToolInputArgs', |
| 25 | currentNode: { inputs } |
| 26 | }) |
| 27 | return response.data |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | export type ToolsApi = ReturnType<typeof bindToolsApi> |
no outgoing calls
no test coverage detected