getIpv4Info
Retrieve IPv4 details of the current device operating environment using this tool. Obtain essential network information to assess and manage connectivity.
Instructions
获取当前设备的 IPv4 信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:405-428 (handler)Handler for the 'getIpv4Info' tool. Filters network interfaces to extract IPv4 addresses, netmasks, and other details per interface, then returns as 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) }] };
- src/index.ts:100-107 (registration)Tool registration entry in the listTools response, defining name, description, and input schema (empty object, no parameters).{ name: "getIpv4Info", description: "获取当前设备的 IPv4 信息", inputSchema: { type: "object", properties: {}, required: [] }
- src/index.ts:103-106 (schema)Input schema for getIpv4Info tool, which expects no parameters.inputSchema: { type: "object", properties: {}, required: []