Skip to main content
Glama
mehmetfiskindal

Cursor Pro Limits MCP Server

get_service_usage

Check usage statistics for AI services (Sonnet 4.5, Gemini, GPT-5) to monitor API quotas and subscription limits in real-time.

Instructions

Get usage statistics for a specific service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesService to check usage for

Implementation Reference

  • The primary handler function for the 'get_service_usage' tool. It validates the input service parameter, fetches the usage data from the CursorLimitsMonitor, determines the status (OK/WARNING/CRITICAL), formats a detailed markdown response, and returns it.
      private async handleGetServiceUsage(args: { service: string }) {
        const { service } = args;
    
        if (!['sonnet45', 'gemini', 'gpt5', 'total'].includes(service)) {
          throw new Error(
            'Invalid service. Must be one of: sonnet45, gemini, gpt5, total'
          );
        }
    
        const usage = this.monitor.getServiceUsage(
          service as 'sonnet45' | 'gemini' | 'gpt5' | 'total'
        );
    
        const status = usage.isCritical
          ? '🔴 CRITICAL'
          : usage.isWarning
            ? '🟡 WARNING'
            : '🟢 OK';
    
        const content = `
    # ${service.toUpperCase()} Service Usage
    
    ## Status: ${status}
    
    - **Current**: ${usage.current}
    - **Maximum**: ${usage.max}
    - **Percentage**: ${usage.percentage.toFixed(1)}%
    - **Remaining**: ${usage.remaining}
    
    ${usage.isCritical ? '⚠️ This service is at or near its limit!' : ''}
    ${usage.isWarning ? '⚠️ This service is approaching its limit.' : ''}
        `.trim();
    
        return {
          content: [
            {
              type: 'text',
              text: content,
            },
          ],
        };
      }
  • Type definition for ServiceUsage, which represents the output structure returned by the tool handler and the getServiceUsage helper.
    export interface ServiceUsage {
      service: ServiceType;
      current: number;
      max: number;
      percentage: number;
      remaining: number;
      isWarning: boolean;
      isCritical: boolean;
    }
  • src/index.ts:48-62 (registration)
    Registration of the 'get_service_usage' tool in the ListTools response, including name, description, and JSON input schema for validation.
    {
      name: 'get_service_usage',
      description: 'Get usage statistics for a specific service',
      inputSchema: {
        type: 'object',
        properties: {
          service: {
            type: 'string',
            enum: ['sonnet45', 'gemini', 'gpt5', 'total'],
            description: 'Service to check usage for',
          },
        },
        required: ['service'],
      },
    },
  • Type definition for ServiceType, used in the input schema enum and ServiceUsage interface.
    export type ServiceType = 'sonnet45' | 'gemini' | 'gpt5' | 'total';
  • Helper method in CursorLimitsMonitor that computes detailed usage statistics for a specific service, including current usage, max quota, percentage, remaining, and warning/critical flags.
    public getServiceUsage(
      service: 'sonnet45' | 'gemini' | 'gpt5' | 'total'
    ): ServiceUsage {
      const stats = this.getUsageStats();
      const current = this.getCurrentUsage(service);
      const max = this.getMaxUsage(service);
      const percentage = stats.usagePercentages[service];
      const remaining = stats.remaining[service];
    
      return {
        service,
        current,
        max,
        percentage,
        remaining,
        isWarning: percentage >= 0.8,
        isCritical: percentage >= 0.95,
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mehmetfiskindal/cursor-pro-limits-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server