enquire-mcp API reference - v3.9.0-rc.4
    Preparing search index...

    Function contextPack

    • Token-budgeted vault context export — runs hybrid retrieval, gathers note bodies + backlinks + recent dailies, packs to a token budget, returns one ready-to-paste markdown blob.

      The MCP-native answer to Smart Connections' "Send to Smart Context" pattern, but works in any chat (Claude / Cursor / Codex / web UI) by producing a plain-text bundle. Saves the agent from orchestrating 5 separate tool calls.

      Budget enforcement: each note's body is truncated to ~50% of remaining budget so room remains for backlinks + dailies; oversize bodies get a […truncated…] marker. As a final defense-in-depth, the assembled bundle is hard-capped at budget_tokens × 4 chars and marked […budget cap reached…] if truncated. Top-3 included notes get 1-line backlink summaries when include_backlinks is true.

      Parameters

      • vault: Vault

        The vault.

      • args: ContextPackArgs

        ContextPackArgs. query required + non-empty.

      • ctx: { embedFile: string; ftsIndex: FtsIndex | null }

        Server-side context: ftsIndex (nullable) and embedFile (path may not exist) — same shape as searchHybrid.

      Returns Promise<ContextPackResult>

      A ContextPackResult with the packed bundle + meta.

      If query is empty / whitespace-only.

      const pack = await contextPack(
      vault,
      {
      query: "How do I tune the hybrid retrieval?",
      budget_tokens: 3000,
      include_backlinks: true,
      recent_dailies: 3
      },
      { ftsIndex, embedFile: "/path/to/vault.embed.db" }
      );
      console.log(pack.bundle); // ready to paste into any chat