Span status contains tool result content and exception messages

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

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

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

評価

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

調査の方向性

issue では、span のステータス説明を設定する箇所として McpSessionHandler.AddResponseTags と AddExceptionTags が示されています。これらのメソッドと MCP エラーの tracing 規約を読み、その後、span のステータス説明に関連するテストを確認してください。ツール結果の内容と McpProtocolException 以外のメッセージが省略され、プロトコルエラーメッセージは残り、これらのケースをテストでカバーできていれば完了です。

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

説明

bug

Describe the bug
When a tool returns isError, the server span's status description is set to the whole content array as JSON (McpSessionHandler.AddResponseTags). When a handler throws, it's set to e.Message (AddExceptionTags).

We run two MCP servers on 1.4.2 and found confirmation tokens and customer data from tool results in our tracing backend because of this. It's the same on main after 2.4.0.

To Reproduce

  1. Listen to the Experimental.ModelContextProtocol activity source on the server.
  2. Call a tool that returns isError: true with some content, or one that throws.
  3. Look at the server span's status description.

Expected behavior
No description for isError results, since error.type=tool_error already marks them, and none for exceptions that aren't an McpProtocolException. The conventions only ask for the JSONRPCError.message, and the result content has its own opt-in attribute.

Additional context
For now we clear the description in a span processor before export.

Happy to open a PR for this. If you agree with the direction.

主要言語
C#
スター
4.7k
フォーク
863
平均マージ
15時間 29分
マージ済み PR(30日)
8

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

modelcontextprotocol/csharp-sdk のほかの issue

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

似ている issue

C# の issue をもっと見る

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

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