Type: concept
Confidence: 0.80
Created: 2026-04-25
Updated: 2026-04-25
Tags: permissionssecuritytoolsAI工程

allowedTools

概述

allowedToolsClaude Code 中的工具白名单配置,用于定义哪些工具可以自动执行而无需用户确认,提高工作效率的同时保证安全性。

关键内容

  1. 白名单机制
  2. 权限决策流程中,查询 allowedTools 白名单
  3. 白名单中的工具可自动允许执行,无需用户确认
  4. 未在白名单中的工具需用户手动确认

  5. 配置格式

  6. 支持具体命令(如 "Bash(git status)")
  7. 支持通配符模式(如 "Bash(git diff)"、"mcp__github__")
  8. 按工具类型和参数进行精细控制

  9. 配置示例{ "allowedTools": [ "Bash(git status)", "Bash(git diff*)", "Bash(npm test)", "Bash(npm run lint)", "Edit", "View", "mcp__github__list_issues", "mcp__github__*" ] }

  10. 安全考虑

  11. 按工具细粒度控制,避免权限过度
  12. 可以通过通配符批量配置相关工具
  13. 需要定期审查和更新白名单内容

来源

相关