Skip to main content
Glama

find_in_codebase

Search a codebase for exact literal or regex pattern matches and return file paths, line numbers, and context snippets for precise code lookup.

Instructions

Find exact literal or regex pattern matches in the codebase.

Runs entirely locally — no embedding model, no external LLM call. Returns file paths, line numbers, and context snippets for each match. Use this instead of search_codebase_tool when you need precise text matches (e.g. "session_id", "def authenticate", a specific import).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pattern": "<pattern>"
    },
    "name": "find_in_codebase"
  }
}

Input Schema

NameRequiredDescriptionDefault
patternYes
file_globNo
use_regexNo
project_rootNo
case_sensitiveNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

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 behavioral burden and does useful work: it discloses local-only execution with no embedding model or external LLM call, and states the return shape includes file paths, line numbers, and context snippets. It does not mention scope limits, performance characteristics, or binary/large-file handling, so it stops short of full disclosure.

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?

Four short sentences, front-loaded with the core purpose, then the execution model, then the return shape, then the sibling routing rule. No sentence is redundant and the ordering matches how an agent would evaluate the tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so the description need not detail return values, though it helpfully does. However, for a five-parameter tool with zero schema description coverage and no annotations, the description leaves file_glob, project_root, and case_sensitive entirely unexplained, which is a meaningful gap for correct invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for five undocumented parameters. It clarifies that pattern can be a literal or regex string via use_regex and supplies example patterns, but file_glob, project_root, and case_sensitive receive no explanation of format or effect, leaving most parameters ambiguous.

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?

States a specific verb and resource: exact literal or regex pattern matching in the codebase. It explicitly distinguishes itself from the sibling search_codebase_tool by framing this as the precise-text-match option, so an agent can choose without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit routing rule: use this instead of search_codebase_tool when precise text matches are needed, with concrete pattern examples such as "session_id" and "def authenticate". The when-to-use condition and the alternative are both named.

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