Skip to main content
Glama
privetin

Dataset Viewer MCP Server

by privetin

get_first_rows

Retrieve initial rows from a Hugging Face dataset split to preview data structure and content for analysis or validation.

Instructions

Get first rows from a Hugging Face dataset split

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 execution logic for 'get_first_rows': extracts arguments, instantiates DatasetViewerAPI, calls get_first_rows method, and returns JSON-formatted result as TextContent.
    elif name == "get_first_rows":
        dataset = arguments["dataset"]
        config = arguments["config"]
        split = arguments["split"]
        first_rows = await DatasetViewerAPI(auth_token=auth_token).get_first_rows(dataset, config=config, split=split)
        return [
            types.TextContent(
                type="text",
                text=json.dumps(first_rows, indent=2)
            )
        ]
  • Tool registration in @server.list_tools(), defining name, description, and input schema for 'get_first_rows'.
    types.Tool(
        name="get_first_rows",
        description="Get first rows from a Hugging Face dataset split",
        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"],
        }
    ),
  • Core helper function in DatasetViewerAPI class that makes HTTP GET request to '/first-rows' endpoint of Hugging Face datasets-server to retrieve first rows of specified dataset/config/split.
    async def get_first_rows(self, dataset: str, config: str, split: str) -> dict:
        """Get first few rows of a dataset split"""
        params = {
            "dataset": dataset,
            "config": config,
            "split": split
        }
        response = await self.client.get("/first-rows", params=params)
        response.raise_for_status()
        return response.json()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action. It doesn't mention what 'first rows' means (e.g., how many rows, ordering), whether this is a read-only operation, potential rate limits, or authentication needs beyond the optional auth_token parameter. This leaves significant gaps for an agent to understand the tool's behavior.

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 a single, efficient sentence that front-loads the core purpose with zero wasted words. It directly communicates the tool's function without unnecessary elaboration, making it easy for an agent to parse quickly.

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 lack of annotations and output schema, the description is incomplete for a tool with 4 parameters. It doesn't explain the return format (e.g., number of rows, data structure), error conditions, or how it interacts with siblings. For a dataset retrieval tool, this leaves critical context gaps for an agent to use it effectively.

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%, so the schema fully documents all parameters (dataset, config, split, auth_token). The description adds no additional parameter semantics beyond what's in the schema, such as clarifying what 'first rows' entails in relation to these parameters. This meets the baseline for high schema coverage.

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 first rows') and resource ('from a Hugging Face dataset split'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'get_rows' by specifying 'first rows' rather than arbitrary rows, though it doesn't explicitly contrast with other siblings like 'get_parquet' or 'get_statistics'.

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 like 'get_rows' for arbitrary rows, 'get_parquet' for file downloads, or 'get_statistics' for summaries. It mentions 'split' but doesn't explain why one might choose this tool over others for dataset exploration or initial inspection.

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