get_api_usage
Check current API usage statistics for IP geolocation services to monitor query limits and track consumption.
Instructions
Get the usage of the API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/ipfind.ts:42-46 (handler)Core handler function that executes the HTTP request to retrieve API usage from the IPFind service.async getAPIUsage(): Promise<IPFindUsageResponse> { return await this.makeRequest<IPFindUsageResponse>( `/usage?auth=${this.apiKey}` ); }
- src/index.ts:117-132 (handler)MCP tool call handler that invokes the getAPIUsage implementation and returns the result as JSON text content.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/index.ts:68-75 (registration)Tool registration in the ListTools handler, defining name, description, and input schema (no parameters).{ name: "get_api_usage", description: "Get the usage of the API", inputSchema: { type: "object", properties: {}, }, },
- src/types.ts:21-25 (schema)TypeScript type definition for the output schema of the get_api_usage tool response.export type IPFindUsageResponse = { request_count: number; daily_request_limit: number; remaining: number; };