get_ai_usage
Monitor AI token usage and calculate estimated costs for current MCP server sessions to track spending and optimize workflow efficiency.
Instructions
Get AI token usage and estimated cost for the current MCP server session.
Prerequisites: None — reads from the in-memory usage tracker. Returns zero values if no AI calls have been made yet.
Returns on success: { calls: number (total AI API calls made), inputTokens: number, outputTokens: number, estimatedCost: string (formatted as "$0.0000"), summary: string (human-readable breakdown) }
Error behavior: Never throws — returns a zero-value object with summary "No AI client initialized" if ANTHROPIC_API_KEY was not set when the server started.
Use this tool: to monitor token spend during a session involving analyze_design, design_doc, or compose calls, to estimate costs before running large batch operations, or to audit which tools are the heaviest AI consumers in a workflow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||