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
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": "get_api_usage"
}
}Input 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; };