Skip to main content
Glama
shibuiwilliam

MCP Data Wrangler

data_median

Calculate median values for each column in a dataset. Use this tool to analyze and summarize numerical data efficiently. Input the file path to start processing.

Instructions

Median values for each column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_data_file_pathNoPath to the input data file

Implementation Reference

  • The main handler function for the 'data_median' tool. It parses arguments to load a DataFrame, computes the median for each column using pandas DataFrame.median(), formats the result as a JSON-serializable dictionary, and returns it as MCP TextContent.
    async def handle_data_median(
        arguments: dict[str, Any],
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        data_median_input = DataMedianInputSchema.from_args(arguments)
        median_df = data_median_input.df.median()
    
        # Convert the DataFrame to a dictionary format
        median_dict = {
            "description": "Median values for each column",
            "median_values": {
                col: str(val) if val is not None else None for col, val in zip(median_df.columns, median_df.row(0))
            },
        }
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(median_dict),
            )
        ]
  • Pydantic model defining the input schema for 'data_median' tool. Includes static input_schema() method that returns the JSON schema object for MCP tool registration, and factory methods to create instances from file path or arguments.
    class DataMedianInputSchema(Data):
        model_config = ConfigDict(
            validate_assignment=True,
            frozen=True,
            extra="forbid",
            arbitrary_types_allowed=True,
        )
    
        @staticmethod
        def input_schema() -> dict:
            return {
                "type": "object",
                "properties": {
                    "input_data_file_path": {
                        "type": "string",
                        "description": "Path to the input data file",
                    },
                },
            }
    
        @staticmethod
        def from_schema(input_data_file_path: str) -> "DataMedianInputSchema":
            data = Data.from_file(input_data_file_path)
            return DataMedianInputSchema(df=data.df)
    
        @staticmethod
        def from_args(arguments: dict[str, Any]) -> "DataMedianInputSchema":
            input_data_file_path = arguments["input_data_file_path"]
            return DataMedianInputSchema.from_schema(input_data_file_path=input_data_file_path)
  • Tool registration in MCPServerDataWrangler.tools() static method, creating the MCP Tool object with name 'data_median', description, and inputSchema from DataMedianInputSchema.input_schema().
    types.Tool(
        name=MCPServerDataWrangler.data_median.value[0],
        description=MCPServerDataWrangler.data_median.value[1],
        inputSchema=DataMedianInputSchema.input_schema(),
    ),
  • Handler registration in MCPServerDataWrangler.tool_to_handler() dict, mapping tool name to handle_data_median function.
    MCPServerDataWrangler.data_median.value[0]: handle_data_median,
  • Enum definition in MCPServerDataWrangler providing the canonical name and description for the 'data_median' tool.
    data_median = ("data_median", "Median values for each column")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool calculates medians but doesn't describe how it handles missing values, data types, errors, or the return format. For a statistical tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 a single, efficient phrase that gets straight to the point without unnecessary words. It's appropriately sized for a simple tool, though it could be more informative. There's no structural issue, but it's borderline under-specified rather than concise.

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 a statistical calculation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a list of medians, a summary object) or handle edge cases. For a tool that likely processes data files, more context is needed to be fully useful.

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?

The schema description coverage is 100%, with the single parameter 'input_data_file_path' documented in the schema as 'Path to the input data file'. The description doesn't add any meaning beyond this, such as file format requirements or path examples. With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose3/5

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

The description 'Median values for each column' states what the tool does (calculates medians) but is vague about the resource (data from a file path). It doesn't distinguish from siblings like data_mean or data_quantile, which also compute statistical measures on data columns. The purpose is understandable but lacks specificity.

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. It doesn't mention siblings like data_mean (for averages) or data_quantile (for other percentiles), nor does it specify prerequisites or contexts for choosing median over other statistical tools. The description offers no usage instructions.

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