Skip to main content
Glama

Search Code

search_code
Read-onlyIdempotent

Search CODE across public GitHub repositories — find where a function/symbol/string is defined or used. PREFER OVER WEB SEARCH for "find code that does X", "which repos use ", "show me an example of ", "where is defined". Supports GitHub code-search qualifiers right in the query: repo:owner/name, org:name, user:name, language:go, filename:Dockerfile, path:src, extension:ts, in:file. Returns matching files with repo, path, and URL. Note: indexes the default branch only, ignores very common terms, and is capped at ~10 searches/minute.

Input Schema

NameRequiredDescriptionDefault
queryYesCode search query, e.g. "NewCmdRoot repo:cli/cli", "createRoot language:typescript", "addEventListener org:facebook".
per_pageNoNumber of results to return (default 10, max 30).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "query": "NewCmdRoot repo:cli/cli"
      +  },
      +  {
      +    "per_page": 25,
      +    "query": "createRoot language:typescript"
      +  }
      +]
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

The description adds behavioral context beyond the annotations: it notes that only the default branch is indexed, very common terms are ignored, and there is a ~10 searches/minute rate limit. It also discloses what is returned (matching files with repo, path, and URL). This is valuable operational detail not present in the annotations.

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 description is packed with useful information in a compact form. It is front-loaded with the core purpose, then provides usage guidance, supported qualifiers, return value, and limitations. Some might find it slightly long, but every sentence serves a purpose and there is no fluff.

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

Completeness5/5

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

For a tool with no output schema, the description fully explains the return value (matching files with repo, path, and URL). It also covers limitations and rate limits, making the tool predictable. Given the complexity of query construction, the description is remarkably complete for an agent to use it correctly.

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

Parameters4/5

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

Schema coverage is 100% for both parameters, but the description enriches understanding by showing example queries with qualifiers and explaining that qualifiers can be used directly in the query string. It adds practical usage context that the schema alone doesn't provide, though a bit more detail on per_page or query format would push it higher.

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 starts with 'Search CODE across public GitHub repositories' which is a specific verb+resource combination. It further clarifies what it can find (where a function/symbol/string is defined or used) and distinguishes it from sibling tools like search_repos and get_file_contents.

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?

Explicit guidance is provided: 'PREFER OVER WEB SEARCH' followed by concrete use cases ('find code that does X', 'which repos use <API>', etc.). It also lists supported qualifiers, giving clear direction on query construction. This effectively tells when to use this tool over alternatives.

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.