Skip to main content
Glama

search_in_files

Find every occurrence of a literal string or regex in project files, with context and glob filters, ignoring ignored and binary files for precise audits and safe replacements.

Instructions

Exact scan of current file contents — literal text by default, regex when use_regex=true. Use search_in_files when you need every occurrence, exact verification, audits, or safe replacement prep. Unlike shell grep/rg, results are confined to the active project (no .git/, node_modules/, build artefacts, or anything else .gitignore excludes), binary files are skipped (null-byte sniff of the first 8 KB), files larger than max_file_bytes (50 MiB default) are skipped before opening, globs with a literal directory prefix (e.g. "src/**/*.go") prune sibling directories from the walk. Smart-case (case-insensitive when the pattern is all lowercase), supports context lines and glob file filters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
globNoGlob to restrict which files are searched, e.g. '*.go' or '**/*_test.go'
pathNoDirectory to search in (absolute path, file:// URI, or workspace-relative path). Defaults to the workspace root.
excludeNoGlob patterns for paths to exclude, e.g. ["vendor", "*.pb.go", "testdata/**"]. Matched against the entry's base name and relative path. Matching directories are pruned from the walk; matching files are skipped.
patternNoPlain text to search for by default; regular expression when use_regex is true.
use_regexNoTreat pattern as a regular expression (Go RE2). Default false — pattern is literal text.
max_resultsNoMaximum number of matching lines to return. Default 200.
context_linesNoNumber of lines of context to show before and after each match (like rg -C). Default 0.
case_sensitiveNoForce case-sensitive matching. Default (omitted): smart-case — case-insensitive when pattern is all lowercase, case-sensitive otherwise. Pass false to force case-INSENSITIVE matching even for an uppercase pattern.
include_hiddenNoInclude hidden files and directories (starting with '.'). Default false.
max_file_bytesNoSkip files larger than this many bytes. Default 52428800 (50 MiB).
include_enclosing_symbolNoWhen true and an LSP is available, annotate each match with the deepest enclosing symbol (function, method, type, etc.) from the language server. One LSP query per distinct matched file; results cached within the call. Silently omitted when the LSP is unavailable.
Behavior5/5

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

With no annotations, the description carries full responsibility and excels: it discloses gitignore exclusion, binary file skipping via null-byte sniff, max_file_bytes skip before opening, glob directory pruning, and smart-case behavior. These are non-obvious runtime behaviors essential for agent expectations.

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?

Four sentences, front-loaded with the core purpose and followed by usage guidance and key behavioral nuances. It is dense but every sentence contributes; slightly long but appropriate for a tool with 11 parameters.

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 11 parameters, no annotations, and no output schema, the description covers scope, exclusions, binary handling, size limits, glob behavior, smart-case, and context lines. It does not explicitly mention return format or ordering, but the schema covers max_results and context defaults, making it fairly complete.

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%, so baseline is 3. The description adds value beyond the schema by explaining behavior for use_regex, smart-case rules, glob directory pruning, and default max_file_bytes. It enriches parameter understanding but doesn't need to re-explain every field.

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 opens with 'Exact scan of current file contents' — a specific verb and resource, and clarifies literal vs regex behavior. It distinguishes this tool from shell grep/rg and implicitly from sibling find_files by focusing on file contents and project scanning.

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?

Explicitly states when to use: 'Use search_in_files when you need every occurrence, exact verification, audits, or safe replacement prep.' It contrasts with shell grep/rg, providing clear context, but does not explicitly name sibling tool alternatives for different use cases, so it falls short of a 5.

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/plumbkit/plumb'

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