get_usage_stats
Monitor Cursor Pro usage statistics and limits for AI services like Sonnet 4.5, Gemini, and GPT-5. Track API quotas and receive alerts when approaching subscription limits.
Instructions
Get current Cursor Pro usage statistics and limits
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:178-210 (handler)MCP tool handler for 'get_usage_stats'. Retrieves UsageStats from monitor and returns formatted markdown text response.private async handleGetUsageStats() { const stats = this.monitor.getUsageStats(); const content = ` # Cursor Pro Usage Statistics ## Subscription Tier: ${stats.quotas.tier.toUpperCase()} ## Current Usage (Monthly) - **Sonnet 4.5**: ${stats.limits.sonnet45Requests}/${stats.quotas.maxSonnet45Requests} (${stats.usagePercentages.sonnet45.toFixed(1)}%) - **Gemini**: ${stats.limits.geminiRequests}/${stats.quotas.maxGeminiRequests} (${stats.usagePercentages.gemini.toFixed(1)}%) - **GPT-5**: ${stats.limits.gpt5Requests}/${stats.quotas.maxGpt5Requests} (${stats.usagePercentages.gpt5.toFixed(1)}%) - **Total**: ${stats.limits.totalRequests}/${stats.quotas.maxTotalRequests} (${stats.usagePercentages.total.toFixed(1)}%) ## Remaining Requests (This Month) - **Sonnet 4.5**: ${stats.remaining.sonnet45} - **Gemini**: ${stats.remaining.gemini} - **GPT-5**: ${stats.remaining.gpt5} - **Total**: ${stats.remaining.total} ## Last Updated ${stats.limits.lastUpdated.toISOString()} `.trim(); return { content: [ { type: 'text', text: content, }, ], }; }
- src/index.ts:41-47 (registration)Registration of the 'get_usage_stats' tool in the ListTools response, including name, description, and input schema.name: 'get_usage_stats', description: 'Get current Cursor Pro usage statistics and limits', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:130-131 (handler)Dispatch handler in CallToolRequestSchema switch statement that routes to handleGetUsageStats.case 'get_usage_stats': return await this.handleGetUsageStats();
- src/index.ts:43-46 (schema)Input schema for the tool: empty object (no parameters required).inputSchema: { type: 'object', properties: {}, },
- src/cursorLimitsMonitor.ts:102-144 (helper)Core helper method that computes comprehensive UsageStats including limits, quotas, percentages, and remaining requests.public getUsageStats(): UsageStats { const usagePercentages = { sonnet45: this.calculatePercentage( this.limits.sonnet45Requests, this.quotas.maxSonnet45Requests ), gemini: this.calculatePercentage( this.limits.geminiRequests, this.quotas.maxGeminiRequests ), gpt5: this.calculatePercentage( this.limits.gpt5Requests, this.quotas.maxGpt5Requests ), total: this.calculatePercentage( this.limits.totalRequests, this.quotas.maxTotalRequests ), }; const remaining = { sonnet45: Math.max( 0, this.quotas.maxSonnet45Requests - this.limits.sonnet45Requests ), gemini: Math.max( 0, this.quotas.maxGeminiRequests - this.limits.geminiRequests ), gpt5: Math.max(0, this.quotas.maxGpt5Requests - this.limits.gpt5Requests), total: Math.max( 0, this.quotas.maxTotalRequests - this.limits.totalRequests ), }; return { limits: { ...this.limits }, quotas: { ...this.quotas }, usagePercentages, remaining, }; }