Skip to main content
Glama

preview_csv

Preview the first few rows of a CSV file to understand its structure, column names, and data types before performing batch tagging.

Instructions

Preview the first few rows of a CSV file to understand its structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csv_pathYesPath to the CSV file
rowsNoNumber of rows to preview (default: 5)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'preview_csv' tool. Decorated with @mcp.tool(), it reads a CSV file using polars, returns column names, row count, and a preview of the first N rows.
    @mcp.tool()
    def preview_csv(csv_path: str, rows: int = 5) -> dict:
        """
        Preview the first few rows of a CSV file to understand its structure.
    
        Args:
            csv_path: Path to the CSV file
            rows: Number of rows to preview (default: 5)
    
        Returns:
            Dictionary with column names and preview data
        """
        try:
            df = pl.read_csv(csv_path)
            return {
                "status": "success",
                "columns": df.columns,
                "rows": len(df),
                "preview": df.head(rows).to_dicts()
            }
        except Exception as e:
            return {
                "status": "error",
                "message": str(e)
            }
  • tagging.py:162-163 (registration)
    The tool is registered via the @mcp.tool() decorator on line 162, using FastMCP's decorator pattern to register 'preview_csv' as an MCP tool.
    @mcp.tool()
    def preview_csv(csv_path: str, rows: int = 5) -> dict:
  • Helper constant PROVIDER_MAP used across other tools (but not directly used by preview_csv). Included for complete context.
    PROVIDER_MAP = {
        "claude": Provider.ANTHROPIC,
        "anthropic": Provider.ANTHROPIC,
        "openai": Provider.OPENAI,
        "gemini": Provider.GEMINI,
        "groq": Provider.GROQ,
        "bedrock": Provider.BEDROCK
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It indicates a read-only preview but does not explicitly state that no modifications occur, missing an opportunity to emphasize safety.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence of 15 words that front-loads the action. Every word serves a purpose, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the existence of an output schema, the description suffices. It does not mention the default row count or limitations, but these are minor omissions for a simple preview tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description does not need to add much. It does not elaborate on parameter semantics beyond what the schema provides, maintaining the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Preview the first few rows') and the resource ('a CSV file'), with the purpose ('to understand its structure'). It effectively distinguishes from sibling tools which focus on tagging.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies using this tool for initial exploration of CSV structure before tagging, but does not explicitly state when not to use or suggest alternatives. Siblings are different enough that implicit guidance is adequate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddrummond95/tagging_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server