getUsage
Retrieve API usage statistics to monitor your random data generation quota and track consumption patterns.
Instructions
Get API usage statistics
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "getUsage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:434-444 (handler)The MCP server handler for the 'getUsage' tool. It calls RandomOrgClient.getUsage() and returns the result formatted as JSON text content.
private async handleGetUsage(args: any) { const result = await this.randomOrgClient.getUsage(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } - src/server.ts:255-262 (registration)Registration of the 'getUsage' tool in the ListTools response, including name, description, and empty input schema.
{ name: 'getUsage', description: 'Get API usage statistics', inputSchema: { type: 'object', properties: {}, }, }, - src/types.ts:103-110 (schema)TypeScript interface defining the structure of the UsageResult returned by the Random.org API 'getUsage' endpoint.
export interface UsageResult { status: string; creationTime: string; bitsLeft: number; requestsLeft: number; totalBits: number; totalRequests: number; } - src/randomOrgClient.ts:118-120 (helper)Helper method in RandomOrgClient that makes the actual API request to Random.org's 'getUsage' endpoint using makeRequest.
async getUsage(): Promise<UsageResult> { return this.makeRequest<UsageResult>('getUsage', {}); }