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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes |
Implementation Reference
- src/public_apis_mcp/tools.py:13-32 (handler)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
- src/public_apis_mcp/types.py:17-22 (schema)Pydantic schema for the SearchResult output type returned by the tool.class SearchResult(BaseModel): id: str name: str score: float snippet: str
- src/public_apis_mcp/tools.py:12-13 (registration)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]:
- src/public_apis_mcp/server.py:6-11 (registration)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)