Skip to main content
Glama
zazencodes

Public APIs MCP

by zazencodes

search_public_apis

Search for free public APIs that match your query using semantic search over names and descriptions.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'search_public_apis' tool. It loads or builds an embedding index, embeds the query, searches the index for the top-k matches, and returns SearchResult objects.
    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 model defining the output schema for search results returned by search_public_apis.
    class SearchResult(BaseModel):
        id: str
        name: str
        score: float
        snippet: str
  • Registration of the tool via the @mcp.tool decorator in the register_tools function, which is called from server.py.
    def register_tools(mcp: FastMCP) -> None:
        @mcp.tool
        def search_public_apis(query: str, limit: int = 5) -> list[SearchResult]:
  • The EmbeddingIndex.search method performs cosine similarity search (via dot product on L2-normalized vectors) used by search_public_apis.
    def search(self, query_vector: np.ndarray, top_k: int) -> list[tuple[str, float]]:
        # query_vector expected shape (D,), normalized
        scores = self.vectors @ query_vector.astype(np.float32)
        idx = np.argsort(-scores)[:top_k]
        return [(self.ids[i], float(scores[i])) for i in idx]
  • Helper function that embeds the query string into a normalized vector for similarity search.
    def embed_query(text: str, model_id: Optional[str] = None) -> tuple[np.ndarray, str]:
        vecs, resolved = embed_texts([text], model_id=model_id)
        q = vecs[0].astype(np.float32)
        q = q / (np.linalg.norm(q) + 1e-12)
        return q, resolved
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. However, it does not disclose any behavioral traits such as search algorithm, result format, or side effects. It only states the basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, making it concise but possibly too brief. It lacks structure and could include more details without becoming verbose.

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 low complexity (2 parameters, simple search), the description is incomplete. It omits usage context, param details, and behavioral transparency. The presence of an output schema does not fully compensate for these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description should compensate for parameter meanings. It only mentions 'input query string' for the query parameter but does not explain the limit parameter or provide any additional semantic guidance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'search' and the resource 'free public APIs', and specifies that it matches an input query string. This distinguishes it from the sibling tool 'get_public_api_details' which likely returns details of a specific API.

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, nor any conditions or exclusions. The description only states what the tool does without any usage context.

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

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