Skip to main content
Glama

get_company_info

Retrieve company details including name, domain, and type associated with any IP address to identify network ownership and organizational information.

Instructions

Get company information for an IP address.

Args: ip: IP address to lookup

Returns: Company name, domain, and type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes

Implementation Reference

  • The primary handler function for the 'get_company_info' MCP tool. It is decorated with @mcp.tool() for registration and executes the tool logic by calling IPInfoClient.get_company(ip).
    @mcp.tool() async def get_company_info(ip: str, ctx: Context[Any, Any, Any]) -> CompanyResponse: """Get company information for an IP address. Args: ip: IP address to lookup Returns: Company name, domain, and type. """ client = get_client(ctx) try: return await client.get_company(ip) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
  • Pydantic BaseModel defining the output schema (CompanyResponse) for the get_company_info tool, including fields for name, domain, and type.
    class CompanyResponse(BaseModel): name: str = Field(..., description="Company name") domain: str = Field(..., description="Company domain") type: CompanyType = Field(..., description="Company type")
  • Supporting method in IPInfoClient that makes the HTTP request to IPInfo API's /{ip}/company endpoint and parses the response into CompanyResponse.
    async def get_company(self, ip: str) -> CompanyResponse: """Get company information for an IP.""" data = await self._request("GET", f"/{ip}/company") return CompanyResponse(**data)
  • Enum defining the possible company types used in the CompanyResponse schema for get_company_info.
    class CompanyType(str, Enum): ISP = "isp" BUSINESS = "business" EDUCATION = "education" HOSTING = "hosting" INACTIVE = "inactive"
  • Utility function to obtain or initialize the shared IPInfoClient instance, used by get_company_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

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