Skip to main content
Glama

search_codebase

Search your indexed codebase to find relevant code patterns, usage examples, and architectural context. Supports intents for edit, refactor, or migrate with preflight readiness checks.

Instructions

Routes to the active/current project automatically when known. Search the indexed codebase. Default compact mode returns at most 6 ranked results with light graph context (importedByCount, topExports, layer), a patternSummary, bestExample, nextHops, and response-budget metadata. Use mode="full" for today's richer response with full hints arrays and all memories — identical shape as before this parameter existed. IMPORTANT: Pass the intent="edit"|"refactor"|"migrate" to get preflight: edit readiness check with evidence gating.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language search query
modeNoResponse mode. compact (default): max 6 results with light graph context, pattern summary, best example, next hops, and budget metadata. full: today's richer shape + budget metadata.compact
intentNoOptional. Use "edit", "refactor", or "migrate" to get the full preflight card before making changes.
limitNoMaximum number of results to return (default: 5)
includeSnippetsNoInclude code snippets in results (default: false). If you need code, prefer read_file instead.
filtersNoOptional filters
projectNoOptional project selector for this call. Accepts a project root path, file path, file:// URI, or a relative subproject path under a configured root.
project_directoryNoDeprecated compatibility alias for older clients. Prefer project.
Behavior5/5

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

With no annotations, the description fully carries behavioral transparency. It describes default behavior (compact mode, 6 results, graph context), full mode, intent parameter effects, and hints about response metadata. It also warns about includeSnippets default and recommends read_file for code.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured, front-loading key information about routing and search function. It provides detailed mode and intent guidance but could be more concise by merging some sentences. Overall, it balances detail and readability.

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 no output schema, the description explains the compact mode return shape (graph context, pattern summary, etc.) and mentions budget metadata. It covers filters and parameters. However, it omits error handling, pagination beyond limit, and behavior for empty queries. Still fairly complete for a search tool.

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

Parameters4/5

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

Schema coverage is 100%, baseline is 3. The description adds value by explaining the compact mode result count (at most 6 vs schema default limit of 5), clarifying the intent parameter's role for preflight, and noting the routing behavior for project. This exceeds basic schema info.

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 it searches the indexed codebase, auto-routes to active project, and details the return format. It distinguishes from siblings like get_codebase_health or detect_circular_dependencies by being a search tool.

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 guides when to use compact vs full mode and when to pass intent for preflight. It notes that includeSnippets is false by default and to prefer read_file. However, it does not contrast with sibling tools or mention when not to use the tool.

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/PatrickSys/codebase-context'

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