anthropics / anthropics/claude-code-action

v1 accessing (MCP) tools despite `allowedTools` being empty?

オープン
#533 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug p1
主要言語
TypeScript
スター
8.9k
フォーク
2.1k
平均マージ
3日 9時間
マージ済み PR(30日)
10

説明

Since migrating to v1, I am unable to stop Claude from accessing MCP (and other) tools that it didn't seem to need with the previous beta action. I don't understand why it's trying to load 15 different tools since these tools didn't seem to be part of the beta action and yet the code reviews were being carried out fine.

These tools are also erroring with "this command requires approval". They also seem to utilize a ton of tokens.

I tried to do this through the usage of `allowedTools` and `disallowedTools` but it doesn't seem to work. Probably my syntax is wrong too for these.

This is what I have currently (that doesn't work):

```
claude_args: |
--system-prompt "Please refer to the project's CLAUDE.md file and .claude/agents/ documentation for:
- Architecture patterns and conventions to follow
- Testing patterns and requirements
- Code style guidelines and established practices
- Technology stack and framework usage
Pay special attention to violations of established patterns documented in these files."
--allowedTools ""
--disallowedTools "*"

# Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
use_sticky_comment: true
```

**Screenshots**
Here's a screenshot of a run:

Image

**Workflow yml file**
```
name: Claude Code Review

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]

jobs:
claude-review:
if: |
(github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude'))

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
Review this PR and provide ONLY specific, actionable feedback.

claude_args: |
--system-prompt "Please refer to the project's CLAUDE.md file and .claude/agents/ documentation for:
- Architecture patterns and conventions to follow
- Testing patterns and requirements
- Code style guidelines and established practices
- Technology stack and framework usage
Pay special attention to violations of established patterns documented in these files."
--allowedTools ""
--disallowedTools "*"

use_sticky_comment: true
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。