from __future__ import annotations
from typing import Dict
import polars as pl
from tools.base import BaseTool


class BrowseTool(BaseTool):
    def execute(self, inputs: Dict[str, pl.DataFrame]) -> Dict[str, pl.DataFrame]:
        df = inputs.get("Input", pl.DataFrame())
        if self.ctx.verbose:
            print(f"\n[Browse ToolID={self.node.tool_id}]")
            print(f"  rows={len(df)}  cols={df.columns}")
            print(df.head(20))
        return {"Output": df}
