Skip to main content
Glama
santoshray02

CSV Editor

by santoshray02

select_columns

Select only the columns you need from your CSV data, simplifying analysis by removing irrelevant fields.

Instructions

Select specific columns from the dataframe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
columnsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler for the select_columns tool. Gets the session, validates columns exist in the dataframe, selects only the specified columns using df[columns].copy(), records the operation, and returns success/error.
    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: {e!s}")
            return {"success": False, "error": str(e)}
  • The MCP tool registration/decorator for select_columns. Uses @mcp.tool decorator to register the function, defines the FastMCP API with session_id and columns parameters, and delegates to the actual implementation via _select_columns.
    @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)
  • The tool is listed under capabilities in the server info, documenting select_columns as a data_manipulation capability.
    "data_manipulation": [
        "filter_rows",
        "sort_data",
        "select_columns",
        "rename_columns",
        "add_column",
        "remove_columns",
        "change_column_type",
        "fill_missing_values",
        "remove_duplicates",
    ],
    "data_analysis": [
Behavior2/5

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

No annotations provided, so description carries full burden. It only says 'select' but does not disclose whether selection modifies the dataframe or returns a view, whether it supports complex column selections, or any side effects.

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

Conciseness3/5

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

Very concise, single sentence. No fluff, but lacks necessary detail, making it under-specified rather than efficiently informative.

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?

While output schema exists (covering return values), the description omits crucial behavioral and context info (e.g., mutability, scope, error conditions), making it incomplete for safe invocation.

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

Parameters1/5

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

Input schema has 0% description coverage, and the description adds no meaning to parameters like session_id or columns (e.g., format, allowed values).

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?

Description clearly states verb 'select' with resource 'specific columns from the dataframe', distinguishing it from sibling tools like remove_columns or rename_columns.

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 on when to use this tool versus alternatives, no prerequisites mentioned (e.g., session must be active), and no context on typical use cases.

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