toolsJson function
The tools_json native reads for tools, or null for none.
Implementation
String? toolsJson(List<Tool> tools) => tools.isEmpty
? null
: jsonEncode([
for (final tool in tools)
{
'type': 'function',
'function': {
'name': tool.name,
'description': tool.description,
'parameters': tool.parameters,
},
},
]);