Skip to main content
Glama

search_content

Read-only

Search large files for text patterns without loading entire content into memory. Find functions, classes, errors, log entries, or count matches with regex and fuzzy options.

Instructions

Search large files for text patterns without loading entire content into memory.

Use when finding functions, classes, errors, log entries, or counting
occurrences. Supports: fuzzy matching (handles typos/whitespace), regex
patterns, case-insensitive search, inverted matching (like grep -v), and
count-only mode. Regex and fuzzy are mutually exclusive: regex=true
disables fuzzy automatically (explicit fuzzy=true yields a warning in
the response). Returns ranked matches with line numbers and context
(lines truncated to 500 chars). When count_only=True, returns
{count, pattern, fuzzy_enabled, regex_enabled, case_sensitive, inverted}
instead of the full results structure.

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": {
      "absolute_file_path": "<absolute_file_path>",
      "pattern": "<pattern>"
    },
    "name": "search_content"
  }
}

Input Schema

NameRequiredDescriptionDefault
fuzzyNoEnable fuzzy matching to handle typos and whitespace differences. Omit (null) for auto: fuzzy on for text search, off for regex. Explicit true together with regex=true is ignored and a warning is returned.
regexNoEnable regex pattern matching (e.g., r'error.*timeout'). Disables fuzzy matching.
invertNoReturn lines that do NOT match the pattern (like grep -v)
patternYesText pattern to find (e.g., 'class User', 'ERROR', or regex like r'\d{3}-\d{4}')
count_onlyNoReturn only the match count, not content. Efficient for large files.
max_resultsNoMaximum results to return (1-500)
context_linesNoLines of context before/after each match
case_sensitiveNoMatch exact case when true (default: false for case-insensitive)
absolute_file_pathYesAbsolute path to target file

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.0.0
    • addedInput schema / properties / fuzzy / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / fuzzy / default
      Previous value: -trueNew value: +null
    • changedInput schema / properties / fuzzy / description
      Previous value: -"Enable fuzzy matching to handle typos and whitespace differences (default: true)"New value: +"Enable fuzzy matching to handle typos and whitespace differences. Omit (null) for auto: fuzzy on for text search, off for regex. Explicit true together with regex=true is ignored and a warning is returned."
    • removedInput schema / properties / fuzzy / type
      Removed value: -"boolean"
    • changedInput schema / properties / max_results / description
      Previous value: -"Maximum results to return (1-100)"New value: +"Maximum results to return (1-500)"
    • changedInput schema / properties / max_results / maximum
      Previous value: -100New value: +500
  2. First observedv0.3.0

TDQS

A4.2/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true and destructiveHint=false; the description adds real behavioral detail beyond them: fuzzy/regex mutual exclusion and the auto-resolution rule, the warning emitted on an explicit conflict, 500-character line truncation, and the distinct return structure when count_only=True. These are exactly the non-obvious behaviors that would otherwise only be discovered by trial.

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?

Front-loaded with purpose followed by usage triggers, then capabilities, then the mode-conflict caveat and return shape - a logical progression with no filler sentences. It runs long relative to a simple search tool, but nearly every clause carries operational information.

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?

With no output schema, the description does the work of describing both return forms (ranked matches with line numbers and truncated context, versus the count_only object), which is the key gap it needed to fill. Pagination via max_results and context_lines defaults are left entirely to the schema, a minor omission for a 9-parameter 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%, so baseline is 3. The description earns above baseline by explaining the interaction between pattern-matching modes (regex=true disabling fuzzy) and enumerating the count_only response keys, both of which tie parameter choices to observable behavior rather than restating field text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('Search large files for text patterns') plus a scope qualifier ('without loading entire content into memory') that tells the agent this is a streaming/scan tool. It does not name a sibling such as search_directory or read_content, so the agent must infer that this operates on a single file versus a directory tree.

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?

'Use when finding functions, classes, errors, log entries, or counting occurrences' gives concrete triggering scenarios, which is stronger than most definitions. It stops short of exclusions or explicit alternatives, so the boundary with search_directory (likely multi-file search) is left to inference.

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