{
  "id": 2272846,
  "title": "MCP C# SDK Array Tool Outputs: Stop Looking for a `result` Wrapper",
  "url": "https://urgent.news/2026/08/21/mcp-c-sdk-array-tool-outputs-stop-looking-for-a-result-wrapper",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-21T01:23:31.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ssukhpinder/mcp-c-sdk-array-tool-outputs-stop-looking-for-a-result-wrapper-452c"
  },
  "original_language": "en",
  "account": "The MCP C# SDK array tool outputs can be difficult to interpret after a protocol upgrade. Clients programmed for the older wire format often look for a `structuredContent.result` element. Once both parties adopt MCP 2026-07-28, arrays and scalars are distinct. No wrapper is needed to extract the data. This change should be verified at the transport level. A unit test in C# cannot determine the tools advertised or the actual content carried. A verifier runs both protocol versions offline, explicitly highlighting the difference. The MCP 2026-07-28 specification allows `structuredContent` to hold any JSON value: object, array, string, number, Boolean, or null. The schema still matters: servers must return content conforming to it, and clients should validate the response. This differs from the previous object-only convention. Under 2025-11-25, a tool returning a string array must include an object envelope, like `{ structuredContent : [ starter, growth, enterprise ] }`. The modern form is simply the value: `{ structuredContent : [ starter, growth, enterprise ] }`. The stable C# SDK manages this negotiation. Its v2.0.0 release notes mention direct non-object tool results, while the current v2.2.0 documentation covers `UseStructuredContent`. For a legacy client, the SDK generates the compatibility envelope. The sample code uses .NET 10, with one array tool and one scalar tool. The SDK generates the output schema and serializes the return value into `structuredContent`. Two in-memory protocol sessions are built: one using MCP 2026-07-28, the other MCP 2025-11-25. These sessions verify the schema and returned value. On the modern session, the schema type is checked, the result is an array, and a negative control verifies the parser that only succeeds with an object containing a `result`. The legacy session checks for an older envelope with a `result` property. The client verifies the schema before reading the result, handling both array and object schemas. This approach catches asymmetric bugs where a server advertises one format but returns another. Running the verifier produces a summary confirming the expected results. The sample code includes scalar checks and setup commands, along with expected output and a vulnerability audit. The associated pull request records the validation commands and results. While this test confirms the official SDK 2.2.0 behavior over the stream transport, it does not guarantee that every third-party client accepts every JSON Schema 2020-12 construct. Additional end-to-end tests are recommended for each real host before relying on array or primitive roots.",
  "summary": "MCP C# SDK array tool outputs are easy to misread after a protocol upgrade. A client written around the older wire shape may always reach for structuredContent.result . Once both sides negotiate MCP 2026-07-28 , an array is an array and a scalar is a scalar. There is no required wrapper to unwrap. I treat that as a contract change worth testing at the transport boundary. A unit test against the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}