Skip to main content
Glama
shreyaskarnik

Hugging Face MCP Server

search-datasets

Find and filter datasets on Hugging Face Hub using search terms, authors, or tags to access machine learning data resources.

Instructions

Search for datasets on Hugging Face Hub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch term
authorNoFilter by author/organization
tagsNoFilter by tags
limitNoMaximum number of results to return

Implementation Reference

  • Registration of the 'search-datasets' tool in the list_tools handler, defining its name, description, and input schema.
    types.Tool(
        name="search-datasets",
        description="Search for datasets on Hugging Face Hub",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {"type": "string", "description": "Search term"},
                "author": {
                    "type": "string",
                    "description": "Filter by author/organization",
                },
                "tags": {"type": "string", "description": "Filter by tags"},
                "limit": {
                    "type": "integer",
                    "description": "Maximum number of results to return",
                },
            },
        },
    ),
  • Handler implementation for 'search-datasets' tool within the call_tool function. Extracts parameters, calls Hugging Face API endpoint '/datasets', handles errors, formats dataset results into JSON, and returns as text content.
    elif name == "search-datasets":
        query = arguments.get("query")
        author = arguments.get("author")
        tags = arguments.get("tags")
        limit = arguments.get("limit", 10)
    
        params = {"limit": limit}
        if query:
            params["search"] = query
        if author:
            params["author"] = author
        if tags:
            params["filter"] = tags
    
        data = await make_hf_request("datasets", params)
    
        if "error" in data:
            return [
                types.TextContent(
                    type="text", text=f"Error searching datasets: {data['error']}"
                )
            ]
    
        # Format the results
        results = []
        for dataset in data:
            dataset_info = {
                "id": dataset.get("id", ""),
                "name": dataset.get("datasetId", ""),
                "author": dataset.get("author", ""),
                "tags": dataset.get("tags", []),
                "downloads": dataset.get("downloads", 0),
                "likes": dataset.get("likes", 0),
                "lastModified": dataset.get("lastModified", ""),
            }
            results.append(dataset_info)
    
        return [types.TextContent(type="text", text=json.dumps(results, indent=2))]
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 only states the basic action. It doesn't mention whether this is a read-only operation, how results are returned (format, pagination), rate limits, authentication requirements, or error conditions. The description is minimal and lacks essential 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—a single sentence with no wasted words. It's front-loaded with the core purpose and efficiently communicates the essential action and target resource.

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 search tool with 4 parameters and no annotations or output schema, the description is insufficient. It doesn't explain what constitutes a dataset on Hugging Face Hub, how results are structured, or typical use cases. The agent lacks context about what to expect from this operation beyond the basic action.

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 information beyond what's already in the schema (which has 100% coverage). It doesn't explain how parameters interact, provide examples, or clarify semantics like tag format or author filtering behavior. With complete schema coverage, the baseline is 3, but the description doesn't enhance understanding.

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 ('Search for') and resource ('datasets on Hugging Face Hub'), making the tool's purpose immediately understandable. However, it doesn't differentiate this tool from its sibling search tools (search-collections, search-models, search-spaces) beyond specifying the dataset resource type.

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-dataset-info or other search tools. It doesn't mention prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name alone.

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/shreyaskarnik/huggingface-mcp-server'

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