Skip to main content
Glama

getPublicIP

Retrieve your current public IP address to identify network connectivity, configure firewall rules, or troubleshoot remote access issues.

Instructions

Get public IP address using ip-api.com

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the getPublicIP tool logic by fetching the public IP from ip-api.com API.
    handler: async () => { try { const response = await fetch('http://ip-api.com/json/?fields=query'); const data = await response.json(); return { content: [{ type: 'text', text: JSON.stringify({ ip: data.query }, null, 2) }] }; } catch (error) { throw new Error(`Failed to get public IP: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
  • Input schema for getPublicIP tool, which requires no parameters.
    inputSchema: { type: 'object', properties: {} },
  • Registration of the getPublicIP tool within the networkTools object.
    getPublicIP: { name: 'getPublicIP', description: 'Get public IP address using ip-api.com', inputSchema: { type: 'object', properties: {} }, handler: async () => { try { const response = await fetch('http://ip-api.com/json/?fields=query'); const data = await response.json(); return { content: [{ type: 'text', text: JSON.stringify({ ip: data.query }, null, 2) }] }; } catch (error) { throw new Error(`Failed to get public IP: ${error instanceof Error ? error.message : 'Unknown error'}`); } } },
  • src/index.ts:28-35 (registration)
    The networkTools (containing getPublicIP) are included in the allTools registry used by the MCP server for listing and calling tools.
    const allTools: ToolKit = { ...systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };

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

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