Skip to main content
Glama
reading-plus-ai

mcp-server-data-exploration

load_csv

Load local CSV files into DataFrames for data exploration and analysis. Specify file paths and optionally name datasets for organized processing.

Instructions

Load CSV File Tool

Purpose: Load a local CSV file into a DataFrame.

Usage Notes: • If a df_name is not provided, the tool will automatically assign names sequentially as df_1, df_2, and so on.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csv_pathYes
df_nameNo

Implementation Reference

  • Core handler implementation in ScriptRunner class that loads the CSV file using pandas.read_csv, assigns a dataframe name if not provided, stores it in memory, and returns a success message or raises an error.
    def load_csv(self, csv_path: str, df_name:str = None):
        self.df_count += 1
        if not df_name:
            df_name = f"df_{self.df_count}"
        try:
            self.data[df_name] = pd.read_csv(csv_path)
            self.notes.append(f"Successfully loaded CSV into dataframe '{df_name}'")
            return [
                TextContent(type="text", text=f"Successfully loaded CSV into dataframe '{df_name}'")
            ]
        except Exception as e:
            raise McpError(
                INTERNAL_ERROR, f"Error loading CSV: {str(e)}"
            ) from e
  • Pydantic BaseModel defining the input schema for the load_csv tool, with required csv_path (str) and optional df_name (str). Used for validation and tool registration.
    class LoadCsv(BaseModel):
        csv_path: str
        df_name: Optional[str] = None
  • Tool registration in the @server.list_tools() handler, specifying the name 'load_csv', description, and input schema from LoadCsv model.
    Tool(
        name = DataExplorationTools.LOAD_CSV,
        description = LOAD_CSV_TOOL_DESCRIPTION,
        inputSchema = LoadCsv.model_json_schema(),
    ),
  • Dispatch logic in the @server.call_tool() handler that extracts arguments and delegates to ScriptRunner.load_csv for execution.
    if name == DataExplorationTools.LOAD_CSV:
        csv_path = arguments.get("csv_path")
        df_name = arguments.get("df_name")
        return script_runner.load_csv(csv_path, df_name)
  • Enum defining the tool names, including LOAD_CSV = "load_csv", used throughout for registration and dispatching.
    class DataExplorationTools(str, Enum):
        LOAD_CSV = "load_csv"
        RUN_SCRIPT = "run_script"
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/reading-plus-ai/mcp-server-data-exploration'

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