Skip to main content
Glama

getPublicIP

Retrieve your public IP address using ip-api.com for network diagnostics, system monitoring, or IP geolocation tasks within the Toolkit MCP Server environment.

Instructions

Get public IP address using ip-api.com

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches the public IP address from ip-api.com API and returns it as JSON.
    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 the getPublicIP tool, which requires no parameters.
    inputSchema: { type: 'object', properties: {} },
  • Definition and local registration of the getPublicIP tool within the networkTools export.
    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)
    Global registration of networkTools (including getPublicIP) into allTools, which is used by the MCP server for tool listing and execution.
    const allTools: ToolKit = { ...systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };

Other Tools

Related Tools

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