Skip to main content
Glama

Search code

search_code
Read-only

Search source code across public GitHub repositories and return matching files with short snippets; requires a GITHUB_TOKEN or PAT to work.

Instructions

Search source code in public repositories (GitHub requires a token for this endpoint, so it only works when GITHUB_TOKEN or GITHUB_PAT is set). Returns matching files with a short snippet.

Input Schema

NameRequiredDescriptionDefault
pathNoLimit to files under this path, e.g. 'src/'
repoNoLimit to one repository: 'owner/repo'
limitNoNumber of results to return (1-100, default 10)
ownerNoLimit to a user or organization
queryYesCode or text to find, e.g. 'useSyncExternalStore'
offsetNoNumber of results to skip, for paging (default 0)
filenameNoExact file name, e.g. 'pom.xml'
languageNoe.g. 'TypeScript'
extensionNoFile extension without dot, e.g. 'yml'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.2

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered. The description adds genuinely new behavioral context beyond them: a hard authentication prerequisite that determines whether the call works at all, and the shape of the return (files with snippets). It omits GitHub code search rate limits, which is a notable gap for an open-world search endpoint.

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?

Two sentences, zero filler, with the scope stated first and the auth caveat attached directly to the sentence it qualifies. Nothing here could be removed without losing information.

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 nine-parameter, high-fan-out search tool with full schema coverage and no output schema, the description covers purpose, auth gating, and return shape adequately. The missing piece is rate-limit/throttling behavior, which matters for a public code search endpoint.

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 coverage is 100% with all nine parameters individually described, so the baseline is 3. The description adds no meaning beyond the schema — nothing about supported query qualifiers or how path/repo/owner filters combine — so it does not exceed the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("search source code in public repositories") plus the return shape ("matching files with a short snippet"), which distinguishes it from get_file_contents and search_repositories. It stops short of naming a sibling or stating exclusions, so it is clear but not maximally differentiated.

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

Usage Guidelines3/5

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

The parenthetical gives a real usage condition — the endpoint only works when GITHUB_TOKEN or GITHUB_PAT is set — which is valuable gating information. However, there is no guidance on when to use this versus get_file_contents (read a known file) or get_repo_tree, leaving the alternative-selection decision implicit.

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