search_public_apis
Find free public APIs matching your query using semantic search across an extensive catalog of API names and descriptions.
Instructions
Search for free public APIs that match the input query string.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Implementation Reference
- src/public_apis_mcp/tools.py:12-32 (handler)The handler function for the 'search_public_apis' tool. It embeds the query, searches the index, loads catalog items, and returns matching SearchResults.@mcp.tool 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
- src/public_apis_mcp/types.py:17-22 (schema)Pydantic model defining the output schema for the search_public_apis tool.class SearchResult(BaseModel): id: str name: str score: float snippet: str
- src/public_apis_mcp/server.py:11-11 (registration)Invocation of register_tools(mcp) which registers the search_public_apis tool via its @mcp.tool decorator.register_tools(mcp)