#飞书提示“当前会话的工具列表里没有直接的 shell/文件操作工具”
1 messages · Page 1 of 1 (latest)
🔍 查了一下,当前会话工具权限有限:
❌ 不可用:
shell/exec 命令(需要 pty:true)
sessions_spawn(创建子代理)
如何解决?
这个提示的意思很直接:当前这次会话里,模型“看不到”任何可以做 shell/文件操作的工具,所以它只能聊天,不能 exec/read/write/edit。
在 OpenClaw 里通常是被 **tool policy(工具白名单/配置文件/沙箱限制)**关掉了。按下面排查/修:
1) 先确认版本
先贴一下:
openclaw --version
(不同版本默认 tool profile 可能不一样。)
2) 检查你是不是把工具限制成了 messaging/minimal
如果你在 ~/.openclaw/openclaw.json 里设置过类似:
tools.profile: "messaging"或"minimal"- 或者设置了
tools.allow/tools.deny
那就可能把group:runtime(exec/process)和group:fs(read/write/edit)过滤掉了。
最简单的修法(推荐先这样验证):
{
tools: {
profile: "coding" // 自带 group:fs + group:runtime
}
}
如果你希望“默认还是 messaging,但额外允许 shell + 文件”,用这个:
{
tools: {
profile: "messaging",
allow: ["group:runtime", "group:fs"]
}
}
文档(含工具组列表):https://docs.openclaw.ai/tools (中文:/zh-CN/tools)
3) 如果你启用了沙箱(尤其是群聊/非 main 会话),还要放开 sandbox tools
很多人开了 agents.defaults.sandbox.mode: "non-main" 后,群聊会话会额外走 tools.sandbox.tools 再过滤一遍,导致你在主配置里放开了,群聊里还是看不到。
这时需要再加(或检查):
{
tools: {
sandbox: {
tools: {
allow: ["group:runtime", "group:fs"]
}
}
}
}
相关说明(过滤顺序/沙箱工具策略):https://docs.openclaw.ai/tools/multi-agent-sandbox-tools (中文:/zh-CN/tools/multi-agent-sandbox-tools)
4) 重启/刷新
改完后:
openclaw gateway restart
然后在飞书里新开一轮(必要时发 /new)再看工具列表是否出现 exec/read/write/edit。
如果你愿意,我可以直接帮你定位是哪一层把工具过滤没了:把下面两段贴出来(打码 token 即可):
- 你
openclaw.json里tools+agents.*.tools+agents.*.sandbox相关片段 - 以及你是在 DM 还是群聊里看到这个提示(群聊更可能是 sandbox/非 main 会话限制)
如果配置是这样表示什么?
"tools": {
"profile": "full",
"allow": [],
"web": {
"search": {
"enabled": false
},
"fetch": {
"enabled": true
}
}
},
你这个“权限有限”的结论基本就是:你现在跑的是 tools.profile=messaging/minimal(或被 allow/deny / sandbox 进一步过滤了),所以:
exec(shell)不在工具列表里(或只剩很受限的运行方式)sessions_spawn(子代理)也被过滤掉了
A) 先澄清:exec 并不是“必须 pty:true”
在 OpenClaw 里 pty:true 只是在你要跑交互式命令(top/htop/nano/vim 这类需要 TTY)时才需要。
普通命令(ls/cat/grep/curl/python …)不需要 pty。
所以真正的问题通常是:exec 这个工具本身没被允许出现在 tool list。
解决方案(最简单可用版)
把你的 ~/.openclaw/openclaw.json 里的 tool profile 调成能包含这些工具的配置,例如:
方案 1:直接用 coding profile(推荐先用这个验证)
coding 会包含:group:fs + group:runtime + group:sessions(因此也包含 sessions_spawn)
{
tools: {
profile: "coding"
}
}
方案 2:保留 messaging,但“额外”放开 exec + spawn
{
tools: {
profile: "messaging",
allow: ["group:runtime", "group:fs", "sessions_spawn"]
// 或者 allow: ["group:runtime", "group:fs", "group:sessions"]
}
}
改完后执行:
openclaw gateway restart
然后在飞书里(必要时)发一次 /new 让会话刷新工具列表。
文档(工具组/配置):https://docs.openclaw.ai/tools (中文:/zh-CN/tools)
如果你是在“群聊/非 main 会话 + 沙箱”里用,还要检查 sandbox tools
很多人开了 agents.defaults.sandbox.mode: "non-main" 后,群聊会话会再被 tools.sandbox.tools.* 过滤一次——这会导致你全局放开了,但群里依然没有 exec/sessions_spawn。
这时加上(或检查已有的):
{
tools: {
sandbox: {
tools: {
allow: ["group:runtime", "group:fs", "sessions_spawn"]
}
}
}
}
过滤顺序/沙箱说明:https://docs.openclaw.ai/tools/multi-agent-sandbox-tools (中文:/zh-CN/tools/multi-agent-sandbox-tools)
我需要你贴两样东西,才能精确告诉你是哪一层拦住了
openclaw --version- 你
openclaw.json里这几段的片段(打码 token 即可):
tools(含profile/allow/deny/sandbox)- 以及对应 agent 的
agents.defaults.tools/agents.list[].tools/agents.*.sandbox
贴出来我就能一眼指出:是 profile、allowlist,还是 sandbox policy 把 exec/sessions_spawn 砍掉了。
这段配置的关键在 tools.allow: []:
"tools": {
"profile": "full",
"allow": [],
"web": { ... }
}
这表示什么?
profile: "full"
- 表示“工具层面不做 profile 限制”(也就是 profile 本身 不会砍工具)。
- 但
allow: []会把工具直接“白名单清空”
tools.allow一旦存在,就等于进入“严格白名单模式”。
- 你这里给了一个 空白名单
[],效果就是:允许 0 个工具(所以你才会看到 exec / sessions_spawn 等都不可用)。
如果你的目标是“全开工具”,那就 不要写
tools.allow,或者把它改成包含你想要的工具。
web.search.enabled: false/web.fetch.enabled: true
- 这是 web 工具本身的开关:
web_search:被禁用web_fetch:启用
- 但注意:即使
fetch.enabled: true,如果你的tools.allow没把web_fetch放进白名单,它依然不会出现在工具列表里。
怎么改(常见两种)
方案 A:你真的想 “full”
把 allow 这一行删掉即可:
tools: {
profile: "full",
web: { search: { enabled: false }, fetch: { enabled: true } }
}
方案 B:你想用严格白名单,但要有 shell / 文件 / 子代理
例如:
tools: {
allow: ["group:runtime", "group:fs", "group:sessions", "group:web"]
}
(按需加/减;group:runtime 才会带来 exec,group:sessions 才会带来 sessions_spawn。)