Preserve native JSON types when passing arguments to tool handlers
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by tracing how validated arguments are passed to tool handlers and review the related decoding work in issue #586. Check the tests covering nested JSON values and handler arguments to identify where objects are converted to associative arrays. Done means handlers receive recursive stdClass, array, and scalar values as specified, with tests confirming the behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
The SDK currently converts JSON objects into associative PHP arrays before passing them to tool handlers. This forces a specific PHP representation on consumers instead of preserving the original JSON types.
Describe the solution you'd like
Pass validated arguments to tool handlers without implicit type conversion:
- JSON objects →
stdClass - JSON arrays →
array - Scalar values → their corresponding PHP types
This should apply recursively to nested structures.
For consumers preferring associative arrays, the SDK could provide an optional, documented recursive stdClass-to-array converter. Its use should be explicitly controlled by the consumer.
Describe alternatives you've considered
A configurable automatic conversion to associative arrays would preserve existing behavior, but introduce application-specific conversion logic and additional maintenance overhead into the SDK's argument-handling pipeline.
Existing Composer packages also provide object-to-array conversion, so consumers could handle this independently without additional SDK functionality.
Additional context
Related to #586, which addresses the loss of JSON type information during decoding and its impact on schema validation.
This request concerns the subsequent delivery of validated values to tool handlers.
The change would be breaking for consumers expecting associative arrays, but could be introduced before the SDK reaches 1.0. Preserving the current interface merely for convenience or backward compatibility would be an unfortunate design decision, as it would perpetuate unnecessary coupling to a specific PHP representation instead of establishing a clean, type-preserving API.
- Ngôn ngữ chính
- PHP
- Star
- 1.6k
- Fork
- 180
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 36
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 modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanĐang mởServer
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/php-sdk#468 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudlyCó thể đã có người làm @ousamabenyounes đã nhận 56 ngày trước. Đang mởneeds confirmation needs maintainer action Server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/php-sdk#398 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/php-sdk#370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 60/100
modelcontextprotocol/php-sdk#586 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
modelcontextprotocol/php-sdk#583 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/php-sdk
Issue tương tự
-
cloning objets from planningĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
glpi-project/glpi#25922 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Translation TwigBridge
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23308 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Перевод устарел
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100