estimate_remaining_capacity
Calculate available usage capacity by estimating remaining tokens against daily or weekly limits for Claude Code sessions.
Instructions
Estimate remaining usage capacity for specified daily/weekly limits
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| daily_token_limit | No | Daily token limit for capacity estimation | |
| weekly_token_limit | No | Weekly token limit for capacity estimation |
Implementation Reference
- src/index.ts:287-318 (handler)The main handler logic for the 'estimate_remaining_capacity' tool. It retrieves the usage summary, calculates remaining tokens for daily and weekly limits based on input arguments, formats the result as markdown, and returns it.case 'estimate_remaining_capacity': { const summary = await this.telemetryService.getUsageSummary(); const dailyLimit = typeof args?.daily_token_limit === 'number' ? args.daily_token_limit : undefined; const weeklyLimit = typeof args?.weekly_token_limit === 'number' ? args.weekly_token_limit : undefined; let result = '## Remaining Capacity Estimation\n\n'; if (dailyLimit) { const remaining = Math.max(0, dailyLimit - summary.today.tokens); const percentage = (remaining / dailyLimit) * 100; result += `**Daily**: ${remaining.toLocaleString()} tokens remaining (${percentage.toFixed(1)}%)\n`; } if (weeklyLimit) { const remaining = Math.max(0, weeklyLimit - summary.thisWeek.tokens); const percentage = (remaining / weeklyLimit) * 100; result += `**Weekly**: ${remaining.toLocaleString()} tokens remaining (${percentage.toFixed(1)}%)\n`; } if (!dailyLimit && !weeklyLimit) { result += 'Please specify daily_token_limit and/or weekly_token_limit for capacity estimation.'; } return { content: [ { type: 'text', text: result, }, ], }; }
- src/index.ts:113-130 (registration)Registration of the 'estimate_remaining_capacity' tool in the ListTools response, including its name, description, and input schema definition.{ name: 'estimate_remaining_capacity', description: 'Estimate remaining usage capacity for specified daily/weekly limits', inputSchema: { type: 'object', properties: { daily_token_limit: { type: 'number', description: 'Daily token limit for capacity estimation', }, weekly_token_limit: { type: 'number', description: 'Weekly token limit for capacity estimation', }, }, required: [], }, },