summarize_csv_file
Quickly summarize a CSV file by calculating and reporting its row and column count. Input the filename to retrieve the file's dimensions efficiently using the MCP Mix Server.
Instructions
Summarise a CVS file by reporting its number of rows and columns.
Args: filename (str): Name of the CSV file in the /data directory.
Returns: str: A string describing the file's dimensions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes |
Implementation Reference
- mcp_server/tools/csv_tools.py:4-16 (handler)The main handler function for the 'summarize_csv_file' tool, decorated with @mcp.tool() for registration. It delegates to read_csv_summary.@mcp.tool() def summarize_csv_file(filename: str) -> str: """ Summarise a CVS file by reporting its number of rows and columns. Args: filename (str): Name of the CSV file in the /data directory. Returns: str: A string describing the file's dimensions. """ return read_csv_summary(filename)
- mcp_server/utils/file_reader.py:6-22 (helper)Helper function that reads the CSV file using pandas and returns a summary of rows and columns.def read_csv_summary(filename: str) -> str: """ Read a CSV file and return a simple summary. Args: filename (str): Name of the CSV file Returns: str: A string describing the file's concents. """ file_path = DATA_DIR / filename if not file_path.exists(): return f"File {filename} does not exist." df = pd.read_csv(file_path) return f"CSV file '{filename}' has {len(df)} rows and {len(df.columns)} columns."