Skip to main content
Glama
NimbleBrainInc

IPInfo MCP Server

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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
  • 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")
  • 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
  • The @mcp.tool() decorator registers the get_account_info function as an MCP tool in the FastMCP server instance.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NimbleBrainInc/mcp-ipinfo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server