Skip to main content
Glama
JackXuyi

Current operating environment

getIpv4Info

Retrieve IPv4 address details for the current device to identify network configuration and connectivity status.

Instructions

获取当前设备的 IPv4 信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler implementation for getIpv4Info tool that retrieves IPv4 addresses from network interfaces using os.networkInterfaces(), filters for IPv4, and returns structured JSON.
    case "getIpv4Info": { const networkInterfaces = os.networkInterfaces(); const ipInfo: Record<string, { address: string; netmask: string; family: string; internal: boolean }[]> = {}; for (const [interfaceName, interfaces = []] of Object.entries(networkInterfaces)) { const ipv4Interfaces = interfaces .filter((info) => info.family === 'IPv4') .map((info) => ({ address: info.address, netmask: info.netmask, family: info.family, internal: info.internal })); if (ipv4Interfaces.length > 0) { ipInfo[interfaceName] = ipv4Interfaces; } } return { content: [{ type: "text", text: JSON.stringify(ipInfo, null, 2) }] }; }
  • Tool schema definition including name, description, and empty input schema for getIpv4Info in the tools list.
    { name: "getIpv4Info", description: "获取当前设备的 IPv4 信息", inputSchema: { type: "object", properties: {}, required: [] } },
  • src/index.ts:790-790 (registration)
    Registration of the general tool call handler (handleCallToolRequest) which contains the switch case for getIpv4Info.
    server.setRequestHandler(CallToolRequestSchema, handleCallToolRequest);
  • src/index.ts:787-787 (registration)
    Registration of the list tools handler which includes the schema for getIpv4Info.
    server.setRequestHandler(ListToolsRequestSchema, handleRequest);

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/JackXuyi/env-mcp'

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