get_account_info
Retrieve IPInfo account details including API usage limits and available features to monitor your service quota and capabilities.
Instructions
Get IPInfo account information and API limits.
Returns: Account information including API limits and available features.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_ipinfo/server.py:72-84 (handler)The main execution logic for the get_account_info tool. It retrieves the IPInfo client and calls get_me() to fetch account information, handling errors appropriately.@mcp.tool() async def get_account_info(ctx: Context[Any, Any, Any]) -> MeResponse: """Get IPInfo account information and API limits. Returns: Account information including API limits and available features. """ client = get_client(ctx) try: return await client.get_me() except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
- src/mcp_ipinfo/api_models.py:96-100 (schema)Pydantic model defining the output schema for the get_account_info tool response, including token, request limits, and features.class MeResponse(BaseModel): token: str = Field(..., description="API token") requests: dict[str, int] = Field(..., description="Request limits and usage") features: dict[str, Any] = Field(..., description="Available features")
- src/mcp_ipinfo/server.py:29-38 (helper)Shared helper function to lazily initialize and return the IPInfoClient instance used by get_account_info and other tools.def get_client(ctx: Context[Any, Any, Any]) -> IPInfoClient: """Get or create the API client instance.""" global _client if _client is None: api_token = os.environ.get("IPINFO_API_TOKEN") if not api_token: ctx.warning("IPINFO_API_TOKEN is not set - some features may be limited") _client = IPInfoClient(api_token=api_token) return _client
- src/mcp_ipinfo/server.py:72-72 (registration)The @mcp.tool() decorator registers the get_account_info function as an MCP tool in the FastMCP server instance.@mcp.tool()