Skip to main content
Glama

search_code

Locate code across multiple repositories by query, returning file and line positions, or include surrounding context; filter by repo, file pattern, regex, and result count.

Instructions

Search code across repos. mode=locations (default) omits line text; mode=context includes context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo"locations" (default) returns file+line number only; "context" also returns the matched line text and context_lines surrounding lineslocations
repoNoRepo to search: "all" searches every configured repo; otherwise a single name or comma-separated list, e.g. "pypto,simpler"all
queryYesSearch term. Treated as a fixed string unless use_regex=True
file_globNoFilename glob filter, e.g. "*.py", "*.cc", "**/*.mlir". Default "*" matches all files.*
use_regexNoTreat query as a regular expression (ripgrep syntax). Default False uses fixed-string matching.
max_resultsNoMaximum number of match lines to return (1–2000)
context_linesNoLines of context to include around each match. Only used when mode=context.
group_by_fileNoWhen True, include a files[] list sorted by match count

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

With no annotations, the description carries the burden of disclosure. It does explain the mode behavior (locations omits line text, context includes it), but repeats information already in the schema. It does not mention other behavioral traits such as default repo scope, regex handling, or result limits, which are only in the schema. The added value beyond structured fields is minimal but not misleading.

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?

The description is two sentences, front-loaded with the tool's purpose and a concise summary of the mode options. Every sentence serves a purpose and there is no redundancy or fluff.

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?

Given the rich input schema (100% coverage) and the presence of an output schema, the description is adequate for a straightforward search tool. However, it lacks any mention of how this tool relates to sibling tools like search_abstractions, leaving a minor gap in contextual understanding.

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 the baseline is 3. The description repeats the mode parameter's behavior without adding any new meaning or context for the other seven parameters, so it does not improve on the schema.

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?

The description clearly states the tool searches code across repositories, using a specific verb and resource. It is immediately understandable, but does not explicitly distinguish from the sibling tool 'search_abstractions', so it lacks sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like search_abstractions. It only states what the tool does, not the conditions or contexts that would make it the preferred choice.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/georgebisbas/mcp-hw-native-sys'

If you have feedback or need assistance with the MCP directory API, please join our Discord server