Skip to main content
Glama

search_public_apis

Find free public APIs by searching names and descriptions with semantic matching to discover relevant services for your development needs.

Instructions

Search for free public APIs that match the input query string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Implementation Reference

  • Core handler function implementing the embedding-based search for public APIs matching the query.
    def search_public_apis(query: str, limit: int = 5) -> list[SearchResult]: """Search for free public APIs that match the input query string.""" idx = ensure_index() qvec, _ = embed_query(query, model_id=idx.model_id) top = idx.search(qvec, top_k=max(1, min(50, int(limit)))) # limit to 50 items, by_id = load_catalog_indexed() results: list[SearchResult] = [] for api_id, score in top: item = by_id.get(api_id) if not item: continue results.append( SearchResult( id=item.id, name=item.api, score=float(score), snippet=item.description, ) ) return results
  • Pydantic schema for the SearchResult output type returned by the tool.
    class SearchResult(BaseModel): id: str name: str score: float snippet: str
  • Registration of the tool using @mcp.tool decorator within register_tools function.
    @mcp.tool def search_public_apis(query: str, limit: int = 5) -> list[SearchResult]:
  • Imports register_tools and calls it to register the tools in the MCP server creation.
    from .tools import register_tools def create_server() -> FastMCP: mcp = FastMCP(name="free-api-mcp") register_tools(mcp)

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/zazencodes/public-apis-mcp'

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