Skip to main content
Glama
santoshray02

CSV Editor

by santoshray02

remove_columns

Remove specified columns from CSV dataframes to clean datasets, reduce file size, and focus on relevant information.

Instructions

Remove columns from the dataframe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
columnsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler implementation that validates columns, drops them from the pandas DataFrame using df.drop(), records the operation, and returns success info with remaining columns.
    async def remove_columns(
        session_id: str, 
        columns: List[str], 
        ctx: Context = None
    ) -> Dict[str, Any]:
        """
        Remove columns from the dataframe.
        
        Args:
            session_id: Session identifier
            columns: List of column names to remove
            ctx: FastMCP context
            
        Returns:
            Dict with success status and removed 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.drop(columns=columns)
            session.record_operation(OperationType.REMOVE_COLUMN, {
                "columns": columns
            })
            
            return {
                "success": True,
                "removed_columns": columns,
                "remaining_columns": session.df.columns.tolist()
            }
            
        except Exception as e:
            logger.error(f"Error removing columns: {str(e)}")
            return {"success": False, "error": str(e)}
  • MCP tool registration via @mcp.tool decorator. Thin wrapper that forwards to the core implementation in transformations.py.
    @mcp.tool
    async def remove_columns(
        session_id: str,
        columns: List[str],
        ctx: Context = None
    ) -> Dict[str, Any]:
        """Remove columns from the dataframe."""
        return await _remove_columns(session_id, columns, ctx)
  • Entry-point handler registered with FastMCP, defining input schema via type hints and docstring, delegates to internal _remove_columns.
    @mcp.tool
    async def remove_columns(
        session_id: str,
        columns: List[str],
        ctx: Context = None
    ) -> Dict[str, Any]:
        """Remove columns from the dataframe."""
        return await _remove_columns(session_id, columns, ctx)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('remove') but doesn't disclose behavioral traits like whether this is destructive (likely yes, as removal implies mutation), if it requires specific permissions, what happens to data in removed columns, or error handling for non-existent columns. This is a significant gap for a mutation tool.

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, efficient sentence with zero waste, making it easy to parse. It's appropriately sized and front-loaded, though this conciseness comes at the cost of missing details.

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

Completeness2/5

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

Given the tool's complexity (a mutation operation with 2 parameters), lack of annotations, and 0% schema coverage, the description is incomplete. It doesn't cover parameter meanings, behavioral implications, or usage context. The presence of an output schema helps, but the description should do more to compensate for other gaps.

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 it adds no parameter semantics. It doesn't explain what 'session_id' refers to (e.g., an active data session) or the format/constraints for 'columns' (e.g., column names as strings). With two undocumented parameters, this is inadequate.

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 ('remove') and resource ('columns from the dataframe'), making the purpose immediately understandable. However, it doesn't differentiate from siblings like 'select_columns' or 'rename_columns' which also manipulate columns, missing explicit 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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention when to choose 'remove_columns' over 'select_columns' (which might keep only specified columns) or 'rename_columns', leaving usage context implied at best.

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