Skip to main content
Glama

Search

search

Retrieve cached files ranked by keyword relevance (BM25). Multi-word queries return matches with normalized scores and previews, helping you locate previously indexed content.

Instructions

Find cached files by keyword relevance (BM25 ranking).

Searches only files already in the cache — index them first with warm, which returns counts rather than content (thin results usually mean too few files are cached). Ranks by BM25 term relevance, so multi-word and keyword queries work well; matching is lexical, not embedding-based, so synonyms won't match a word that isn't present. Terms are OR'd — a word the corpus happens not to contain costs you ranking, not the whole result set. For an exact string or regex use grep; to pull more of the repo into the cache use batch_read. Returns matches with a normalized 0–1 relevance score (best match = 1.0) and a short preview. The cache is shared across projects, so a search with no directory ranks the current project only; name one to look elsewhere.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNoMaximum number of matches to return.
queryYesKeywords to rank by. Natural-language phrasing is fine, but ranking is on the individual words.
directoryNoRestrict matches to files under this directory. Defaults to the project root.
show_previewNoInclude a short preview line for each match.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.0
    • changedInput schema / properties / directory / description
      Previous value: -"Restrict matches to files under this directory."New value: +"Restrict matches to files under this directory. Defaults to\nthe project root."
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "cached_files": {
      -      "anyOf": [
      -        {
      -          "type": "integer"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Cached Files"
      -    },
      -    "count": {
      -      "anyOf": [
      -        {
      -          "type": "integer"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Count"
      -    },
      -    "directory": {
      -      "anyOf": [
      -        {
      -          "type": "string"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Directory"
      -    },
      -    "files_searched": {
      -      "anyOf": [
      -        {
      -          "type": "integer"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Files Searched"
      -    },
      -    "k": {
      -      "anyOf": [
      -        {
      -          "type": "integer"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "K"
      -    },
      -    "matches": {
      -      "anyOf": [
      -        {
      -          "items": {
      -            "properties": {
      -              "path": {
      -                "anyOf": [
      -                  {
      -                    "type": "string"
      -                  },
      -                  {
      -                    "type": "null"
      -                  }
      -                ],
      -                "default": null,
      -                "title": "Path"
      -              },
      -              "preview": {
      -                "anyOf": [
      -                  {
      -                    "type": "string"
      -                  },
      -                  {
      -                    "type": "null"
      -                  }
      -                ],
      -                "default": null,
      -                "title": "Preview"
      -              },
      -              "similarity": {
      -                "anyOf": [
      -                  {
      -                    "type": "number"
      -                  },
      -                  {
      -                    "type": "null"
      -                  }
      -                ],
      -                "default": null,
      -                "title": "Similarity"
      -              },
      -              "tokens": {
      -                "anyOf": [
      -                  {
      -                    "type": "integer"
      -                  },
      -                  {
      -                    "type": "null"
      -                  }
      -                ],
      -                "default": null,
      -                "title": "Tokens"
      -              },
      -              "truncated": {
      -                "anyOf": [
      -                  {
      -                    "type": "boolean"
      -                  },
      -                  {
      -                    "type": "null"
      -                  }
      -                ],
      -                "default": null,
      -                "title": "Truncated"
      -              }
      -            },
      -            "title": "SearchMatch",
      -            "type": "object"
      -          },
      -          "type": "array"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Matches"
      -    },
      -    "query": {
      -      "anyOf": [
      -        {
      -          "type": "string"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Query"
      -    },
      -    "show_preview": {
      -      "anyOf": [
      -        {
      -          "type": "boolean"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Show Preview"
      -    },
      -    "truncated": {
      -      "anyOf": [
      -        {
      -          "type": "boolean"
      -        },
      -        {
      -          "type": "null"
      -        }
      -      ],
      -      "default": null,
      -      "title": "Truncated"
      -    }
      -  },
      -  "title": "SearchResponse",
      -  "type": "object"
      -}New value: +null
  2. Changed4 schema fields changedv0.5.1
    • addedInput schema / properties / directory / description
      Added value: +"Restrict matches to files under this directory."
    • addedInput schema / properties / k / description
      Added value: +"Maximum number of matches to return."
    • addedInput schema / properties / query / description
      Added value: +"Keywords to rank by. Natural-language phrasing is fine, but\nranking is on the individual words."
    • addedInput schema / properties / show_preview / description
      Added value: +"Include a short preview line for each match."
  3. Addedv0.4.5

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: it states cache-only search, BM25 lexical ranking, OR semantics, synonyms not matching, normalized 0–1 scores, previews, and cross-project cache behavior. This is unusually rich behavioral disclosure 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and each subsequent sentence earns its place: prerequisites, ranking behavior, OR semantics, alternatives, return format, and scope. It is longer than average but dense with non-redundant information.

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 tool with no annotations and no output schema, the description explains the return format (matches with normalized score and preview), the prerequisite indexing step, and when to choose sibling tools. Nothing essential for correct invocation is missing.

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, but the description adds meaning beyond the schema: query terms are OR'd and ranked by individual words, and directory's scope is tied to the shared-cache project behavior. Most parameter details, however, are already present in 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 opening sentence states a specific verb and resource: 'Find cached files by keyword relevance (BM25 ranking).' This clearly distinguishes it from sibling tools like grep and batch_read, which are explicitly named later as alternatives.

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 gives concrete when-to-use guidance: use warm first to index files, use grep for exact strings/regex, and use batch_read to pull more repo into cache. It also explains the directory default behavior across projects, leaving little to inference.

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