Skip to main content
Glama

Search GitHub code

github_search_code
Read-only

Search file contents across GitHub using a GitHub connection (your own or one shared with you). Accepts a GitHub code-search query (qualifiers like repo:, org:, language:, path:, filename: are supported and usually required). Returns up to 30 matching files.

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": {
      "query": "<query>"
    },
    "name": "github_search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesGitHub code search query, e.g. "addEventListener repo:octocat/Hello-World language:js".
connectionNoWhich GitHub connection to use, by its name from github_list_connections. This is a local label for the connection, NOT a GitHub username — for anything GitHub has to resolve, use that connection's login instead. Optional when you have exactly one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds value beyond that by disclosing the result cap ('up to 30 matching files') and that search runs under a specific GitHub connection scope, which affects what results are visible. It does not mention pagination or whether more than 30 results can be requested.

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

Conciseness5/5

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

Three compact sentences, front-loaded with purpose, then query requirements, then result expectations. No filler or redundant restatement of the name.

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?

For a two-parameter read tool with no output schema, the description covers purpose, query syntax expectations, connection selection, and result count. The only material gap is pagination or how to retrieve results beyond the 30-file cap.

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, but the description earns extra by enumerating supported qualifiers (repo:, org:, language:, path:, filename:), which goes beyond the single example in the schema. It also clarifies the connection is 'your own or one shared with you', reinforcing the scope meaning.

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 opens with a specific verb and resource ('Search file contents across GitHub'), which cleanly separates it from the sibling github_search_repositories (repositories) and github_get_file_contents (single-file fetch). An agent can pick the right tool 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?

It states the query must be a GitHub code-search query and that qualifiers like repo:, org:, language: are 'usually required', which is practical when-to-use guidance. The connection guidance (optional when you have exactly one) is also useful. It stops short of naming an explicit alternative or when-not-to-use this tool.

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.

Resources