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?
Open
Nobody has claimed this yet.
enhancement
needs confirmation
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
[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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the ConvertImageFormat tool call over the SSE and HTTP setup described in the issue, then inspect how the server handles image content in the conversational context. Done means the tool call succeeds and images can be supported alongside the conversation; no source files or tests are identified in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100