Skip to main content
Glama

locus_retrieve

Retrieve local-file passages with BM25 or hybrid re-ranking, apply metadata and temporal filters, and get provenance-tagged results for explainable search.

Instructions

BM25 retrieval (SQLite FTS5) with an optional re-rank of the BM25 candidates by KG entity expansion, link walking, frontmatter structural matching, recency and link popularity (mode='hybrid', weighted RRF). Default mode is 'bm25'; passing as_of selects 'hybrid'. Deterministic. Each result carries a provenance tag (bm25 / kg / link:hopN / structural / recency / link_pop).

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": {
      "query": "<query>"
    },
    "name": "locus_retrieve"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNobm25 (default) or hybrid re-rank.
as_ofNoTemporal filter YYYY-MM-DD.
limitNo
queryYes
trackNoRecord hits in the hot-context bulletin (set false for a pure read).
intentNo
parentNoReturn the enclosing section or whole document of the matched chunks (parent-child retrieval); each result's `spans` cite the matched passages by character offset.
filtersNoRestrict results by source-document metadata. Keys: path / exclude_path (glob or list), type (str or list), tags (all of), tags_any (any of), date_from / date_to (YYYY-MM-DD on frontmatter `date`), as_of (in force on that date; honours `supersedes`), meta ({field: value} or {field: {op: value}}, ops eq ne in nin gt gte lt lte contains exists).
expansionNoLLM-free query expansion (RM3 pseudo-relevance feedback). Off by default.
use_linksNo
store_pathNo.locus
full_contentNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full behavioral burden and does substantial work: it declares the operation deterministic, discloses that every result carries a provenance tag with the enumerated tag vocabulary, and reveals a non-obvious cross-parameter behavior (passing as_of implicitly switches mode to hybrid). It does not cover side effects such as hit tracking, write behavior of store_path, or error/empty-result behavior.

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?

Two dense sentences, front-loaded with the retrieval mechanism and followed by the mode semantics and result format; every clause carries information and nothing is redundant padding.

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 12-parameter tool with a nested filters object, no output schema, and no annotations, the description supplies the core mechanics, the mode-selection rule, and the shape of returned provenance, which is most of what an agent needs to invoke it correctly. The gaps are the undefined secondary parameters and the absence of any sibling-routing guidance.

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 coverage is roughly 50% across 12 parameters (including a nested filters object), and the description adds real meaning for mode and the mode/as_of interaction plus the provenance tag format. However, several parameters with no schema description — query, limit, intent, use_links, store_path, full_content — get no explanation here either, so the description only partially compensates for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific retrieval mechanism (BM25 over SQLite FTS5) and its optional hybrid re-rank by KG entity expansion, link walking, structural matching, recency and link popularity, so an agent knows exactly what the tool does. It does not distinguish itself from sibling retrieval tools such as locus_multi_retrieve or locus_cluster_retrieve, leaving that differentiation to the agent.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than stated: the description explains that mode defaults to 'bm25' and that passing as_of selects 'hybrid', which hints at when each path applies. But there is no explicit statement of when to prefer this tool over the sibling retrieval tools, no prerequisites, and no guidance on when hybrid re-ranking is worth the cost.

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