findTool static method

Tool? findTool(
  1. String toolName,
  2. List<Tool> tools
)

Get tool by name from a list of tools

toolName - Name of the tool to find tools - List of tools to search in

Returns the tool if found, null otherwise

Implementation

static Tool? findTool(String toolName, List<Tool> tools) {
  try {
    return tools.firstWhere((tool) => tool.function.name == toolName);
  } catch (e) {
    return null;
  }
}