Skip to main content
Glama
shibuiwilliam

MCP Data Wrangler

data_count

Calculate non-null element counts for each column in a dataset. Use the MCP Data Wrangler server tool to streamline data preprocessing and ensure accurate data analysis.

Instructions

Number of non-null elements for each column

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_data_file_pathNoPath to the input data file

Implementation Reference

  • The asynchronous handler function for the 'data_count' tool that loads the input data, computes the count of non-null values per column, formats it as a dictionary, and returns it as JSON text content.
    async def handle_data_count(
        arguments: dict[str, Any],
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        data_count_input = DataCountInputSchema.from_args(arguments)
        count_df = data_count_input.df.count()
    
        # Convert the DataFrame to a dictionary format
        count_dict = {
            "description": "Number of non-null elements for each column",
            "counts": {col: int(val) for col, val in zip(count_df.columns, count_df.row(0))},
        }
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(count_dict),
            )
        ]
  • Pydantic input schema class for the 'data_count' tool, including methods to define the JSON schema, load data from file path in arguments, and validate/parse input.
    class DataCountInputSchema(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) -> "DataCountInputSchema":
            data = Data.from_file(input_data_file_path)
            return DataCountInputSchema(df=data.df)
    
        @staticmethod
        def from_args(arguments: dict[str, Any]) -> "DataCountInputSchema":
            input_data_file_path = arguments["input_data_file_path"]
            return DataCountInputSchema.from_schema(input_data_file_path=input_data_file_path)
  • Tool object registration for 'data_count' in MCPServerDataWrangler.tools() method, defining the tool's name, description, and input schema for MCP server listing.
    types.Tool(
        name=MCPServerDataWrangler.data_count.value[0],
        description=MCPServerDataWrangler.data_count.value[1],
        inputSchema=DataCountInputSchema.input_schema(),
    ),
  • Dispatch mapping in MCPServerDataWrangler.tool_to_handler() dictionary that associates the 'data_count' tool name with its handler function.
    MCPServerDataWrangler.data_count.value[0]: handle_data_count,
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 what the tool does but doesn't describe how it behaves: e.g., whether it handles large files efficiently, requires specific file formats, returns results in a particular structure, or has any side effects. For a tool with no annotations, this leaves critical operational details unspecified.

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

Conciseness5/5

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

The description is extremely concise—a single, clear sentence that states the core functionality without unnecessary words. It's front-loaded with the essential purpose, making it easy to parse. Every word earns its place, with no redundancy or fluff.

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 (a data analysis tool with many siblings), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., a dictionary, list, or formatted string), how errors are handled, or prerequisites for use. This leaves significant gaps for an agent to understand the tool fully in context.

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 input schema has 100% description coverage, with the single parameter 'input_data_file_path' clearly documented. The description adds no additional parameter semantics beyond what the schema provides (e.g., it doesn't specify accepted file types or path formats). With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose4/5

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

The description clearly states the tool's purpose: counting non-null elements per column. It uses specific verbs ('Number of') and identifies the resource ('non-null elements for each column'). However, it doesn't explicitly differentiate from siblings like data_shape (which might give dimensions) or describe_data (which might provide summary statistics), leaving room for ambiguity in a crowded namespace.

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 many sibling tools for data analysis (e.g., data_mean, data_median, data_schema), there's no indication of whether this is for data quality checks, preprocessing, or other contexts. It lacks explicit when/when-not instructions or named alternatives.

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