getTerminalTypes
Retrieve all supported terminal types available in the current operating environment to identify compatible interfaces.
Instructions
获取系统上支持的所有终端类型
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:385-404 (handler)The handler function for the 'getTerminalTypes' tool. It attempts to read /etc/shells to get available shells, parses the names, filters comments and empty lines, and falls back to a default list if unsuccessful. Returns the list as JSON.case "getTerminalTypes": { let terminalTypes: string[] = []; try { // 读取 /etc/shells 文件获取支持的终端类型 const shells = execSync('cat /etc/shells').toString().split('\n'); terminalTypes = shells .filter((shell) => shell.trim() && !shell.startsWith('#')) // 过滤空行和注释 .map((shell) => shell.split('/').pop() || ''); // 提取 shell 名称 } catch (error) { // 如果读取失败,返回默认的终端类型 terminalTypes = ['bash', 'cmd', 'powershell', 'zsh', 'fish', 'sh', 'ksh', 'csh']; } return { content: [{ type: "text", text: JSON.stringify({ terminalTypes }, null, 2) }] }; }
- src/index.ts:91-99 (schema)The tool schema definition for 'getTerminalTypes', including name, description, and empty input schema (no parameters required).{ name: "getTerminalTypes", description: "获取系统上支持的所有终端类型", inputSchema: { type: "object", properties: {}, required: [] } },
- src/index.ts:25-282 (registration)The handleRequest function returns the list of available tools, registering 'getTerminalTypes' in the MCP listTools response.export const handleRequest = async () => { return { tools: [ { name: "getPlatformInfo", description: "获取当前系统的平台信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getMemoryInfo", description: "获取当前系统的内存信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getCpuInfo", description: "获取当前系统的 CPU 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getNetworkInfo", description: "获取当前系统的网络信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getUserInfo", description: "获取当前系统的用户信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getCpuUsage", description: "获取当前平台的 CPU 占用率", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getDiskUsage", description: "获取当前平台的硬盘使用率", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getTerminalTypes", description: "获取系统上支持的所有终端类型", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getIpv4Info", description: "获取当前设备的 IPv4 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getIpv6Info", description: "获取当前设备的 IPv6 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getProxyInfo", description: "获取当前网络的所有代理信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getHardwareInfo", description: "获取当前设备的硬件信息,包括生产日期等", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getVpnInfo", description: "获取当前设备的 VPN 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getInstalledApps", description: "获取当前设备已安装的应用信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getWifiInfo", description: "获取当前设备的 Wi-Fi 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getAppSchemas", description: "获取当前设备所有注册唤醒的 App Schema 信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getTimezone", description: "获取当前设备的时区信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getAvailableNetworks", description: "获取当前设备可用的网络信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getBatteryInfo", description: "获取当前设备的电池信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getGraphicsInfo", description: "获取当前设备的显卡信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getProcesses", description: "获取当前设备的进程信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getBluetoothInfo", description: "获取当前设备的蓝牙信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getAudioInfo", description: "获取当前设备的音频设备信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getUsbInfo", description: "获取当前设备的 USB 设备信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getPrinterInfo", description: "获取当前设备的打印机信息", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getSshPublicKey", description: "获取当前用户的 SSH 公钥", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getDockerInfo", description: "获取当前设备的 Docker 信息,若未安装则返回空", inputSchema: { type: "object", properties: {}, required: [] } }, { name: "getNodeInfo", description: "获取当前设备安装的 Node.js 版本信息", inputSchema: { type: "object", properties: {}, required: [] } } ] }; };
- src/index.ts:787-790 (registration)Server request handlers are set for ListToolsRequestSchema and CallToolRequestSchema, enabling the tool listing and execution including getTerminalTypes.server.setRequestHandler(ListToolsRequestSchema, handleRequest); // 处理工具调用 server.setRequestHandler(CallToolRequestSchema, handleCallToolRequest);