getAvailableNetworks
Retrieve available network connections and their details for the current device to identify connectivity options and troubleshoot network issues.
Instructions
获取当前设备可用的网络信息
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "getAvailableNetworks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:609-632 (handler)Handler for the 'getAvailableNetworks' tool. Retrieves active network interfaces and available WiFi networks using os.networkInterfaces() and si.wifiNetworks(), formats them, and returns as JSON response.
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)Registration of the 'getAvailableNetworks' tool in the list of available tools, including its name, description, and input schema (no parameters required).
{ name: "getAvailableNetworks", description: "获取当前设备可用的网络信息", inputSchema: { type: "object", properties: {}, required: [] } },