Skip to main content
Glama

files_search

Searches files by full-text keywords and returns ranked matches with snippets; optionally bundles matched file bodies into prompt-ready context for related-file retrieval.

Instructions

Full-text (SQLite FTS5) keyword search across files. Default mode returns ranked matches with inline match_excerpt and title_highlight (no follow-up files_read needed for snippets) plus tags, est_tokens, size_bytes, content_class, and aggregate total_est_tokens. Pass include_bodies: true to instead get a single prompt-ready bundle: matched bodies concatenated into XML <document> blocks or markdown headers + fences (see format/max_tokens), capped at the token budget, files are added in rank order until the next would exceed it, the rest going to meta.skipped[]. Use include_bodies instead of files_search + N×files_read when you need several related files as one context blob. Read-only; no side effects, auth, or rate limits. Ordering: dictionary hits sort above everything else for the same query (dictionary-wins on conflict), then BM25 rank. FTS is tokenised: it WILL miss URLs, hyphenated terms, and partial substrings, fall back to files_regex_search for those. project_id: null searches only the KB; omit the field to span everything; tags[] requires ALL listed tags to match; kind narrows to one content class.

Input Schema

NameRequiredDescriptionDefault
kindNoFilter by content class. dictionary = authoritative KB (system IDs, mappings, glossaries), note = informational KB, journal = time-log, project = project file. Omit to see all classes with dictionary-first ordering.
tagsNoFilter by tags (all must match)
queryYesSearch query
formatNoBundle format when `include_bodies` is true. xml = Anthropic-recommended <document> tags (default); markdown = ## headers + fenced blocks. Ignored otherwise.
rerankNoWhen true, rerank search matches using local cross-encoder neural model and soft content-class arbitration. Defaults to kontexta.json search.rerank.enabled (or true if model available).
favoriteNoFilter by favorite status
max_tokensNoToken budget when `include_bodies` is true (default 12000). Files added in rank order until the next would exceed; remainder go to `meta.skipped[]`. Ignored otherwise.
project_idNoFilter by project ID. Pass null to search ONLY Knowledge Base files.
include_bodiesNoIf true, return a single prompt-ready bundle of matched bodies instead of a match list. Response shape changes to `{bundle, meta: {included, skipped, ...}}`. Default false.
check_sufficiencyNoWhen include_bodies is true, evaluate retrieval sufficiency with non-autoregressive decision model. Default true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv6.1.2

TDQS

A4.2/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden — and it does disclose ordering semantics (dictionary-wins on conflict, then BM25), truncation behavior (rank-order fill until budget, overflow to meta.skipped[]), and that FTS tokenisation will miss URLs and substrings. It also asserts 'read-only; no side effects, auth, or rate limits'. This exceeds the annotations bar but leaves the actual return field set and sufficiency-check behavior of check_sufficiency only lightly characterized.

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?

Purpose and default behavior are front-loaded in the first sentence, and every clause carries real information (mode switch, ordering, tokenisation caveat, filter semantics). It is however one dense wall of prose with no separation between the default-mode story, the bundle-mode story, and the filter notes, which makes it heavier to parse than it needs to be.

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 10-parameter tool with no output schema, the description supplies the missing contract: the default response shape (match_excerpt, title_highlight, total_est_tokens), the alternate shape ({bundle, meta:{included, skipped}}), defaults, and filtering semantics. An agent has enough to call it correctly and to choose between modes.

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; most description detail (tags all-match, max_tokens default 12000, format semantics) merely restates the schema. The one genuinely additive nuance is the project_id distinction — 'null searches only the KB; omit the field to span everything' — which the schema does not spell out. Marginal net gain.

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+resource+mechanism ('Full-text (SQLite FTS5) keyword search across files') and immediately distinguishes the default mode from the include_bodies mode. It also names the sibling to fall back to (files_regex_search), so an agent can differentiate without opening any 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 routing: use default mode for ranked snippets, use include_bodies 'instead of files_search + N×files_read when you need several related files as one context blob', and fall back to files_regex_search for URLs/hyphenated/partial substrings. Both the when and the alternatives are stated.

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