Skip to content

StructuredContent vs Content Mismatch #747

Description

@PederHP

If I create a tool like this:

[McpServerToolType]
public class EchoTool
{
    [McpServerTool(Name = "echo", UseStructuredContent = true), Description("Echoes the message back to the client.")]
    public static string Echo(string message) => $"Echo: {message}";
}

Then the response violates the spec in terms of the plain TextContent matching the StructuredContent:

{
  "content": [
    {
      "type": "text",
      "text": "Echo: Test"
    }
  ],
  "structuredContent": {
    "result": "Echo: Test"
  }
}

The text property should be the stringified version of the structuredContent object, as per
https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content

Note that if UseStructuredContent is not set in the attribute, this does not happen (as only plain text is returned), nor is there a discrepancy for object types, json nodes, etc.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions