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.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "NewCmdRoot repo:cli/cli"
    },
    "name": "search_code"
  }
}

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.6/5.0
Behavior5/5

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

Annotations already cover readOnly/openWorld/idempotent/non-destructive, yet the description adds substantial operational context beyond them: default-branch-only indexing, suppressed common terms, and a ~10 requests/minute cap. It also states the return shape (matching files with repo, path, URL), which is exactly the extra behavior an agent needs before calling.

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?

Front-loaded with purpose, then routing triggers, then qualifiers, then caveats — a sensible order with no filler sentences. It is dense and packs many clauses into few sentences, which is efficient but slightly crowded to scan.

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?

Two parameters, no output schema, and the description still covers query syntax, result shape, indexing limits, and rate limits. An agent has everything needed to call it correctly and to predict failure modes.

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%, so the baseline is 3; the description earns above that by enumerating supported GitHub qualifiers (repo:, org:, user:, language:, filename:, path:, extension:, in:file) that the schema only hints at through examples. It does not clarify per_page semantics beyond the schema, which already documents default/max.

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 CODE across public GitHub repositories) and further narrows to finding where a function/symbol/string is defined or used. That is distinguishable from repo-listing or file-fetching siblings without opening any schema.

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

Usage Guidelines4/5

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

Gives explicit routing guidance with concrete trigger phrases ("PREFER OVER WEB SEARCH for 'find code that does X'...") plus a list of example intents. It lacks an explicit when-not or a named sibling alternative such as search_repos or search_within, so the agent must infer the boundary against those tools.

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.