anthropics / anthropics/claude-code-action

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

Ouverte
#533 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug p1
Langage dominant
TypeScript
Étoiles
8.9k
Forks
2.1k
Merge moyen
3 j 9 h
PR mergées (30 j)
10

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.