Span status contains tool result content and exception messages

Đang mở Phù hợp với người mới
#2,060 0 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 1 ngày

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

Đá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
67/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
observability

Hướng nghiên cứu

Issue chỉ ra McpSessionHandler.AddResponseTags và AddExceptionTags là những nơi thiết lập mô tả trạng thái span. Đọc các phương thức đó và các quy ước tracing cho lỗi MCP, sau đó kiểm tra các bài kiểm tra liên quan đến mô tả trạng thái span. Hoàn tất khi nội dung kết quả của công cụ và các thông báo không phải McpProtocolException được lược bỏ, các thông báo lỗi giao thức vẫn được giữ lại, và có bài kiểm tra bao quát các trường hợp này.

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
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.

Ngôn ngữ chính
C#
Star
4.6k
Fork
855
Merge trung bình
15 giờ 29 phút
Pull request đã merge (30 ngày)
8

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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/csharp-sdk

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

Issue tương tự

Thêm issue về C#

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.