Skip to content

Tool result structuredContent dropped on the wire (TypeScript) #813

@YuanboXue-Amber

Description

@YuanboXue-Amber

Tool result structuredContent dropped on the wire (TypeScript)

A TypeScript tool handler that returns McpToolResponse with structuredContent populated produces a JSON-RPC response that's missing the structuredContent field. The content blocks come through correctly; only structuredContent is stripped.

Reproducer

Standalone repo: https://github.com/YuanboXue-Amber/functions-mcp-structuredcontent-repro

Versions

Component Version
@azure/functions (npm) 4.14.0
Microsoft.Azure.Functions.Extensions.Mcp 1.5.0 (via extensionBundle 4.35.0)
Extension bundle pin [4.0.0, 5.0.0)
Node 22.x
Azure Functions Core Tools 4.9.0

Steps to reproduce

// src-ts/functions/echoStructured.ts
import functionsPkg from "@azure/functions";
const { app, McpToolResponse, McpTextContent } = functionsPkg;

app.mcpTool("echoStructured", {
  toolName: "echo-structured",
  description:
    'Returns hello in content[0] and { foo: "bar" } in structuredContent.',
  toolProperties: {},
  handler: async () =>
    new McpToolResponse({
      content: [new McpTextContent("hello")],
      structuredContent: { foo: "bar" },
    }),
});

func start, then call the tool:

SID=$(curl -s -i -X POST http://localhost:7071/runtime/webhooks/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  --data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"repro","version":"0.0.1"}}}' \
  | grep -i 'mcp-session-id:' | tr -d '\r' | sed 's/.*: //')

curl -s -X POST http://localhost:7071/runtime/webhooks/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H "mcp-session-id: $SID" \
  --data '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"echo-structured","arguments":{}}}'

Expected

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "content": [{ "type": "text", "text": "hello" }],
    "structuredContent": { "foo": "bar" }
  }
}

Actual

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "content": [{ "type": "text", "text": "hello" }]
  }
}

structuredContent is absent from the wire response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions