Token efficiency
Three layers of work cut the upfront tool-description budget by ~35% (~3,300-3,500 tokens per default-mode session):
- Two new MCP Resources —
intervals-icu://event-categoriesandintervals-icu://custom-item-schemas— replace long enum lists and content-schema docs that previously sat inline in tool descriptions. - Disambiguating first-sentence rewrites on 9 confusable tools (activity-detail family, activity-search family, wellness query family, event-create family). Each first sentence now leads with the distinguishing access pattern: SUMMARY / per-LAP / RAW; LIGHT / FULL; RANGE / ONE; ONE new / MANY new / COPY existing.
- Long-tail trim across the remaining ~40 tools: removed redundant
Args:blocks (which duplicateAnnotatedstrings) and trivialReturns:blocks; tightened first sentences for tool-routing clarity. Net -400 lines across 13 modules; no behavior change.
Tool-selection accuracy
First-tool-call routing accuracy on Haiku 4.5: 28/35 (80%) → 30/35 (86%), measured by the new smoke-eval harness. Zero regressions across all 13 trimmed modules. The two wins come from the first-sentence rewrites — Haiku now picks icu_search_activities (LIGHT) by default and routes "per-lap breakdown" requests correctly to icu_get_activity_intervals.
New: smoke-eval harness
make smoke-eval drives the Anthropic API with the MCP server's in-process tool definitions and records which tool the model picks first for each of 35 routing-test cases. Pure routing test — never executes a tool, never touches the intervals.icu API (DRY_RUN = True guard, asserted at runtime). Costs ~$0.07 per run; not part of make test.
Used to validate this release and provides durable infrastructure for any future PR that touches tool descriptions. Requires only ANTHROPIC_API_KEY (in .env).
Fixed
- Histogram tools (
icu_get_hr_histogram,icu_get_power_histogram,icu_get_pace_histogram,icu_get_gap_histogram) previously crashed on any activity with real data — the API returns a bare{min, max, secs}array, not the wrapper object the old model expected. Replaced with an API-accurateBucketmodel and regression tests. - Tool docstring cross-references now use the registered
icu_*tool names instead of bare function names — defensive against stricter / smaller models.
Upgrading from v2.x
Two response-shape changes by SemVer policy. Both LLM-consumed and unlikely to affect typical MCP usage, but if you parse responses programmatically:
- Histogram tools now return
buckets(wasbins), each shaped{<metric>_range: {min_*, max_*}, time_seconds}. The previouscountfield is gone — the API only reports time-in-bucket. - Auto-metadata
fetched_atandquery_typeare removed from themetadatablock. SetINTERVALS_ICU_DEBUG_METADATA=trueto restore them for debugging.
Both changes save tokens on every response; opting back in (via the env var, for fetched_at/query_type) is single-flip.
Full Changelog: v2.0.0...v3.0.0