[6.x]: AI tool-calling check fails with a 400 on Anthropic, so Ask AI can't use Claude models
Maintainer thường phản hồi trong vòng 1 ngày
@riasvdv đang làm issue này rồi.
Từ ngày 3/11/2026.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Kiểm tra đang lỗi là công cụ ẩn danh trong src/Ai/Agents/ToolCallingProbe.php, khoảng dòng 34, không có phương thức name(), nên laravel/ai quay về dùng class_basename mà Anthropic từ chối. Hãy bắt đầu bằng việc đọc tệp đó và so sánh với các công cụ trợ lý Craft khác có định nghĩa name(). Công việc hoàn thành khi probe khai báo một name() như get_verification_code và kiểm tra gọi công cụ đạt với claude-sonnet-5-5.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 3.6k
- Fork
- 712
- Merge trung bình
- 12 giờ 44 phút
- Pull request đã merge (30 ngày)
- 381
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của craftcms/cms
-
bug repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
craftcms/cms#20205 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[6.x]: Element index View menu: sort direction buttons only update after the table has loadedĐang mởbug repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
craftcms/cms#20203 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null givenCó thể đã có người làm @i-just đã nhận 8 ngày trước. Đang mởbug repo:cms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
craftcms/cms#20128 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[5.x]: GC on PostgreSQL can leave all FK triggers disabled and deletes stop cascadingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug repo:cms
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
craftcms/cms#20386 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
repo:cms
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
craftcms/cms#20385 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Automattic/blocks-engine#4621 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
YunoHost-Apps/snappymail_ynh#205 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Automattic/static-site-importer#2653 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug (unconfirmed) Search :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
FreshRSS/FreshRSS#9533 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
ExpressionEngine/ExpressionEngine#5453 ·
Maintainer thường phản hồi trong vòng 1 ngày