anthropics / anthropics/claude-code-action

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

Đang mở
#533 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug p1
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.