getAvailableNetworks
Retrieve a list of available networks on the current device, providing details about its operating environment for connectivity and network analysis.
Instructions
获取当前设备可用的网络信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:609-632 (handler)Handler implementation for the 'getAvailableNetworks' tool. Retrieves available network interfaces using os.networkInterfaces() and WiFi networks using si.wifiNetworks(), then returns formatted JSON.case "getAvailableNetworks": { const networkInterfaces = os.networkInterfaces(); const availableNetworks: Record<string, any> = {}; // 获取网络接口信息 for (const [interfaceName, interfaces = []] of Object.entries(networkInterfaces)) { availableNetworks[interfaceName] = interfaces.map((info) => ({ address: info.address, netmask: info.netmask, family: info.family, internal: info.internal })); } // 获取 Wi-Fi 网络信息 const wifiNetworks = await si.wifiNetworks(); return { content: [{ type: "text", text: JSON.stringify({ networkInterfaces: availableNetworks, wifiNetworks }, null, 2) }] }; }
- src/index.ts:181-189 (registration)Tool registration in the listTools response, including name, description, and empty input schema.{ name: "getAvailableNetworks", description: "获取当前设备可用的网络信息", inputSchema: { type: "object", properties: {}, required: [] } },
- src/index.ts:184-188 (schema)Input schema definition for the 'getAvailableNetworks' tool (empty object).inputSchema: { type: "object", properties: {}, required: [] }