> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trae.cn/llms.txt
> Use this file to discover all available pages before exploring further.

TRAE CLI 在执行任务时，会通过调用不同的工具（如 Bash、Git 等）来完成具体操作。工具权限用于控制这些工具的可用范围，从而保障操作的安全性与可控性。
## 权限类型 {#8f8a3dbf}
工具权限类型如下：

* `allowed_tools`：允许使用的工具；
* `disallowed_tools`：禁用的工具；
* `ask_tools`：使用前需要用户确认的工具。

## 工具权限的优先级 {#389c919d}
工具权限的优先级从高到低为：`disallowed_tools` > `allowed_tools` > `ask_tools`。
此外，在 TRAE CLI 处理你的任务时，可能会让你确认工具权限，若你选择 “Yes, allow all tools during this session”，`disallowed_tools` 和 `ask_tools` 中的配置仍然生效。
## 默认放行的工具 {#3948fe5b}
默认放行的工具如下：
```Plain Text
文件获取：
Bash(cat:*)
Bash(find:*)
Bash(grep:*)
Bash(head:*)
Bash(ls:*)
Bash(rg:*)
Bash(tail:*)

文本处理：
Bash(awk:*)
Bash(cut:*)
Bash(diff:*)
Bash(sort:*)
Bash(uniq:*)
Bash(wc:*)

Git 的读操作：
Bash(git diff:*)
Bash(git log:*)
Bash(git show:*)
Bash(git status)

其它：
Bash(cd:*)
Bash(date)
Bash(echo:*)
Bash(env)
Bash(pwd)
Bash(which:*)
```

## 默认需要用户确认的工具 {#9fd3ea21}
以下工具在被使用前，默认需要用户的确认：
```Plain Text
Bash(rm -rf /)
Bash(rm -rf /*)
Bash(rm -rf ~)
Bash(rm -rf $HOME)
Bash(rm -rf %USERPROFILE%)
Bash(rm -rf /Users)
Bash(go clean -modcache)
Bash(go mod clean)
```

## 配置工具权限 {#c6553212}
你可以为 TRAE CLI 配置工具权限。权限可以仅在本次会话中生效或全局生效。
### 仅在当前会话中生效 {#a522dda9}
在启动 TRAE CLI 时，你可以通过 `--allowed-tool` 参数配置当前会话中被放行的工具，多个工具间使用逗号分隔。
例如：
```Bash
traecli --allowed-tool Bash,Edit,MultiEdit,Write
```

### 全局生效 {#bb59f722}
若你需要配置全局生效的工具权限，使用 `traecli config edit` 命令来编辑全局配置文件 trae_cli.yaml。
示例如下：
```YAML
allowed_tools:
    - Bash
    - Edit
    - MultiEdit
    - Write
    - Bash(cat:*)
    - Bash(git diff:*)
    # mcp tool 请参考如下配置:
    # - mcp__${server_name}__${tool_name}
    # 例如 mcp__larkMcp__contact_v3_user_batchGetId
disallowed_tools:
    - Bash(rm -rf /)
    - Bash(rm -rf *)
ask_tools:
    - Bash(rm:*)
    - Bash(go clean -modcache)
    - Bash(go mod clean)
```


