Skip to main content
Glama
privetin

Dataset Viewer MCP Server

by privetin

get_statistics

Retrieve statistical insights from Hugging Face datasets to analyze data distribution, identify patterns, and assess dataset quality for machine learning projects.

Instructions

Get statistics about a Hugging Face dataset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetYesHugging Face dataset identifier in the format owner/dataset
configYesDataset configuration/subset name. Use get_info to list available configs
splitYesDataset split name. Splits partition the data for training/evaluation
auth_tokenNoHugging Face auth token for private/gated datasets

Implementation Reference

  • MCP tool handler in @server.call_tool() that extracts arguments (dataset, config, split), instantiates DatasetViewerAPI with auth_token, calls its get_statistics method, formats the result as JSON text content, and returns it.
    elif name == "get_statistics":
        dataset = arguments["dataset"]
        config = arguments["config"]
        split = arguments["split"]
        stats = await DatasetViewerAPI(auth_token=auth_token).get_statistics(dataset, config=config, split=split)
        return [
            types.TextContent(
                type="text",
                text=json.dumps(stats, indent=2)
            )
        ]
  • Core implementation in DatasetViewerAPI class that constructs parameters and makes asynchronous HTTP GET request to the Hugging Face dataset viewer /statistics endpoint, returning the JSON response.
    async def get_statistics(self, dataset: str, config: str, split: str) -> dict:
        """Get statistics about a dataset"""
        params = {
            "dataset": dataset,
            "config": config,
            "split": split
        }
        response = await self.client.get("/statistics", params=params)
        response.raise_for_status()
        return response.json()
  • Input schema definition for the get_statistics tool, specifying required parameters (dataset, config, split) with types, descriptions, patterns, examples, and optional auth_token.
    inputSchema={
        "type": "object",
        "properties": {
            "dataset": {
                "type": "string",
                "description": "Hugging Face dataset identifier in the format owner/dataset",
                "pattern": "^[^/]+/[^/]+$",
                "examples": ["ylecun/mnist", "stanfordnlp/imdb"]
            },
            "config": {
                "type": "string",
                "description": "Dataset configuration/subset name. Use get_info to list available configs",
                "examples": ["default", "en", "es"]
            },
            "split": {
                "type": "string",
                "description": "Dataset split name. Splits partition the data for training/evaluation",
                "examples": ["train", "validation", "test"]
            },
            "auth_token": {
                "type": "string",
                "description": "Hugging Face auth token for private/gated datasets",
                "optional": True
            }
        },
        "required": ["dataset", "config", "split"],
    }
  • Registration of the get_statistics tool in the @server.list_tools() handler, including name, description, and full input schema.
    types.Tool(
        name="get_statistics",
        description="Get statistics about a Hugging Face dataset",
        inputSchema={
            "type": "object",
            "properties": {
                "dataset": {
                    "type": "string",
                    "description": "Hugging Face dataset identifier in the format owner/dataset",
                    "pattern": "^[^/]+/[^/]+$",
                    "examples": ["ylecun/mnist", "stanfordnlp/imdb"]
                },
                "config": {
                    "type": "string",
                    "description": "Dataset configuration/subset name. Use get_info to list available configs",
                    "examples": ["default", "en", "es"]
                },
                "split": {
                    "type": "string",
                    "description": "Dataset split name. Splits partition the data for training/evaluation",
                    "examples": ["train", "validation", "test"]
                },
                "auth_token": {
                    "type": "string",
                    "description": "Hugging Face auth token for private/gated datasets",
                    "optional": True
                }
            },
            "required": ["dataset", "config", "split"],
        }
    ),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't mention what types of statistics are returned, whether this is a read-only operation, potential rate limits, authentication requirements beyond the optional token parameter, or how it handles large datasets. The description merely restates the tool's basic function without behavioral context.

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 at just 6 words, front-loading the essential information with zero wasted language. Every word contributes directly to understanding the tool's function, making it efficient despite its brevity.

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?

For a tool with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what statistics are returned, how they're formatted, whether this is a computationally intensive operation, or how it differs from other dataset retrieval tools. The minimal description leaves too many contextual gaps for effective agent 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?

The description adds no parameter-specific information beyond what's already in the schema, which has 100% description coverage. All four parameters (dataset, config, split, auth_token) are fully documented in the schema with descriptions, examples, and requirements. The description doesn't provide additional context about how these parameters interact or affect the statistical output.

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 action ('Get statistics') and target resource ('about a Hugging Face dataset'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings like 'get_info' or 'get_rows', which also retrieve dataset information but serve different purposes.

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. While the input schema mentions using 'get_info to list available configs', this is parameter-specific advice, not overall usage guidance. There's no indication of when statistical analysis is preferred over raw data retrieval from sibling tools.

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

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/privetin/dataset-viewer'

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