Skip to main content
Glama

Retrieve

redctx_retrieve
Read-onlyIdempotent

Rank redacted passages by distinct query-word matches and BM25 relevance to return the best hits for topic or natural-language lookups across local project files.

Instructions

Rank redacted passages (up to 24 lines each) by how many distinct query words they contain, then by BM25 relevance, and return the best as --- @p_<id> <redacted path> lines S-E score=<n> --- headers followed by the passage text (for documents, lines of the extracted Markdown). Use it for topic or natural-language lookups when you don't know the exact wording; use redctx_search for an exact string or regex with context lines. Matching is case-insensitive on whole words over redacted text, with no stemming, embeddings or persistent index, so each call rescans the files. Only complete passages that fit max_chars are returned, with a [TRUNCATED: ...] note when more matched; the call fails when the scope holds more than 80 readable files or takes over 30 s, so pass paths or glob on larger roots.

Input Schema

NameRequiredDescriptionDefault
globNoShell-style patterns matched against each file's root-relative path, for example `*.md` or `notes/*.txt`; a file is kept if it matches any pattern. `*` also matches `/`, so `*.md` matches at every depth. Default `[]` means no filter. Applied within `paths`.
pathsNoFiles or directories to include: root-relative paths or `@p_<id>` references from earlier output. Directories are walked recursively, skipping excluded, protected, symlinked and binary files. Default `[]` means the whole root. With `glob`, only files under these paths that also match a glob are used.
queryYesWords describing what you are looking for, for example `retention policy exceptions`. Common stop words are ignored; 1 to 64 distinct searchable words are required. A placeholder counts as one word.
max_charsNoCharacter budget for the whole response; passages that would not fit completely are left out. Default 12000.
max_resultsNoMaximum passages to return. Default 8.

Output Schema

NameRequiredDescriptionDefault
textYesThe tool output, identical to the text content block and already redacted: sensitive values appear as deterministic `[CATEGORY_<hex>]` placeholders (forms declared as aliases of one entity share its hex and add a form suffix, `[CATEGORY_<hex>.<form>]`) and files as `@p_<id>` references. When the result has `isError: true`, this is a fixed error message instead, such as a limit error or the notice that context access is blocked until the operator repairs the local redaction config.
receiptYesRedaction statistics for this call only; never contains original values.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.10.0
    • addedInput schema / properties / glob / description
      Added value: +"Shell-style patterns matched against each file's root-relative path, for example `*.md` or `notes/*.txt`; a file is kept if it matches any pattern. `*` also matches `/`, so `*.md` matches at every depth. Default `[]` means no filter. Applied within `paths`."
    • addedInput schema / properties / max_chars / description
      Added value: +"Character budget for the whole response; passages that would not fit completely are left out. Default 12000."
    • addedInput schema / properties / max_results / description
      Added value: +"Maximum passages to return. Default 8."
    • addedInput schema / properties / paths / description
      Added value: +"Files or directories to include: root-relative paths or `@p_<id>` references from earlier output. Directories are walked recursively, skipping excluded, protected, symlinked and binary files. Default `[]` means the whole root. With `glob`, only files under these paths that also match a glob are used."
    • addedInput schema / properties / query / description
      Added value: +"Words describing what you are looking for, for example `retention policy exceptions`. Common stop words are ignored; 1 to 64 distinct searchable words are required. A placeholder counts as one word."
    • addedOutput schema / description
      Added value: +"Structured copy of every tool result: the output text plus a receipt of what redaction did."
    • addedOutput schema / properties / receipt / description
      Added value: +"Redaction statistics for this call only; never contains original values."
    • addedOutput schema / properties / receipt / properties / counts_by_category / description
      Added value: +"Placeholders substituted while producing this result (content and paths), keyed by category such as `PERSON`, `EMAIL` or `SECRET`; categories with none are omitted."
    • addedOutput schema / properties / receipt / properties / detector_profile / description
      Added value: +"Active built-in detector profile: `default`, or `extended`, which adds more identifier types and prompt-injection markers."
    • addedOutput schema / properties / receipt / properties / detectors
      Added value: +{
      +  "description": "Present only when the server runs additional local detectors: one entry per detector, in load order.",
      +  "items": {
      +    "properties": {
      +      "name": {
      +        "description": "Detector name.",
      +        "type": "string"
      +      },
      +      "nominated": {
      +        "description": "Distinct values this detector nominated during the call; every occurrence of each is redacted.",
      +        "type": "integer"
      +      },
      +      "positional": {
      +        "description": "Nominated spans redacted only at their own position, because they were too long or exceeded the per-text value budget.",
      +        "type": "integer"
      +      },
      +      "version": {
      +        "description": "Detector version string.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "version",
      +      "nominated",
      +      "positional"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / text / description
      Added value: +"The tool output, identical to the text content block and already redacted: sensitive values appear as deterministic `[CATEGORY_<hex>]` placeholders (forms declared as aliases of one entity share its hex and add a form suffix, `[CATEGORY_<hex>.<form>]`) and files as `@p_<id>` references. When the result has `isError: true`, this is a fixed error message instead, such as a limit error or the notice that context access is blocked until the operator repairs the local redaction config."
  2. Addedv0.8.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: case-insensitive whole-word matching, no stemming/embeddings/persistent index, per-call rescan, completeness rule for passages, `[TRUNCATED: ...]` marker, 80-file scope cap and 30 s timeout failure modes.

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 ranking and output format before alternatives and limits, and every sentence carries information. It is dense and clause-heavy in places, and restates the output header format despite an output schema existing, which slightly dilutes efficiency.

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 search tool with a rich output schema and full annotation coverage, the description still covers matching semantics, output shape, truncation, scope/timeout failure modes and sibling routing. Nothing needed to invoke it correctly 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 real behavioral meaning for `max_chars` (only wholly-fitting passages returned, truncation note) and for `paths`/`glob` (use them to stay under the file/scope limits). It stays silent on `max_results` and query word limits, already covered by 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?

States a specific verb and resource (rank redacted passages by distinct query-word matches, then BM25) and names the exact sibling it is not: `redctx_search` for exact string/regex. An agent can distinguish these two without opening either 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 when-to-use ("topic or natural-language lookups when you don't know the exact wording"), the alternative and its selecting condition (`redctx_search` for exact strings/regex), and an operational prerequisite ("pass `paths` or `glob` on larger roots").

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