disyli/dsh-tool-call-stats

Per-process tool-call statistics: a tool_stats tool reporting per-tool call counts, error counts, and average durations.

Records every committed tool call in the current harness process and exposes a tool_stats tool, so the model (or you) can ask which tools were used, how often they failed, and where the time went. It wraps each dispatch via the tools/execute waterfall to capture start time, counts committed results per tool name and accumulates duration via the tools/result observer (with result.isError driving the error counter), and returns a canonical JSON array plus a plain-text table. This plugin counts tool-call dispatches — not tokens — and is deliberately distinct from token/cost trackers such as dsh-token-stats or dsh-usage-report.

Development & Runtime ★ 1 updated 2026-08-16
View on GitHub ↗

Install

dsh plugin --profile <name> add github:disyli/dsh-tool-call-stats

README install into a profile (replace <name>). pnpm >= 10 may ask you to allow the package before running install scripts (this package has none, but the prompt can still gate the git install) — follow the hint dsh prints and re-run add. A source-checkout overlay is also documented (a stats.cordis.yml patch pointing at index.js, run with pnpm dsh web --patch ./stats.cordis.yml). Verify the layer with dsh --profile <name> --dump-config (shows a # == dsh-tool-call-stats layer).

Compatibility

DSH plugin with no build step (~100 lines, three seams). Counters are process-local and in-memory — restarting dsh resets them and they are not shared across sessions. Calls aborted before the registry commits a result are not counted (their timing entries are garbage-collected after 10 s). Built against the dsh v0.1 developer preview, so upstream interfaces may still change.

Details

Recent updates

README documents the deliberate minimalism: three seams only, all state in memory with nothing persisted, and Cordis disposing both listeners plus the tool automatically on unload — no manual cleanup code.

FAQ

How do I install dsh-tool-call-stats?
Run: dsh plugin --profile <name> add github:disyli/dsh-tool-call-stats, then verify with dsh --profile <name> --dump-config (it shows a "# == dsh-tool-call-stats" layer) before starting the profile.
Does it measure tokens or cost?
No — it counts tool-call dispatches, errors and average duration. Token/cost tracking is a different plugin family (for example dsh-token-stats or dsh-usage-report).
Do the counters survive a restart?
No. All state is in-memory and process-local; restarting dsh resets the counters, and they are not shared across sessions.

More plugins in Development & Runtime

Browse more in Development & Runtime

Guides for Development & Runtime plugins