Skip to main content
Glama

search_code

Find specific code by searching for a substring in source files. Returns path:line hits with surrounding context, skipping ignored and vendor directories.

Instructions

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

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).
Install Server

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses key behaviors: case-insensitive default, return format (path:line hits with surrounding line text), and the skipping of .gitignore and vendor dirs. This goes beyond basic operation and addresses important edge cases.

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 concise sentences, each earning its place: action, return format, and skip behavior. Front-loaded with the primary purpose, no filler or redundancy.

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 absence of an output schema, the description properly explains the return format. It covers default behavior and project-ignoring rules. It does not mention max_results default, but the schema covers that, so completeness is high for a search tool.

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 adds minimal extra meaning beyond the schema: it restates case-insensitivity (already in schema) and mentions output format, but does not elaborate on parameter semantics beyond what properties already describe.

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 states the tool searches source files for a substring, with a specific verb ('Search') and resource ('source files'). It also distinguishes itself from siblings (repo_map, pack_context) by its unique focus on substring search with output details (path:line hits).

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?

The description provides clear context on what the tool does, making it obvious when to use it (e.g., finding string occurrences in code). It does not explicitly mention alternatives, but the siblings are for mapping/packing context, so the usage is clear. It lacks explicit exclusions, but the context is sufficient.

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

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