get_api_usage
Check current API usage statistics for IP geolocation services to monitor request limits and track consumption.
Instructions
Get the usage of the API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:117-132 (handler)MCP tool handler for 'get_api_usage': calls ipfind.apiRequest.getAPIUsage() and formats response as JSON text.if (request.params.name === "get_api_usage") { const output = await ipfind.apiRequest.getAPIUsage(); if (!output) { throw new Error("Failed to fetch API usage."); } return { content: [ { type: "text", text: JSON.stringify(output, null, 2), }, ], }; }
- src/types.ts:21-25 (schema)TypeScript type definition for the output schema of get_api_usage (IPFindUsageResponse).export type IPFindUsageResponse = { request_count: number; daily_request_limit: number; remaining: number; };
- src/index.ts:68-75 (registration)Tool registration in ListTools response: defines name, description, and empty input schema for get_api_usage.{ name: "get_api_usage", description: "Get the usage of the API", inputSchema: { type: "object", properties: {}, }, },
- src/ipfind.ts:42-46 (helper)Core implementation: makes HTTP request to IPFind API /usage endpoint using the API key.async getAPIUsage(): Promise<IPFindUsageResponse> { return await this.makeRequest<IPFindUsageResponse>( `/usage?auth=${this.apiKey}` ); }