modelcontextprotocol / modelcontextprotocol/csharp-sdk

How can a server using the SSE (Server-Sent Events) model over HTTP support additional content like images within the conversational context?

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

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

enhancement needs confirmation
主要言語
C#
スター
4.5k
フォーク
814
平均マージ
9日 19時間
マージ済み PR(30日)
4

説明

[McpServerTool(Name = "ConvertImageFormat")]
[Description("Converts image format")] 
public static async Task<string> ConvertImageFormat(
    [Description("Base64 encoded image data")] string imageData, 
    [Description("Target format: jpeg, png, bmp")] string targetFormat) 
{
    try
    {
        if (imageData.Contains(","))
        {
            imageData = imageData.Split(',')[1];
        }

        byte[] imageBytes = Convert.FromBase64String(imageData);

        // Here you can integrate System.Drawing or ImageSharp for format conversion
        // For simplicity, this is just simulating the conversion
        var convertedBytes = await SimulateImageConversion(imageBytes, targetFormat);
        var convertedBase64 = Convert.ToBase64String(convertedBytes);

        return $"Image format conversion completed:\n" + 
               $"- Original size: {imageBytes.Length} bytes\n" +
               $"- Converted size: {convertedBytes.Length} bytes\n" + 
               $"- Target format: {targetFormat}\n" + 
               $"- Converted base64 data: data:image/{targetFormat};base64,{convertedBase64}";
    }
    catch (Exception ex)
    {
        return $"Error: Failed to convert image format - {ex.Message}"; 
    }
}

This approach/way of writing does not successfully call it.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず、issue に記載された SSE および HTTP のセットアップ上で ConvertImageFormat ツール呼び出しを再現し、次にサーバーが会話コンテキスト内の画像コンテンツをどのように処理するかを調査します。ツール呼び出しが成功し、会話と併せて画像をサポートできれば完了です。レポートではソースファイルやテストは特定されていません。

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

評価

技術スタック
csharp
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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