Skip to main content
Glama
santoshray02

CSV Editor

by santoshray02

select_columns

Extract specific columns from CSV data to focus on relevant information and simplify analysis.

Instructions

Select specific columns from the dataframe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
columnsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that performs column selection on the session's pandas DataFrame, including validation, operation recording, and response generation.
    async def select_columns(
        session_id: str, 
        columns: List[str], 
        ctx: Context = None
    ) -> Dict[str, Any]:
        """
        Select specific columns from the dataframe.
        
        Args:
            session_id: Session identifier
            columns: List of column names to keep
            ctx: FastMCP context
            
        Returns:
            Dict with success status and selected columns
        """
        try:
            manager = get_session_manager()
            session = manager.get_session(session_id)
            
            if not session or session.df is None:
                return {"success": False, "error": "Invalid session or no data loaded"}
            
            df = session.df
            
            # Validate columns exist
            missing_cols = [col for col in columns if col not in df.columns]
            if missing_cols:
                return {"success": False, "error": f"Columns not found: {missing_cols}"}
            
            session.df = df[columns].copy()
            session.record_operation(OperationType.SELECT, {
                "columns": columns,
                "columns_before": df.columns.tolist(),
                "columns_after": columns
            })
            
            return {
                "success": True,
                "selected_columns": columns,
                "columns_removed": [col for col in df.columns if col not in columns]
            }
            
        except Exception as e:
            logger.error(f"Error selecting columns: {str(e)}")
            return {"success": False, "error": str(e)}
  • Registers the 'select_columns' tool using the FastMCP @mcp.tool decorator, delegating execution to the imported handler function.
    @mcp.tool
    async def select_columns(
        session_id: str,
        columns: List[str],
        ctx: Context = None
    ) -> Dict[str, Any]:
        """Select specific columns from the dataframe."""
        return await _select_columns(session_id, columns, ctx)
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It doesn't disclose whether this operation is read-only or modifies the dataframe, if it requires specific permissions, what happens to unselected columns, or how the output is structured. For a data manipulation tool, this leaves critical behavior ambiguous.

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?

The description is a single, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse quickly.

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

Completeness3/5

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

Given the tool has an output schema (which should document return values) and no annotations, the description is minimally complete but lacks context for safe use. It covers the basic purpose but misses guidance, parameter meaning, and behavioral traits needed for a data operation tool, leaving gaps in overall understanding.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter details. It doesn't explain what 'session_id' refers to (e.g., an active dataframe session) or what 'columns' expects (e.g., column names as strings). This leaves both parameters semantically unclear beyond their basic types.

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

Purpose4/5

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

The description clearly states the action ('select') and resource ('specific columns from the dataframe'), making the tool's purpose understandable. However, it doesn't differentiate from sibling tools like 'remove_columns' or 'rename_columns' that also operate on dataframe columns, missing an opportunity for clearer distinction.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't mention whether this is for viewing subsets, preparing data for export, or how it differs from 'remove_columns' (which might delete columns) or 'get_column_statistics' (which analyzes them).

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/santoshray02/csv-editor'

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