Skip to main content
Glama
shibuiwilliam

MCP Data Wrangler

data_quantile

Calculate quantile values for each column in a dataset using specified interpolation methods. Ideal for data analysis and preprocessing tasks in structured data workflows.

Instructions

Quantile values for each column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_data_file_pathYesPath to the input data file
interpolationNoInterpolation methodnearest
quantileYesQuantile between 0.0 and 1.0

Implementation Reference

  • The async handler function that parses input arguments using the schema, computes the quantile on the DataFrame with specified quantile and interpolation, formats results as JSON, and returns as TextContent.
    async def handle_data_quantile(
        arguments: dict[str, Any],
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        data_quantile_input = DataQuantileInputSchema.from_args(arguments)
        quantile_df = data_quantile_input.df.quantile(
            quantile=data_quantile_input.quantile,
            interpolation=data_quantile_input.interpolation,
        )
    
        # Convert the DataFrame to a dictionary format
        quantile_dict = {
            "description": f"Quantile values for each column at {arguments['quantile']}",
            "quantile_values": {
                col: str(val) if val is not None else None for col, val in zip(quantile_df.columns, quantile_df.row(0))
            },
        }
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(quantile_dict),
            )
        ]
  • Pydantic model extending Data for input validation. Provides input_schema() for MCP Tool schema, and static methods to construct from file path/args and load DataFrame.
    class DataQuantileInputSchema(Data):
        model_config = ConfigDict(
            validate_assignment=True,
            frozen=True,
            extra="forbid",
            arbitrary_types_allowed=True,
        )
    
        quantile: float = Field(default=0.5, description="Quantile value between 0.0 and 1.0", gt=0.0, lt=1.0)
        interpolation: str = Field(
            default="nearest",
            description="Interpolation method for quantile. One of: 'nearest', 'higher', 'lower', 'midpoint', 'linear'",
        )
    
        @staticmethod
        def input_schema() -> dict:
            return {
                "type": "object",
                "properties": {
                    "input_data_file_path": {
                        "type": "string",
                        "description": "Path to the input data file",
                    },
                    "quantile": {
                        "type": "number",
                        "description": "Quantile between 0.0 and 1.0",
                        "minimum": 0.0,
                        "maximum": 1.0,
                        "default": 0.5,
                    },
                    "interpolation": {
                        "type": "string",
                        "description": "Interpolation method",
                        "enum": ["nearest", "higher", "lower", "midpoint", "linear"],
                        "default": "nearest",
                    },
                },
                "required": ["input_data_file_path", "quantile"],
            }
    
        @staticmethod
        def from_schema(
            input_data_file_path: str, quantile: float, interpolation: str = "nearest"
        ) -> "DataQuantileInputSchema":
            data = Data.from_file(input_data_file_path)
            return DataQuantileInputSchema(
                df=data.df,
                quantile=quantile,
                interpolation=interpolation,
            )
    
        @staticmethod
        def from_args(arguments: dict[str, Any]) -> "DataQuantileInputSchema":
            input_data_file_path = arguments["input_data_file_path"]
            quantile = arguments["quantile"]
            interpolation = arguments.get("interpolation", "nearest")
            return DataQuantileInputSchema.from_schema(
                input_data_file_path=input_data_file_path,
                quantile=quantile,
                interpolation=interpolation,
            )
  • Registers the 'data_quantile' tool in the list returned by MCPServerDataWrangler.tools(), specifying name, description, and input schema.
    types.Tool(
        name=MCPServerDataWrangler.data_quantile.value[0],
        description=MCPServerDataWrangler.data_quantile.value[1],
        inputSchema=DataQuantileInputSchema.input_schema(),
    ),
  • Maps the tool name 'data_quantile' to its handler function in tool_to_handler() dictionary.
    MCPServerDataWrangler.data_quantile.value[0]: handle_data_quantile,
  • Defines the tool name and description constant in MCPServerDataWrangler enum.
    data_quantile = ("data_quantile", "Quantile 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 mentions 'quantile values for each column' but doesn't explain what the tool returns (e.g., a list, dictionary, or structured output), any performance considerations, or error handling. For a tool with no annotations and no output schema, this is a significant gap in transparency.

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 very concise with a single phrase 'Quantile values for each column', which is front-loaded and wastes no words. However, it's arguably too brief, bordering on under-specified, but within the bounds of efficient communication for a simple tool.

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 no annotations, no output schema, and a statistical tool with potential complexity, the description is incomplete. It doesn't clarify the return format, how results are structured, or any prerequisites (e.g., data format). For a tool with 3 parameters and siblings offering similar functions, more context is needed to guide effective use.

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 the input schema fully documents parameters like input_data_file_path, interpolation, and quantile. The description adds no additional meaning beyond the schema, such as explaining how quantiles are applied per column or the impact of interpolation choices. Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Quantile values for each column' states what the tool does but is vague about the specific action. It mentions 'quantile values' and 'each column' but doesn't specify the verb (e.g., 'calculate' or 'compute') or distinguish it from sibling tools like data_median or data_percentile (not listed but implied by context). It's better than a tautology but lacks precision.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like data_median (which is a specific quantile at 0.5) and data_mean, there's no indication of when quantile analysis is preferred over other statistical measures. No context or exclusions are mentioned, leaving usage unclear.

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