Skip to content

get_store_metrics returns ~1.9 MB by default (every store object × ~30 days) — ~500k tokens, larger than any agent context; even days_back=1 is 346 KB #3903

Description

@erikdarlingdata

Summary

get_store_metrics returns ~1.9 MB by default on every production store — roughly 500 k tokens, more than any MCP client's context holds. Even days_back = 1 returns 346 KB (~90 k tokens), because the payload always lists every store object and the window only shortens each object's series. There is no object filter, object_kind filter, or top-N.

This is response size, distinct from #3898 (tool-definition size). The tool's own description is ~9 KB and contributes to #3898.

Measured (nightly 458, 2026-09-22)

store class default response
largest SQL store 1,935 KB
read-replica SQL store 1,937 KB
PostgreSQL-target store 1,920 KB

Composition of the default response (PostgreSQL-target store, 251 store objects):

key size
daily — one series per object, all 251 objects 1,744 KB (91 %)
objects — latest snapshot per object 167 KB
everything else (inventory, jobs, checkpointer, retention holds) ~9 KB
days_back total daily
1 346 KB 172 KB (500 points)
7 710 KB 536 KB (1,726 points)
default 1,920 KB 1,744 KB

Why it matters

The questions this tool exists for — what is driving growth, which job is outgrowing its cadence, is retention running, how much can the inventory see — are answered by the ~9 KB of summary blocks plus a handful of objects. The per-object series for all 251 objects is almost never what the caller wants, yet it is always what the caller pays for. An agent that calls this tool loses its context; a client with an output cap sees the payload truncated from the tail, which drops whichever blocks happen to serialize last.

Proposal

  1. Summary-first default: whole-store daily series, bytes_by_kind, inventory reconciliation, jobs, checkpointer, retention holds, and the top N objects by size and by growth (N ≈ 10).
  2. Opt-in detail: an object_name / object_kind filter that returns the full series for the objects asked about.
  3. A bounded page like the other list-shaped tools (the payload-contract census, Three PostgreSQL pages observe truncation off limit + 1 through one shared helper, the census sweeps the inference class instead of a roster, and four payload rules become facts and inventories, so three tools stop guessing truncation from a full page and four of the eleven payload rules stop being sentences (partial #3653) #3699, has the page-bounds helper).

Acceptance

  • Default get_store_metrics under ~50 KB on the largest production store.
  • Every question the description names still answerable, the per-object series via an explicit filter.

Activity

  1. erikdarlingdata commented on Sep 23, 2026

    @erikdarlingdata
    OwnerAuthor

    Closed by the watcher: delivered in PR #3942, merged to dev.

  2. added
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    and removed
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    on Sep 23, 2026
  3. erikdarlingdata commented on Sep 23, 2026

    @erikdarlingdata
    OwnerAuthor

    Measured live on DARLING01 (dev c5be29e): the default get_store_metrics payload is 19.9 KB (before: 1,245.7 KB). Latency is about 770 ms median, dominated by the unchanged latest read. #3934 (the index) is the follow-up for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions