GraphMyAnything

Agent & developer guide

Load or record a time series once; later questions use stored history in a few hundred tokens instead of another research pass. Condensed copies ship as MCP resources usage-guide and chart-guide.

The five tools

ToolPurpose
trackUpsert one or many points on (metric, ts). Returns written (new timestamps) and replaced (updated timestamps).
forgetDelete a single ts, an inclusive from/to range (Unix seconds), or the whole metric with all: true plus confirm: true. metric is always required.
queryTerse stats (s.l, s.mn, s.tr, …) plus optional LTTB pts within token_budget. points: 0 | auto | N; also_chart omits pts for a follow-up chart.
insightPlain-English trend, MAD anomalies, naive linear forecast for metric + range.
chart640×320 SVG on disk (or hosted share URL when synced). type, theme, labels set chart rendering; range filters data. share:false skips public /c/<id> link.

When to track

Do track when

  • The user will ask again about this number or series.
  • The value is part of a time series (daily MRR, weight, fleet count).
  • Fetching it is slow, rate-limited, or expensive.
  • You already researched a public series once and want recall without repeating work.

Do not track when

  • One-off values with no future chart intent.
  • Secrets (API keys) or PII you would not write to a local debug log.
  • User wants a live reading every time — track only after fetch if they also want history.

Naming: health.weight.lb, stripe.mrr.usd, geo.plano_tx.population. Use tags for dimensions, not the primary unit string.

Upsert and corrections

Storage enforces UNIQUE(metric, ts). Same metric + same ts again replaces value/tags and increments replaced.

ActionResult
track with value onlyUpsert at current Unix time (seconds)
track with points[]Upsert per point; missing ts → current time
Same metric + same ts againReplace value/tags; replaced += 1
Responsewritten (new) + replaced (updated)

forget

Deletions are permanent on local SQLite and on hosted storage after sync — there is no undo.

ModeArguments
Single pointmetric + ts
Range (inclusive)metric + from + to (Unix seconds)
Entire metricmetric + all: true + confirm: true

forget entire metric

{
  "metric": "health.weight.lb",
  "all": true,
  "confirm": true
}

query vs insight vs chart

Decision

Need numbers only, token-shaped?  → query
Need spoken summary + anomalies?  → insight
Need a file the human opens?      → chart

query — default token_budget 500; points 0 | auto | N; also_chart omits pts before chart. chart defaults: type=line, theme=dark, labels=last. Efficient combo: query(..., also_chart: true) then chart(...).

Freshness

SituationGuidance
Historical analysisTrust stored data
What is MRR right now?Re-fetch source, then optionally track
Public series never trackedOne fetch + backfill track, then query/chart from store

Token cost guidance

  • Prefer query with points: 0 or also_chart over pasting large JSON in chat.
  • Set token_budget to match spare context (200–300 for dashboard answers).
  • chart returns metadata — local path or hosted url / embed_svg when synced.

Compare approaches in benchmarks/token-benchmark/.

More reading

Source on GitHub: casahome2000/graphmyanything / agent-guide.md