Skip to main content
Glama

Find public copies of a code string

search_public_code
Read-only

Search public repositories for an exact code string; return WHERE it appears.

Use it to hunt vendored / copy-pasted copies of known-vulnerable code: search a distinctive symbol or short fragment from the vulnerable function (a function name, a constant, one call), then FETCH AND READ the hits to judge which copies are still unpatched, reachable, or just fossils/forks. Returns RAW search results only -- it makes no vulnerability judgment; that reasoning is yours. A long line rarely matches exactly and is slow; the shortest distinctive token works best. Searches are capped at about 10 s: partial: true means the cap was hit with fewer than limit hits.

Args: code: an exact code string, e.g. "VP8LBuildHuffmanTable" or "yaml.load(". lang: optional language filter, e.g. "c", "python", "javascript" (default: all languages). limit: max hits to return (default 50).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "search_public_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
langNo
limitNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / lang / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / lang / default
      Previous value: -"c"New value: +null
    • removedInput schema / properties / lang / type
      Removed value: -"string"
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the supplied readOnlyHint/openWorldHint annotations, it discloses a ~10 s search cap and the exact meaning of `partial: true`, which is critical operational behavior the agent cannot get from structured fields. It also clarifies the tool performs no vulnerability judgment, setting expectations about output interpretation.

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

Conciseness4/5

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

The key fact — exact-string search returning locations — is front-loaded, and each paragraph serves a distinct purpose (purpose, workflow, caveats, args). It is somewhat long and leans on capitalized emphasis ('WHERE', 'FETCH AND READ', 'RAW'), which is slightly noisy but not wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description must convey return semantics; it explains raw results, the `limit` count, and the `partial` flag, which is strong. It stops short of describing what a single hit contains (e.g., repository, file path, line/snippet), which an agent needs since it is instructed to fetch and read hits.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden and does so: `code` is defined as an exact code string with two concrete examples ('VP8LBuildHuffmanTable', 'yaml.load('), `lang` is described as an optional filter with example values and the all-languages default, and `limit` is given a default of 50. All three parameters gain meaning not present in the bare schema.

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?

States a specific verb and resource ('Search public repositories for an exact code string') plus the return shape ('return WHERE it appears'). It also explicitly separates itself from vulnerability-analysis siblings by declaring it returns 'RAW search results only -- it makes no vulnerability judgment', so an agent can tell it apart from search_vulns or enrich_cve without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a concrete use case (hunting vendored/copy-pasted copies of known-vulnerable code), a prescribed workflow (search a distinctive symbol, then fetch and read hits to judge patch status/reachability), and an explicit when-not ('A long line rarely matches exactly and is slow'). It also names the preferred alternative input strategy ('the shortest distinctive token works best'), leaving little to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.