Skip to main content
Glama

search_text

Read-onlyIdempotent

Search all indexed files for any string or regex pattern — find comments, TODOs, config values, and error messages. Filter by language or file glob for precise results.

Instructions

Full-text search across all indexed files. Supports regex, glob file patterns, language filter. Use for finding strings, comments, TODOs, config values, error messages — anything not captured as a symbol. For symbol search (functions, classes) use search instead. Read-only. Returns JSON: { files: [{ file, language, hits: [{ line, column, match, context }] }], total_matches } — hits grouped per file, so a long path is paid once. Pass grouping: "flat" for the ungrouped matches[] shape.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch string or regex pattern
groupingNoPayload shape. "by_file" (default) groups hits per file, so a long path is paid once; "flat" is a single matches[] array.by_file
is_regexNoTreat query as regex (default false)
languageNoFilter by language (e.g. "typescript", "python")
timeout_msNoWall-clock budget in ms — caps a catastrophic-backtracking regex. Default 2000; 0 disables.
max_resultsNoMax matches to return (default 50)
file_patternNoGlob filter, e.g. "src/**/*.ts"
context_linesNoLines of context before/after each match (default 0 — set higher if you need surrounding code)
case_sensitiveNoCase-sensitive search (default false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.22.0
    • changedInput schema / properties / grouping / default
      Previous value: -"flat"New value: +"by_file"
    • changedInput schema / properties / grouping / description
      Previous value: -"Payload shape. \"flat\" (default) is a single matches[] array; \"by_file\" groups hits per file — saves tokens on long paths with many hits."New value: +"Payload shape. \"by_file\" (default) groups hits per file, so a long path is paid once; \"flat\" is a single matches[] array."
    • changedInput schema / required
      Previous value: -[
      -  "query",
      -  "file_pattern"
      -]New value: +[
      +  "query"
      +]
  2. Changed3 schema fields changedv3.3.0
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • changedInput schema / properties / grouping / description
      Previous value: -"Payload shape. \"flat\" returns a single matches[] array (default). \"by_file\" groups hits under each file — saves tokens on long paths with many hits."New value: +"Payload shape. \"flat\" (default) is a single matches[] array; \"by_file\" groups hits per file — saves tokens on long paths with many hits."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Wall-clock budget in milliseconds. Catastrophic-backtracking regex cannot pin a worker beyond this. Default 2000. Set 0 to disable."New value: +"Wall-clock budget in ms — caps a catastrophic-backtracking regex. Default 2000; 0 disables."
  3. Addedv1.41.0
  4. Removedv1.38.0
  5. Changed3 schema fields changedv1.35.1
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / timeout_ms
      Added value: +{
      +  "description": "Wall-clock budget in milliseconds. Catastrophic-backtracking regex cannot pin a worker beyond this. Default 2000. Set 0 to disable.",
      +  "maximum": 30000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "query"
      -]New value: +[
      +  "query",
      +  "file_pattern"
      +]
  6. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, and the description independently states 'Read-only.' Beyond annotations, it discloses the return JSON shape, grouping behavior, and the cost nuance that 'a long path is paid once.' It doesn't discuss rate limits or indexing freshness, but the description adds meaningful behavioral context beyond the schema and annotations.

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 compact and front-loaded with the core purpose, then adds routing guidance, safety info, return shape, and grouping nuance. It is a bit dense with multiple clauses in one sentence, but every sentence earns its place and the structure is logical. Slightly long but not wasteful.

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?

For a read-only search tool with 9 well-documented parameters and an explicit return JSON shape, the description covers the key decision factors: what it searches, how to filter, how grouping changes the response, and when to use the sibling. It doesn't cover timeout defaults or max_results limits, but those are in the schema. Given no output schema, the return shape description compensates well.

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 the schema already documents all 9 parameters. The description adds some meaning by naming regex/glob/language filter support and explaining the grouping difference between 'by_file' and 'flat', but the schema already carries most of the semantic weight. Baseline 3 is appropriate because the description adds only modest value beyond the schema.

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 precisely states what the tool does: full-text search across indexed files, with explicit support for regex, glob file patterns, and language filtering. It clearly differentiates from the sibling 'search' tool by stating that search_text is for strings/comments/TODOs/config values/error messages, while symbol search (functions, classes) should use 'search' instead.

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?

The description explicitly says when to use it versus the alternative: 'For symbol search (functions, classes) use search instead.' This direct routing to a sibling tool gives the agent clear selection criteria. It also names the read-only nature and describes the return shape, giving the agent enough context to decide whether this tool fits the task.

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