所有工具

run_terminal_command

诊断与系统 · macOS · Windows

效果: 执行. 状态: 受限可用.

“受限可用”表示工具可能取决于版本、平台、权限、账户或配置,并不表示它在所有安装中都已启用。

macOS

用途

在用户的 Mac 上运行 shell 命令并返回其输出。始终处于启用状态。当 LMCP 处于只读模式时禁用。会拒绝危险命令(sudo、递归删除系统/主目录路径、格式化磁盘、关机/重启、将下载的脚本通过管道传入 shell、fork 炸弹、守护进程控制)。这是破坏性操作:会先预览命令——传入 confirm:true 才会实际运行。输出和运行时间均有上限。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构macOS
{
  "properties": {
    "command": {
      "description": "The shell command to run (a single command line, executed with /bin/zsh -lc).",
      "type": "string"
    },
    "confirm": {
      "description": "Must be true to actually run. Without it, a preview of the command is returned.",
      "type": "boolean"
    },
    "timeout_seconds": {
      "description": "Max seconds to run before it is terminated (default 20, max 60).",
      "type": "integer"
    },
    "working_dir": {
      "description": "Optional absolute working directory. Defaults to the user's home directory.",
      "type": "string"
    }
  },
  "required": [
    "command"
  ],
  "type": "object"
}

文档示例

run_terminal_command 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "command": "echo Hello from LMCP",
  "confirm": false
}

Windows

用途

在用户的计算机上运行 shell 命令。会拒绝危险命令(sudo/权限提升、递归删除系统或主目录路径、格式化磁盘、关机/重启、将下载的脚本通过管道传入 shell、fork 炸弹)。这是破坏性操作:会先预览命令——传入 confirm:true 才会实际运行。输出和运行时间均有上限。在 Windows 上,命令通过 `cmd /c` 运行;在其他系统上通过 `sh -c` 运行。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构Windows
{
  "properties": {
    "command": {
      "description": "The shell command to run (a single command line).",
      "type": "string"
    },
    "confirm": {
      "description": "Must be true to actually run. Without it, a preview of the command is returned.",
      "type": "boolean"
    },
    "timeout_seconds": {
      "description": "Max seconds to run before it is terminated (default 30, max 60).",
      "type": "integer"
    },
    "working_dir": {
      "description": "Optional absolute working directory. Defaults to the user's home directory.",
      "type": "string"
    }
  },
  "required": [
    "command"
  ],
  "type": "object"
}

文档示例

run_terminal_command 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "command": "echo Hello from LMCP",
  "confirm": false
}