Azure / Azure/azure-functions-nodejs-worker

Tool result `structuredContent` dropped on the wire (TypeScript)

Open
#813 0 comments 0 reactions 0 assignees View on GitHub
Needs: Triage (Functions)
Dominant language
TypeScript
Stars
110
Forks
51
Avg merge
1d 1h
Merged PRs (30d)
2

Description

# 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

```ts
// 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:

```bash
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

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

## Actual

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

`structuredContent` is absent from the wire response.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.