Is the README example Tool registration method incorrect?

オープン
#128 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

  • #251 @systemblueio による — マージされずにクローズ
  • #253 @ZhouYinLong-lab による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
swift
領域
api, documentation

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Swift
スター
1.6k
フォーク
270
平均マージ
2日 7時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/swift-sdk のほかの issue

modelcontextprotocol/swift-sdk の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。