Skip to content

Add per-tool-type cost breakdown (top-tools command)#26

Open
nandanadileep wants to merge 1 commit into
roeimichael:mainfrom
nandanadileep:feat/issue-7-top-tools
Open

Add per-tool-type cost breakdown (top-tools command)#26
nandanadileep wants to merge 1 commit into
roeimichael:mainfrom
nandanadileep:feat/issue-7-top-tools

Conversation

@nandanadileep

Copy link
Copy Markdown

Summary

Fixes #7 by adding aggregated per-tool-type token usage across the full stack:

  • get_tool_type_summary() in db/tasks.py — SQL aggregation by task_type (call count, total, average), excluding rows without estimated_tokens, with optional session_id filter and limit
  • GET /api/tool-summary — returns ranked tool rows plus overall total_tokens
  • context-analyzer-tool top-tools — Rich table showing rank, tool, calls, total tokens, avg/call, and share %
  • Tests for DB aggregation, session filter, and API endpoint
  • CHANGELOG and README updates

Test plan

  • uv run pytest tests/test_tool_summary.py -q (3 passed)
  • uv run ruff check on changed files
  • Start collector, run a few tool calls, then context-analyzer-tool top-tools
  • Optional: context-analyzer-tool top-tools --session <id> --limit 5

Made with Cursor

Expose aggregated per-tool-type token usage so users can see which
tools consume the most context overall, via SQL aggregation, API,
and a Rich CLI table.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-tool-type cost breakdown (top-tools command)

1 participant