Unknown tool error always says "Unknown tool: invalid_tool_name" instead of the name that was called

オープン 初心者向け
#1,346 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
backend

調査の方向性

McpAsyncServer.java と McpStatelessAsyncServer.java で tools/call ハンドラーを探してください。そのハンドラーは McpError を固定の "Unknown tool: invalid_tool_name" メッセージとともに構築します。プレースホルダーを、すでにスコープ内にある要求された名前 callToolRequest.name() に置き換え、data フィールドは変更しないでください。既存のサーバーテストを実行して、async と stateless の両方のバリアントが現在、例として Unknown tool: delete_order を返すことを確認してください。

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

説明

The error for a tools/call with an unknown tool name has a fixed message, Unknown tool: invalid_tool_name, whatever name was called:

// McpAsyncServer.java (and McpStatelessAsyncServer.java)
return Mono.error(McpError.builder(McpSchema.ErrorCodes.INVALID_PARAMS)
    .message("Unknown tool: invalid_tool_name")
    .data("Tool not found: " + callToolRequest.name())
    .build());

A call to delete_order, which the server does not have, gets:

{"code": -32602, "message": "Unknown tool: invalid_tool_name", "data": "Tool not found: delete_order"}

The text looks like it was taken from the error example in the MCP specification, where invalid_tool_name is a placeholder. Clients and logs usually show only message, so the name of the tool is lost, and it looks as if the tool were called invalid_tool_name.

Expected: the message names the tool that was called, such as Unknown tool: delete_order, in both McpAsyncServer and McpStatelessAsyncServer. data can stay as it is.

Seen with mcp-core 2.2.0, and still in main (779893c).

Claude Code on behalf of Claus Ibsen

主要言語
Java
スター
3.8k
フォーク
1.1k
平均マージ
1日 3時間
マージ済み PR(30日)
38

環境構築

はじめの一歩

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

modelcontextprotocol/java-sdk のほかの issue

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

似ている issue

Java の issue をもっと見る

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

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