@mastra/mcp-docs-server 0.0.0-structured-output-errors-20260409185629 → 0.0.0-structured-output-agent-20260413221909

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -210,6 +210,28 @@ const response = await testAgent.generate('Tell me about TypeScript.', {
210
210
  })
211
211
  ```
212
212
 
213
+ If you want that structuring model to also see the current conversation history, set `useAgent: true`. Mastra will reuse the parent agent with the separate structuring model and attach read-only memory context when a thread is available.
214
+
215
+ ```typescript
216
+ const response = await testAgent.generate('Return my profile as structured data.', {
217
+ memory: {
218
+ thread: 'thread-123',
219
+ resource: 'user-123',
220
+ },
221
+ structuredOutput: {
222
+ schema: z.object({
223
+ favoriteColor: z.string(),
224
+ hometown: z.string(),
225
+ petName: z.string(),
226
+ }),
227
+ model: 'openai/gpt-5.4',
228
+ useAgent: true,
229
+ },
230
+ })
231
+ ```
232
+
233
+ Leave `useAgent` unset if you want the separate structuring model to work only from the current response and not inherit prior conversation memory.
234
+
213
235
  ### Multi-step approach with `prepareStep`
214
236
 
215
237
  For models that don't support tools and structured outputs together, you can use `prepareStep` to handle them in separate steps.
@@ -8,6 +8,23 @@ Framework-agnostic handler for streaming agent chat in AI SDK-compatible format.
8
8
 
9
9
  Use [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) if you want to create a chat route inside a Mastra server.
10
10
 
11
+ ## Structured output in UI streams
12
+
13
+ When you pass `structuredOutput` to the underlying agent execution, the final structured output object is emitted in the AI SDK-compatible UI stream as a custom data part:
14
+
15
+ ```json
16
+ {
17
+ "type": "data-structured-output",
18
+ "data": {
19
+ "object": {}
20
+ }
21
+ }
22
+ ```
23
+
24
+ The `object` field contains your full structured output value. Mastra emits this event for the final structured output object only. Partial structured output chunks are not exposed in the UI stream.
25
+
26
+ Read this event with AI SDK UI's custom data handling, such as `onData`, or render it from message data parts.
27
+
11
28
  ## Usage example
12
29
 
13
30
  Next.js App Router example:
@@ -6,6 +6,21 @@ This is useful when building custom streaming endpoints outside Mastra's provide
6
6
 
7
7
  `toAISdkStream()` keeps the existing AI SDK v5/default behavior. If your app is typed against AI SDK v6, pass `version: 'v6'` in the options object.
8
8
 
9
+ ## Structured output in UI streams
10
+
11
+ When the source agent stream includes a final structured output object, `toAISdkStream()` emits it as a custom AI SDK UI data part:
12
+
13
+ ```json
14
+ {
15
+ "type": "data-structured-output",
16
+ "data": {
17
+ "object": {}
18
+ }
19
+ }
20
+ ```
21
+
22
+ The `object` field contains your full structured output value. This maps Mastra's final structured output chunk into the AI SDK UI stream. Partial structured output chunks are not emitted.
23
+
9
24
  ## Usage example
10
25
 
11
26
  Next.js App Router example:
package/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
- ## 0.0.0-structured-output-errors-20260409185629
3
+ ## 0.0.0-structured-output-agent-20260413221909
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [[`87df955`](https://github.com/mastra-ai/mastra/commit/87df955c028660c075873fd5d74af28233ce32eb), [`920f258`](https://github.com/mastra-ai/mastra/commit/920f258392868b1acaa9390f708a19466fff9d7f), [`075e91a`](https://github.com/mastra-ai/mastra/commit/075e91a4549baf46ad7a42a6a8ac8dfa78cc09e6)]:
8
- - @mastra/core@0.0.0-structured-output-errors-20260409185629
9
- - @mastra/mcp@0.0.0-structured-output-errors-20260409185629
7
+ - Updated dependencies [[`87df955`](https://github.com/mastra-ai/mastra/commit/87df955c028660c075873fd5d74af28233ce32eb), [`5d84914`](https://github.com/mastra-ai/mastra/commit/5d84914e0e520c642a40329b210b413fcd139898), [`fd2f314`](https://github.com/mastra-ai/mastra/commit/fd2f31473d3449b6b97e837ef8641264377f41a7), [`e80fead`](https://github.com/mastra-ai/mastra/commit/e80fead1412cc0d1b2f7d6a1ce5017d9e0098ff7), [`0287b64`](https://github.com/mastra-ai/mastra/commit/0287b644a5c3272755cf3112e71338106664103b), [`5332c00`](https://github.com/mastra-ai/mastra/commit/5332c00ede9a783f0f56000240b8ed68e008d922), [`075e91a`](https://github.com/mastra-ai/mastra/commit/075e91a4549baf46ad7a42a6a8ac8dfa78cc09e6)]:
8
+ - @mastra/core@0.0.0-structured-output-agent-20260413221909
9
+ - @mastra/mcp@0.0.0-structured-output-agent-20260413221909
10
10
 
11
11
  ## 1.1.25-alpha.0
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.0.0-structured-output-errors-20260409185629",
3
+ "version": "0.0.0-structured-output-agent-20260413221909",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "jsdom": "^26.1.0",
30
30
  "local-pkg": "^1.1.2",
31
31
  "zod": "^4.3.6",
32
- "@mastra/core": "0.0.0-structured-output-errors-20260409185629",
33
- "@mastra/mcp": "0.0.0-structured-output-errors-20260409185629"
32
+ "@mastra/core": "0.0.0-structured-output-agent-20260413221909",
33
+ "@mastra/mcp": "0.0.0-structured-output-agent-20260413221909"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@hono/node-server": "^1.19.11",
@@ -46,9 +46,9 @@
46
46
  "tsx": "^4.21.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "4.0.18",
49
- "@internal/lint": "0.0.0-structured-output-errors-20260409185629",
50
- "@internal/types-builder": "0.0.0-structured-output-errors-20260409185629",
51
- "@mastra/core": "0.0.0-structured-output-errors-20260409185629"
49
+ "@internal/lint": "0.0.0-structured-output-agent-20260413221909",
50
+ "@internal/types-builder": "0.0.0-structured-output-agent-20260413221909",
51
+ "@mastra/core": "0.0.0-structured-output-agent-20260413221909"
52
52
  },
53
53
  "homepage": "https://mastra.ai",
54
54
  "repository": {