Skip to main content
Glama

github_search_code

Read-only

Search file contents in a GitHub repository (GitHub code search). Returns matching file paths with text-match fragments around each hit. Searches the repository's default branch only and requires the repository to be indexed by GitHub; when the search is rejected or comes back empty, fall back to github_list_repository_files and github_read_file. 'repo' also accepts the combined 'owner/name' form.

Input Schema

NameRequiredDescriptionDefault
pathNoRestrict matches to files under this path prefix (GitHub path: qualifier).
repoYesRepository name. Also accepts the combined 'owner/name' form.
ownerNoRepository owner (organisation or user). May be omitted when the repository name is unambiguous in this organisation, or embedded in 'repo' as 'owner/name'.
queryYesCode search terms (GitHub code-search syntax; bare words match file contents). The repo:/path: qualifiers are added by the tool from the 'repo' and 'path' parameters; any you supply here are stripped.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds substantial behavior beyond that: the shape of results (file paths with text-match fragments), a scope restriction (default branch only), a prerequisite (repository must be indexed), and failure handling. It stops short of mentioning auth or rate-limit behavior for the GitHub API.

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 sentences, front-loaded with the core action, followed by result shape and scope, then the fallback. No filler, and the 'owner/name' note is a short trailing clarification.

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 read-only search tool with no output schema, the description covers the return shape, scope limitation, prerequisite, and failure path. Combined with the readOnly annotation, an agent has everything needed to invoke it correctly and handle empty/rejected results.

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

Parameters3/5

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

Schema description coverage is 100%, so all four parameters are already documented in the schema, including the 'owner/name' form and the path: qualifier behavior. The description only restates the 'owner/name' acceptance, adding no meaning beyond the schema. Baseline 3 applies.

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?

Specific verb (search) plus resource (file contents in a GitHub repository) with an explicit scope note that it is GitHub code search. It differentiates itself from the two most likely sibling tools by naming github_list_repository_files and github_read_file as fallbacks.

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 explicit when-to-use conditions (default branch only, repo must be indexed by GitHub) and a concrete escape hatch: when the search is rejected or returns empty, fall back to github_list_repository_files and github_read_file. This routes the agent without 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.

Resources