Skip to main content
Glama

search_text

Read-onlyIdempotent

Search file contents with ripgrep and return matching lines grouped by file, with context, filters, and encoding support for code and text investigations.

Instructions

Search file contents with ripgrep and return matching lines grouped by file.

Use instead of findstr / Select-String / grep. Format: <line>: text for matches, <line>- text for context, -- between non-adjacent blocks. Tip: run count_matches first when the pattern may be very common.

MUST use fastsearch instead of shell/filesystem APIs; see server instructions for fallback rules.

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>",
      "path": "<path>"
    },
    "name": "search_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute directory (or file) path to search in.
wordNoOnly match whole words.
afterNoLines of context after (overrides `context`).
beforeNoLines of context before (overrides `context`).
hiddenNoInclude hidden files/dirs (dotfiles, Windows hidden attr).
outputNocontent returns matching lines; files returns each matching path once, without counting all occurrences.content
contextNoLines of context before AND after each match (0-50).
excludeNoSkip files matching these globs, e.g. ['*.min.js','tests/**'].
includeNoOnly search files matching these globs, e.g. ['*.py','src/**'].
literalNoTreat pattern as a fixed string, not a regex.
patternYesRust regex (like PCRE without lookaround/backrefs). Set literal=true to search a plain string with special chars.
encodingNoForce text encoding, e.g. 'gbk', 'utf-16le', 'shift_jis'. Default: auto (UTF-8/UTF-16 BOM).
relativeNoPrint paths relative to `path` (fewer tokens) instead of absolute.
multilineNoAllow pattern to span lines ('.' also matches newline).
no_ignoreNoDo NOT respect .gitignore/.ignore and default excludes (node_modules, .git, ...).
file_typesNoripgrep file types, e.g. ['py'], ['ts','js'], ['cpp'], ['cs'].
max_resultsNoMaximum match events in content mode, or matching files in files mode (1-5000).
max_per_fileNoMax matching lines per file.
case_sensitiveNotrue=case-sensitive, false=ignore case, null=smart case (sensitive only if pattern has uppercase).
max_line_lengthNoTrim long lines (minified files) to this many chars around the match.
max_output_charsNoTotal output character budget, including headings and context (1024-1000000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, non-destructive, closed-world behavior, so the safety profile needs no restating. The description adds genuinely new context: the line-prefix conventions (`:` vs `-`, `--` separators) and an operational policy that fastsearch must replace shell/filesystem APIs. It stops short of describing truncation effects when max_results or max_output_chars are hit.

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 core purpose and output format are front-loaded, and the count_matches tip is placed right where it is actionable. The trailing "MUST use fastsearch... see server instructions for fallback rules" is somewhat deferential and adds a sentence that points elsewhere rather than informing.

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 21 parameters and no output schema, the description usefully fills the return-value gap by documenting the match-line format and context separators. What remains unstated is output budgeting behavior (max_results / max_output_chars interactions), which matters for a search tool that can produce large results.

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

Parameters3/5

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

Schema description coverage is 100%, so all 21 parameters are already documented in the schema with defaults and enums. The description adds no parameter-level meaning (no guidance on context vs before/after, or content vs files mode) and merely implies regex usage. Baseline 3 is appropriate when the schema carries this much weight.

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 a specific verb and resource ("Search file contents with ripgrep") and states the return shape ("matching lines grouped by file"). It also specifies the exact output syntax, so an agent can tell immediately what kind of result to expect.

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?

It explicitly routes away from shell equivalents ("Use instead of findstr / Select-String / grep") and gives a concrete sequencing rule ("run count_matches first when the pattern may be very common"). It does not say when find_files or read_lines would be preferable, so alternatives are covered only partially.

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