Skip to main content
Glama

search_kaggle_datasets

Find datasets on Kaggle by entering a search query. This tool uses the Kaggle API to match and retrieve relevant datasets for analysis or machine learning projects.

Instructions

Searches for datasets on Kaggle matching the query using the Kaggle API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • The main handler function for the 'search_kaggle_datasets' tool, decorated with @mcp.tool() for registration. It uses the Kaggle API to search datasets by query, formats top 10 results as JSON, handles errors, and relies on the globally initialized 'api'.
    @mcp.tool()
    async def search_kaggle_datasets(query: str) -> str:
        """Searches for datasets on Kaggle matching the query using the Kaggle API."""
        if not api:
            # Return an informative error if API is not available
            return json.dumps({"error": "Kaggle API not authenticated or available."})
    
        print(f"Searching datasets for: {query}")
        try:
            search_results = api.dataset_list(search=query)
            if not search_results:
                return "No datasets found matching the query."
    
            # Format results as JSON string for the tool output
            results_list = [
                {
                    "ref": getattr(ds, 'ref', 'N/A'),
                    "title": getattr(ds, 'title', 'N/A'),
                    "subtitle": getattr(ds, 'subtitle', 'N/A'),
                    "download_count": getattr(ds, 'downloadCount', 0), # Adjusted attribute name
                    "last_updated": str(getattr(ds, 'lastUpdated', 'N/A')), # Adjusted attribute name
                    "usability_rating": getattr(ds, 'usabilityRating', 'N/A') # Adjusted attribute name
                }
                for ds in search_results[:10]  # Limit to 10 results
            ]
            return json.dumps(results_list, indent=2)
        except Exception as e:
            # Log the error potentially
            print(f"Error searching datasets for '{query}': {e}")
            # Return error information as part of the tool output
            return json.dumps({"error": f"Error processing search: {str(e)}"})
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. It mentions using the Kaggle API but doesn't disclose behavioral traits such as authentication requirements, rate limits, pagination, or what the search returns (e.g., format, fields). This leaves significant gaps for an agent to understand how to use it effectively.

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 with zero waste. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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. It doesn't cover key aspects like authentication, rate limits, return format, or error handling. For a search tool with no structured support, more context is needed to guide an agent 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?

Schema description coverage is 0%, so the description must compensate. It implies the 'query' parameter is used for searching datasets, but doesn't add meaning beyond what the schema's title ('Query') and type suggest. No details on query syntax, examples, or constraints are provided, resulting in minimal added value.

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 ('Searches for datasets') and target resource ('on Kaggle'), specifying it uses the Kaggle API. It distinguishes from the sibling tool 'download_kaggle_dataset' by focusing on search rather than download, though it doesn't explicitly mention this distinction.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention the sibling tool 'download_kaggle_dataset' or any other search methods, nor does it specify prerequisites like authentication or rate limits.

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/arrismo/kaggle-mcp'

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