Skip to main content
Glama

files.search

Find relevant files with full-text keyword search, get ranked matches with excerpts, or combine matched bodies into a single token-budgeted context bundle.

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

TableJSON 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.
favoriteNoFilter by favorite status
max_tokensNoToken budget when `include_bodies` is true (default 50000). 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv5.0.0
    • addedInput schema / properties / format
      Added value: +{
      +  "description": "Bundle format when `include_bodies` is true. xml = Anthropic-recommended <document> tags (default); markdown = ## headers + fenced blocks. Ignored otherwise.",
      +  "enum": [
      +    "xml",
      +    "markdown"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / include_bodies
      Added value: +{
      +  "description": "If 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.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / max_tokens
      Added value: +{
      +  "description": "Token budget when `include_bodies` is true (default 50000). Files added in rank order until the next would exceed; remainder go to `meta.skipped[]`. Ignored otherwise.",
      +  "exclusiveMinimum": 0,
      +  "type": "integer"
      +}
  2. Addedv4.7.2

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries full burden. It discloses read-only nature, no side effects, auth, or rate limits; explains ordering (dictionary-wins then BM25); describes token budget capping and skipped files; and notes FTS tokenization limitations. This is thorough and honest.

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?

Although dense, every sentence contributes critical information. Key facts are front-loaded (default behavior and main mode), followed by alternatives and edge cases. No fluff or repetition; the length is justified by the tool's complexity.

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?

The description fully covers all 8 parameters, explains the two output shapes (match list vs bundle with meta), describes the return fields and ordering, and provides limitations and fallbacks. Given no output schema, it is remarkably complete for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds meaning beyond the schema: include_bodies changes response shape, format has a default and is ignored otherwise, max_tokens governs the ranking-based cutoff, project_id null vs omit semantics, and tags require all match. This greatly assists correct invocation.

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 description clearly states the tool performs full-text keyword search across files, and distinguishes it from sibling files.regex_search by noting FTS limitations. It also explains the two modes (default match list vs include_bodies bundle), so an agent knows exactly what it does.

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?

Provides explicit guidance: use include_bodies instead of files.search + N×files.read for multiple related files as one context blob, and fall back to files.regex_search for URLs, hyphenated terms, and partial substrings. This leaves no ambiguity about when to choose this tool over alternatives.

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