One tool, multiple functions? A new method

I have a strange way to make it simulate multiple tools in one tool!

For the tool schema, you can check this file toolSchema.ts. The way is to create a “name” and “args” in the tool arguments (Yep, JSON string in a original JSON).

For extract for simulation, multiple tools can be used like this file geminiService.ts. This can extract the allInOneTool back to normal tool name and args.

But this way has some limitations! There will be incorrect escape characters in the response which will need post-process, but it will still leave some false positives. You can find it at geminiService.ts line 529 to 566

I wonder if someone has a better solution but this works for me!

Screenshot

1 Like