Skip to main content
Glama
shibuiwilliam

MCP Data Wrangler

data_var

Calculate variance values for each column in a dataset using MCP Data Wrangler. Specify the input file path and adjust Delta Degrees of Freedom for precise statistical analysis.

Instructions

Variance values for each column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ddofNoDelta Degrees of Freedom: the divisor used in the calculation is N - ddof
input_data_file_pathYesPath to the input data file

Implementation Reference

  • The async handler function for the 'data_var' tool. It parses input arguments into DataVarInputSchema, computes variance for each column of the dataframe using pandas .var(ddof=...), formats results as a dictionary, and returns it as JSON text content.
    async def handle_data_var(
        arguments: dict[str, Any],
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        data_var_input = DataVarInputSchema.from_args(arguments)
        var_df = data_var_input.df.var(ddof=data_var_input.ddof)
    
        # Convert the DataFrame to a dictionary format
        var_dict = {
            "description": f"Variance values for each column with ddof={data_var_input.ddof}",
            "var_values": {col: str(val) if val is not None else None for col, val in zip(var_df.columns, var_df.row(0))},
        }
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(var_dict),
            )
        ]
  • Pydantic schema class DataVarInputSchema extending Data, including input_schema() for MCP tool schema, and factory methods from_schema() and from_args() to load dataframe from file and validate inputs.
    class DataVarInputSchema(Data):
        model_config = ConfigDict(
            validate_assignment=True,
            frozen=True,
            extra="forbid",
            arbitrary_types_allowed=True,
        )
    
        ddof: int = Field(
            default=1, description="Delta Degrees of Freedom: the divisor used in the calculation is N - ddof", ge=0
        )
    
        @staticmethod
        def input_schema() -> dict:
            return {
                "type": "object",
                "properties": {
                    "input_data_file_path": {
                        "type": "string",
                        "description": "Path to the input data file",
                    },
                    "ddof": {
                        "type": "integer",
                        "description": "Delta Degrees of Freedom: the divisor used in the calculation is N - ddof",
                        "minimum": 0,
                        "default": 1,
                    },
                },
                "required": ["input_data_file_path"],
            }
    
        @staticmethod
        def from_schema(input_data_file_path: str, ddof: int = 1) -> "DataVarInputSchema":
            data = Data.from_file(input_data_file_path)
            return DataVarInputSchema(
                df=data.df,
                ddof=ddof,
            )
    
        @staticmethod
        def from_args(arguments: dict[str, Any]) -> "DataVarInputSchema":
            input_data_file_path = arguments["input_data_file_path"]
            ddof = arguments.get("ddof", 1)
            return DataVarInputSchema.from_schema(
                input_data_file_path=input_data_file_path,
                ddof=ddof,
            )
  • MCP Tool object registration for 'data_var', using enum value for name and description, and DataVarInputSchema.input_schema() for input validation.
    types.Tool(
        name=MCPServerDataWrangler.data_var.value[0],
        description=MCPServerDataWrangler.data_var.value[1],
        inputSchema=DataVarInputSchema.input_schema(),
    ),
  • Handler function mapping for 'data_var' tool to handle_data_var in the tool_to_handler() dictionary.
    MCPServerDataWrangler.data_var.value[0]: handle_data_var,
Behavior1/5

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

No annotations are provided, so the description carries full burden but offers no behavioral information. It doesn't indicate whether this is a read-only operation, what permissions are needed, how results are returned, or any side effects. For a statistical calculation tool with file input, this lack of transparency is critical.

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

Conciseness4/5

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

The description is extremely concise (4 words) and front-loaded, with no wasted words. However, it's arguably under-specified rather than optimally concise, as it lacks essential context for tool selection and usage.

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 complexity of statistical operations, file input, and no annotations or output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., format of variance values), error conditions, or how it interacts with the data file, leaving significant gaps for agent understanding.

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 description coverage is 100%, so parameters are fully documented in the schema. The description adds no additional meaning about 'input_data_file_path' or 'ddof' beyond what the schema provides, meeting the baseline for high schema coverage.

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

Purpose2/5

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

The description 'Variance values for each column' is a tautology that essentially restates the tool name 'data_var' without specifying the action verb or distinguishing it from sibling tools. It doesn't clarify whether this calculates, retrieves, or displays variance, nor how it differs from similar statistical tools like 'data_std' (standard deviation).

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

Usage Guidelines1/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. With multiple sibling statistical tools (mean, median, std, etc.), the description offers no context about appropriate use cases, prerequisites, or comparisons to help an agent choose between 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

Related 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/shibuiwilliam/mcp-server-data-wrangler'

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