Is the README example Tool registration method incorrect?

Đang mở
#128 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

  • #251 của @systemblueio — đã đóng, không merge
  • #253 của @ZhouYinLong-lab — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
swift
Lĩnh vực
api, documentation

Hướng nghiên cứu

Start with the README Tool registration example and compare its inputSchema with the object schema shown in the issue. Check the Swift Tool API to determine which form is accepted, then update the README example to match the working registration format and verify the documented example is consistent with the API.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Describe the bug
Is the README example Tool registration method incorrect?
Using the example from the README, I get an error saying that the inputSchema is expected to be an object.

Example from the README:

Tool(
    name: "weather",
    description: "Get current weather for a location",
    inputSchema: .object([
        "location": .string("City name or coordinates"),
        "units": .string("Units of measurement, e.g., metric, imperial")
    ])
)

When I try this format, I get the expected response:

Tool(
    name: "weather",
    description: "Get current weather for a location",
    inputSchema: .object([
        "type": "object",
        "properties": [
            "a": ["type": "number"],
            "b": ["type": "number"]
        ],
        "required": ["a", "b"]
    ])
)

To Reproduce
Steps to reproduce the behavior:
1.

Expected behavior
A clear and concise description of what you expected to happen.

Logs
If applicable, add logs to help explain your problem.

Additional context
Add any other context about the problem here.

Ngôn ngữ chính
Swift
Star
1.6k
Fork
270
Merge trung bình
2 ngày 7 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/swift-sdk

Tất cả issue của modelcontextprotocol/swift-sdk

Issue tương tự

Thêm issue về Swift

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.