-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Describe the bug
When using claude_args with --allowedTools that includes WebSearch and WebFetch, these tools are still disabled by default through the DISALLOWED_TOOLS environment variable.
The --allowedTools parameter in claude_args is not reflected in the mode's allowed tools list during prompt creation, causing the default disabling behavior to take precedence. This prevents Claude from using web search and fetch capabilities even when explicitly allowed.
To Reproduce
Steps to reproduce the behavior:
- Create a GitHub Actions workflow with
claude_argscontaining--allowedToolsthat includesWebFetchandWebSearch - Trigger the action with a comment containing
@claudeand request it to search the web or fetch a URL - Check the execution logs
- See error: Tools are rejected because
DISALLOWED_TOOLS: WebSearch,WebFetchis set
Expected behavior
Since WebFetch and WebSearch are explicitly included in --allowedTools, they should be available for Claude to use during execution. The --allowedTools parameter should override the default disabling behavior for these tools.
Screenshots
Workflow yml file
- name: ***
uses: anthropics/claude-code-action@v1
with:
use_bedrock: "true"
track_progress: true
github_token: ${{ steps.app-token.outputs.token }}
claude_args: |
--model sonnet
--mcp-config .mcp.json
--allowedTools Task,Edit,Read,WebFetch,WebSearch,Glob,Grep,SlashCommand,mcp__github_comment__update_claude_comment,mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)
--disallowedTools ""
API Provider
[ ] Anthropic First-Party API (default)
[x] AWS Bedrock
[ ] GCP Vertex
Additional context
Root Cause Analysis
The issue occurs in src/create-prompt/index.ts in the createPrompt function:
-
Mode's getAllowedTools() returns empty array:
Both Tag mode (src/modes/tag/index.ts) and Agent mode (src/modes/agent/index.ts) implementgetAllowedTools()to return an empty array:getAllowedTools() { return []; }
-
buildDisallowedToolsString applies default disabling:
Insrc/create-prompt/index.ts, thebuildDisallowedToolsStringfunction:export function buildDisallowedToolsString( customDisallowedTools?: string[], allowedTools?: string[], ): string { // Tag mode: Disable WebSearch and WebFetch by default for security let disallowedTools = ["WebSearch", "WebFetch"]; // If user has explicitly allowed some default disallowed tools, remove them if (allowedTools && allowedTools.length > 0) { disallowedTools = disallowedTools.filter( (tool) => !allowedTools.includes(tool), ); } // ... }
-
createPrompt uses mode.getAllowedTools():
const modeAllowedTools = mode.getAllowedTools(); // Returns [] const modeDisallowedTools = mode.getDisallowedTools(); const allDisallowedTools = buildDisallowedToolsString( modeDisallowedTools, modeAllowedTools, // Empty array, so WebSearch/WebFetch remain disabled ); core.exportVariable("DISALLOWED_TOOLS", allDisallowedTools); // Sets "WebSearch,WebFetch"
-
parseAllowedTools is not connected to mode.getAllowedTools():
While Agent mode hasparseAllowedTools()function insrc/modes/agent/parse-tools.tsthat can parse--allowedToolsfromclaude_args, this parsed value is:- Used only in
prepareMcpConfig() - Not returned by
mode.getAllowedTools() - Not available during the
buildDisallowedToolsString()call
- Used only in