Skip to main content
Glama

get_ip_location

Retrieve geographic location data for any IP address to identify user regions or analyze network traffic origins.

Instructions

Get the location of an IP address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipAddressNoThe IP address to get the location of.

Implementation Reference

  • Handler logic for the 'get_ip_location' tool within the CallToolRequestSchema handler. It extracts the ipAddress from arguments, calls the helper, handles errors, and returns the result as formatted JSON text.
    if (request.params.name === "get_ip_location") { const input = request.params.arguments as { ipAddress: string }; const output = await ipfind.apiRequest.getIPLocation(input.ipAddress); if (!output) { throw new Error("Failed to fetch IP location."); } return { content: [ { type: "text", text: JSON.stringify(output, null, 2), }, ], }; }
  • Schema definition for the 'get_ip_location' tool, specifying the input as an object with 'ipAddress' string property.
    name: "get_ip_location", description: "Get the location of an IP address", inputSchema: { type: "object", properties: { ipAddress: { type: "string", description: "The IP address to get the location of.", }, }, }, },
  • Helper method in APIRequest class that makes the HTTP request to IPFind API for the given IP address location.
    async getIPLocation(ip: string): Promise<IPFindIPResponse> { return await this.makeRequest<IPFindIPResponse>( `/?auth=${this.apiKey}&ip=${ip}` ); }

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/ipfind/ipfind-mcp-server'

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