get_api_info
Retrieve your Shodan API plan details including available credits and usage limits to manage cybersecurity research queries.
Instructions
Get information about your API plan including credits and limits
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1654-1672 (handler)The handler function for the 'get_api_info' tool in the CallToolRequestSchema switch statement. It calls shodanClient.getApiInfo() and returns the formatted JSON response.case "get_api_info": { try { const apiInfo = await shodanClient.getApiInfo(); return { content: [{ type: "text", text: JSON.stringify(apiInfo, null, 2) }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Error getting API info: ${(error as Error).message}` ); } }
- src/index.ts:1072-1078 (registration)Registration of the 'get_api_info' tool in the ListToolsRequestSchema handler, defining its name, description, and empty input schema (no parameters required).name: "get_api_info", description: "Get information about your API plan including credits and limits", inputSchema: { type: "object", properties: {} } },
- src/index.ts:456-469 (helper)The core helper method in ShodanClient class that makes the API call to Shodan's /api-info endpoint to retrieve API plan information, handling errors appropriately.async getApiInfo(): Promise<any> { try { const response = await this.axiosInstance.get("/api-info"); return response.data; } catch (error: unknown) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Shodan API error: ${error.response?.data?.error || error.message}` ); } throw error; } }
- src/index.ts:1075-1078 (schema)The input schema for the 'get_api_info' tool, which is an empty object since no parameters are required.type: "object", properties: {} } },