[6.x]: AI tool-calling check fails with a 400 on Anthropic, so Ask AI can't use Claude models
Maintainers usually reply within 1 day
@riasvdv is already working on this.
Since Nov 3, 2026.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 78/100
Research direction
The failing check is the anonymous tool in src/Ai/Agents/ToolCallingProbe.php around line 34, which has no name() method, so laravel/ai falls back to a class_basename that Anthropic rejects. Start by reading that file and comparing it with the other Craft assistant tools that do define name(). Done when the probe declares a name() such as get_verification_code and the tool-calling check passes against claude-sonnet-5-5.
Written by the indexing model from the issue text.
Description
What happened?
Steps to reproduce
- Add an Anthropic provider to
config/ai.php(the stocklaravel/aiconfig has one) and setANTHROPIC_API_KEY. - In Settings → Extend → Connections, set the default text provider to
anthropicand the model toclaude-sonnet-5-5. - Save.
Expected behavior
Craft confirms the model supports tool calling, and the AI assistant task becomes available.
Actual behavior
The check fails, and the AI assistant task is reported as unavailable:
Craft couldn’t check whether the claude-sonnet-5-5 model on the anthropic provider supports tool calling, which AI assistant needs: HTTP request returned status code 400: {"type":"error","error":{"type":"invalid_request_error","message":"tools.0.custom.name: String should match pattern '^[a (truncated...)
Cause
The test tool in src/Ai/Agents/ToolCallingProbe.php:34 is an anonymous class without a name() method. laravel/ai's ToolNameResolver falls back to class_basename(), which for an anonymous class gives a name like ToolCallingProbe.php:34$398. Anthropic rejects the ., : and $. Craft's other assistant tools all define name(), so only this check is affected.
Suggested fix
- Add a
name()method to the anonymous tool, e.g. returningget_verification_code.
Notes
With that method added locally, the tool name resolves to get_verification_code and the check passes with claude-sonnet-5-5. config/ai.php is the stock laravel/ai config, so the config isn't involved.
Craft CMS version
6.x-dev (395aae2)
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 712
- Avg merge
- 12h 44m
- Merged PRs (30d)
- 381
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from craftcms/cms
-
bug repo:cms
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
craftcms/cms#20205 · 1 comment ·
Maintainers usually reply within 1 day
-
bug repo:cms
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
craftcms/cms#20203 · 1 comment ·
Maintainers usually reply within 1 day
-
[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null givenPossibly taken @i-just claimed this 8 days ago. Openbug repo:cms
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
craftcms/cms#20128 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
bug repo:cms
Difficulty 4/5 3-5 days Newbie friendliness 48/100
craftcms/cms#20386 · 1 comment ·
Maintainers usually reply within 1 day
-
repo:cms
Difficulty 1/5 Under an hour Newbie friendliness 35/100
craftcms/cms#20385 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
bug ui
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
hashtopolis/server#2614 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
bug-report bug-report-triage
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Codeinwp/wp-maintenance-mode#596 · 1 comment ·
Maintainers usually reply within 1 day