def _find_tool(tool_name: str, tools: Sequence[BaseTool]) -> BaseTool:
    """
    Find a tool by name.

    Args:
        tool_name: Name of the tool to find.

    Returns:
        Tool or StructuredTool.

    """
    for tool in tools:
        if tool.metadata.name == tool_name:
            return tool
    raise ValueError(f"Tool {tool_name} not found.")

    Find a tool by name.

    Args:
        tool_name: Name of the tool to find.

    Returns:
        Tool or StructuredTool.

    
llama-index-integrations/agent/llama-index-agent-llm-compiler/llama_index/agent/llm_compiler/utils.py