Skip to main content
Glama

search-spaces

Find Spaces on Hugging Face Hub using keywords, authors, tags, or SDK. Filter and retrieve results efficiently for machine learning projects.

Instructions

Search for Spaces on Hugging Face Hub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authorNoFilter by author/organization
limitNoMaximum number of results to return
queryNoSearch term
sdkNoFilter by SDK (e.g., 'streamlit', 'gradio', 'docker')
tagsNoFilter by tags

Implementation Reference

  • The main handler logic for the 'search-spaces' tool within the @server.call_tool() function. It constructs query parameters from inputs, calls the Hugging Face API endpoint '/spaces', formats the results into a list of space info dictionaries, and returns them as JSON.
    elif name == "search-spaces": query = arguments.get("query") author = arguments.get("author") tags = arguments.get("tags") sdk = arguments.get("sdk") limit = arguments.get("limit", 10) params = {"limit": limit} if query: params["search"] = query if author: params["author"] = author if tags: params["filter"] = tags if sdk: params["filter"] = params.get("filter", "") + f" sdk:{sdk}" data = await make_hf_request("spaces", params) if "error" in data: return [ types.TextContent( type="text", text=f"Error searching spaces: {data['error']}" ) ] # Format the results results = [] for space in data: space_info = { "id": space.get("id", ""), "name": space.get("spaceId", ""), "author": space.get("author", ""), "sdk": space.get("sdk", ""), "tags": space.get("tags", []), "likes": space.get("likes", 0), "lastModified": space.get("lastModified", ""), } results.append(space_info) return [types.TextContent(type="text", text=json.dumps(results, indent=2))]
  • The tool registration in @server.list_tools(), defining the name, description, and input schema (JSON Schema) for the 'search-spaces' tool.
    types.Tool( name="search-spaces", description="Search for Spaces 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"}, "sdk": { "type": "string", "description": "Filter by SDK (e.g., 'streamlit', 'gradio', 'docker')", }, "limit": { "type": "integer", "description": "Maximum number of results to return", }, }, }, ),

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

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