getVpnInfo
Retrieve VPN connection details for the current device to verify network configuration and security status.
Instructions
获取当前设备的 VPN 信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:478-499 (handler)The execution handler for the 'getVpnInfo' tool. It fetches all network interfaces using os.networkInterfaces(), identifies potential VPN interfaces by checking for names starting with 'tun' or 'ppp', extracts relevant details (address, netmask, family, internal), and returns them as a JSON-formatted text content block.case "getVpnInfo": { const networkInterfaces = os.networkInterfaces(); const vpnInterfaces: Record<string, any> = {}; for (const [interfaceName, interfaces = []] of Object.entries(networkInterfaces)) { // 检测常见的 VPN 接口名称(如 tun0, ppp0, etc) if (interfaceName.startsWith('tun') || interfaceName.startsWith('ppp')) { vpnInterfaces[interfaceName] = interfaces.map((info) => ({ address: info.address, netmask: info.netmask, family: info.family, internal: info.internal })); } } return { content: [{ type: "text", text: JSON.stringify(vpnInterfaces, null, 2) }] };
- src/index.ts:137-144 (registration)Registration of the 'getVpnInfo' tool in the list returned by the ListToolsRequestSchema handler, including its name, description, and input schema.name: "getVpnInfo", description: "获取当前设备的 VPN 信息", inputSchema: { type: "object", properties: {}, required: [] } },
- src/index.ts:139-143 (schema)Input schema for the 'getVpnInfo' tool, defining an empty object (no required parameters).inputSchema: { type: "object", properties: {}, required: [] }
- src/index.ts:790-790 (registration)Registration of the CallToolRequestSchema handler function, which routes tool calls to their respective switch case implementations, including 'getVpnInfo'.server.setRequestHandler(CallToolRequestSchema, handleCallToolRequest);