Skip to main content
Glama

search_in_files

Search active project files for literal or regex matches, skipping gitignored, binary, or oversized files, with context and glob filters to locate every occurrence for verification and replacement prep.

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. Total output is capped at 200 KiB regardless, and truncation is labelled.
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.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv0.17.0
    • changedInput schema / properties / context_lines / description
      Previous value: -"Number of lines of context to show before and after each match (like rg -C). Default 0."New value: +"Number of lines of context to show before and after each match (like rg -C). Default 0. Total output is capped at 200 KiB regardless, and truncation is labelled."
    • changedInput schema / properties / context_lines / maximum
      Previous value: -10New value: +50
  2. First observedv0.16.6

TDQS

A4.8/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It discloses numerous behavioral traits: binary file skipping via null-byte sniff, file size limits, glob pruning of sibling directories, smart-case behavior, context lines, output caps, and LSP-based symbol annotation with silent omission. This is exceptionally transparent for a search tool.

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 dense but well-structured, front-loading the core purpose and mode, then layering exclusions and behaviors. Every sentence adds information, though it is long. It earns a 4 for efficiency despite the length; a 5 would require even tighter phrasing without losing the valuable details.

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

Completeness5/5

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

For a complex tool with 11 parameters and no output schema, the description covers all critical behaviors: exclusions, binary handling, size limits, smart-case, context lines, output caps, and LSP integration. It also explains defaults and edge cases. Nothing an agent needs to call it correctly is missing, making it complete for its complexity.

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 the baseline is 3. The description adds value beyond the schema by explaining smart-case behavior, the default max_file_bytes value, the 200 KiB output cap, and the LSP caching behavior. It doesn't restate schema descriptions but enriches them with defaults and edge-case behavior, justifying a 4.

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 states a specific verb ('scan'), resource ('current file contents'), and mode ('literal text by default, regex when use_regex=true'). It clearly distinguishes from shell grep/rg and other search tools by emphasizing project confinement and exclusions. The purpose is unambiguous and differentiates from siblings like workspace_search and find_files.

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?

Explicitly states when to use this tool ('when you need every occurrence, exact verification, audits, or safe replacement prep') and contrasts with shell grep/rg, noting the confinement to the active project. It also details exclusions (no .git/, node_modules/, build artefacts) and behavior like binary file skipping, which guides selection. This is strong usage guidance.

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

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