getTerminalTypes
Retrieve a list of all supported terminal types on the system to ensure compatibility and configure settings in the current operating environment.
Instructions
获取系统上支持的所有终端类型
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:385-404 (handler)Handler function for getTerminalTypes tool: reads /etc/shells to list available terminal shells, parses names, falls back to a default list if failed, returns 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 (registration)Tool registration in the listTools array: defines name, description, and empty input schema for getTerminalTypes.{ name: "getTerminalTypes", description: "获取系统上支持的所有终端类型", inputSchema: { type: "object", properties: {}, required: [] } },
- src/index.ts:94-98 (schema)Input schema definition: empty object (no parameters required).inputSchema: { type: "object", properties: {}, required: [] }