Skip to main content
Glama

Search workspace

search
Read-only

Locate files, directories, code strings, or symbol definitions across a workspace by name or content, and rank matching lines with weighted patterns before reading.

Instructions

Search by kind: file_name, directory_name, literal_content (regex=true for regex) or definition (symbol declarations). queries instead ranks matching lines by several weighted patterns (must/weight). Use when: you must locate code, strings or symbols before reading. Keep relative_path narrow: a scan stops at 50000 files. Avoid when: you know the path (read_file), want a file's structure (outline_symbol), a symbol's usages (symbol_references) or an executable on PATH (shell_run: where <name>). Output: hits[] {relative_path, line_number, snippet}, complete, total_match_lines, files_matched. With queries: hits also carry score/matched, plus total_files/total_hits. No match is ok with empty hits.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "search"
  }
}

Input Schema

NameRequiredDescriptionDefault
globNorg glob filter ('*.ts' = any depth, 'tools/*.ts' = that dir).
kindNoname substring | content (substring, or regex when regex=true) | declaration lines. Required unless `queries`/`files_hint` is set.
limitNoMax hits returned (default and max 200; ignored when count_only=true).
queryNoWhat to find (meaning depends on kind). Required unless `queries`/`files_hint` is set.
regexNotrue treats query as a regular expression for literal_content/definition (default false = plain substring).
hybridNotrue = tag hits with source/confidence; literal_content only.
queriesNoRank matching lines by several patterns: each matching pattern adds its weight to the line's score, and `must` patterns have to match. When set, `kind` and `query` are ignored and hits carry `score`/`matched`. Combine with `files_hint` to scan specific files.
count_onlyNotrue returns only match counts; limit is then ignored. false (default) returns hits.
files_hintNoWorkspace paths to search when `queries` is set (first 20 are used). Omit to scan a shallow listing of `relative_path` instead.
whole_wordNotrue = whole-word match only (rg -w / JS word boundaries) for literal_content and definition.
exclude_globNorg glob exclusion (same dialect as glob).
context_linesNoContext lines around each hit (default 0).
relative_pathNoWorkspace-relative ('.' = root); absolute/.. outside it rejected.
case_sensitiveNotrue makes literal_content/definition matching case-sensitive (default false).
include_hiddenNotrue = include hidden files (default); false = skip dotfiles. Secrets always excluded.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed37 schema fields changedv4.5.0
    • removedInput schema / properties / case_sensitive / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / case_sensitive / description
      Previous value: -"1 makes literal_content/definition matching case-sensitive (default 0)."New value: +"true makes literal_content/definition matching case-sensitive (default false)."
    • removedInput schema / properties / case_sensitive / maximum
      Removed value: -1
    • removedInput schema / properties / case_sensitive / minimum
      Removed value: -0
    • changedInput schema / properties / case_sensitive / type
      Previous value: -"integer"New value: +"boolean"
    • removedInput schema / properties / count_only / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / count_only / description
      Previous value: -"1 returns only match counts; limit is then ignored. 0 (default) returns hits."New value: +"true returns only match counts; limit is then ignored. false (default) returns hits."
    • removedInput schema / properties / count_only / maximum
      Removed value: -1
    • removedInput schema / properties / count_only / minimum
      Removed value: -0
    • changedInput schema / properties / count_only / type
      Previous value: -"integer"New value: +"boolean"
    • removedInput schema / properties / hybrid / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / hybrid / description
      Previous value: -"1 = tag hits with source/confidence; literal_content only."New value: +"true = tag hits with source/confidence; literal_content only."
    • removedInput schema / properties / hybrid / maximum
      Removed value: -1
    • removedInput schema / properties / hybrid / minimum
      Removed value: -0
    • changedInput schema / properties / hybrid / type
      Previous value: -"integer"New value: +"boolean"
    • removedInput schema / properties / include_hidden / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / include_hidden / description
      Previous value: -"1 = include hidden files (default); 0 = skip dotfiles. Secrets always excluded."New value: +"true = include hidden files (default); false = skip dotfiles. Secrets always excluded."
    • removedInput schema / properties / include_hidden / maximum
      Removed value: -1
    • removedInput schema / properties / include_hidden / minimum
      Removed value: -0
    • changedInput schema / properties / include_hidden / type
      Previous value: -"integer"New value: +"boolean"
    • changedInput schema / properties / kind / description
      Previous value: -"name substring | content (substring, or regex when regex=1) | declaration lines. Required unless `queries`/`files_hint` is set."New value: +"name substring | content (substring, or regex when regex=true) | declaration lines. Required unless `queries`/`files_hint` is set."
    • changedInput schema / properties / limit / description
      Previous value: -"Max hits returned (default and max 200; ignored when count_only=1)."New value: +"Max hits returned (default and max 200; ignored when count_only=true)."
    • removedInput schema / properties / queries / items / properties / must / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / queries / items / properties / must / description
      Previous value: -"1 = only lines containing this pattern count as hits (default 0)."New value: +"true = only lines containing this pattern count as hits (default false)."
    • removedInput schema / properties / queries / items / properties / must / maximum
      Removed value: -1
    • removedInput schema / properties / queries / items / properties / must / minimum
      Removed value: -0
    • changedInput schema / properties / queries / items / properties / must / type
      Previous value: -"integer"New value: +"boolean"
    • removedInput schema / properties / regex / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / regex / description
      Previous value: -"1 treats query as a regular expression for literal_content/definition (default 0 = plain substring)."New value: +"true treats query as a regular expression for literal_content/definition (default false = plain substring)."
    • removedInput schema / properties / regex / maximum
      Removed value: -1
    • removedInput schema / properties / regex / minimum
      Removed value: -0
    • changedInput schema / properties / regex / type
      Previous value: -"integer"New value: +"boolean"
    • removedInput schema / properties / whole_word / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "maximum": 1,
      -    "minimum": 0,
      -    "type": "integer"
      -  }
      -]
    • changedInput schema / properties / whole_word / description
      Previous value: -"1 = whole-word match only (rg -w / JS word boundaries) for literal_content and definition."New value: +"true = whole-word match only (rg -w / JS word boundaries) for literal_content and definition."
    • removedInput schema / properties / whole_word / maximum
      Removed value: -1
    • removedInput schema / properties / whole_word / minimum
      Removed value: -0
    • changedInput schema / properties / whole_word / type
      Previous value: -"integer"New value: +"boolean"
  2. Addedv4.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare readOnlyHint and openWorldHint, so the description adds real value: the 50000-file scan cutoff that explains why narrow relative_path matters, the no-match-is-ok semantics, and a full output field list including the `queries`-mode extras (score/matched, total_files/total_hits). It does not cover cost/latency expectations on large scans or how limit interacts with truncation beyond what the schema states.

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 modes, then Use-when/Avoid-when/Output in a predictable order, and every line contributes. The telegraphic shorthand ('(regex=true for regex)', '(must/weight)') is dense to the point of being slightly cryptic on a first read, but nothing is padding.

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 15-parameter tool with no output schema, the description supplies the return shape (hits[], complete, total_match_lines, files_matched, plus the queries-mode extras) and the empty-result case, so an agent knows how to interpret results. Combined with the 100%-covered schema and the read-only annotation, nothing essential is missing for correct invocation.

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 baseline is 3. The description repeats mode semantics already in the schema (regex=true, queries with must/weight) and only adds genuinely new meaning through the 50000-file scan note on relative_path; the remaining 14 parameters get no extra explanation here.

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?

Opens with a specific verb and enumerates the four searchable kinds (file_name, directory_name, literal_content, definition), then explains the alternate `queries` ranking mode. An agent can tell this apart from read_file/outline_symbol/symbol_references directly from the text without opening a schema.

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?

Explicit 'Use when' (locate code/strings/symbols before reading) and 'Avoid when' clauses that name concrete alternatives and the conditions selecting them: read_file when the path is known, outline_symbol for structure, symbol_references for usages, shell_run `where` for PATH executables. It also gives a scoping heuristic ('keep relative_path narrow').

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