Skip to main content
Glama

search_code

Search source files for a substring and return matching lines with file paths, line numbers, and surrounding code to locate where a term appears in a repository.

Instructions

Search source files for a substring (case-insensitive by default). Returns path:line hits with surrounding line text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootNoRepository root. Defaults to REPO_CONTEXT_ROOT or cwd.
queryYesSubstring to search for.
max_resultsNoMaximum hits (default 50).
case_sensitiveNoCase-sensitive search (default false).
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It states that the search is case-insensitive by default and that results include path:line hits with surrounding text. This adds meaningful behavioral context beyond a simple 'search' statement, though it doesn't cover all edge cases like binary file handling or directory traversal limits.

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 exceptionally concise: two sentences that front-load the core purpose, followed by the return format. Every word adds value, and there is no unnecessary filler.

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 tool's simplicity and the schema's rich parameter descriptions, the description adequately covers the essential behavior. It mentions the return format (path:line hits with surrounding text) even though there is no output schema. It could go deeper into limitations (e.g., binary files, max results), but these are partially captured in the schema. Sibling tools indicate a broader repo context, and this description fits well.

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?

The schema covers 100% of parameters with descriptions, so the baseline is 3. The description reinforces defaults already present in the schema (case-insensitivity, max_results default) and adds the output format, but it doesn't significantly expand on parameter semantics beyond what the schema already provides.

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 clearly identifies the tool's function: searching source files for a substring. It specifies the resource (source files), the action (search), and adds key details like case-insensitivity and return format. This distinguishes it from sibling tools like repo_map and pack_context, which focus on repo mapping and context packing.

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 description implies when to use the tool (when you need to find a substring in source files), but it does not explicitly mention alternatives or exclusion cases. Sibling tools are not referenced, so there is no comparative guidance. The context is clear but lacks explicit when-not-to-use instructions.

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/nduc99911/repo-context-mcp'

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