@mastra/mcp-docs-server 0.13.20 → 0.13.21-alpha.0
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.
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +8 -0
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +17 -17
- package/.docs/organized/changelogs/create-mastra.md +5 -5
- package/.docs/organized/changelogs/mastra.md +21 -21
- package/.docs/organized/code-examples/agent.md +34 -9
- package/.docs/organized/code-examples/ai-sdk-v5.md +16 -14
- package/.docs/organized/code-examples/heads-up-game.md +3 -3
- package/.docs/raw/auth/clerk.mdx +142 -0
- package/.docs/raw/getting-started/installation.mdx +3 -1
- package/.docs/raw/getting-started/model-providers.mdx +31 -31
- package/.docs/raw/observability/ai-tracing.mdx +123 -24
- package/.docs/raw/reference/agents/ChunkType.mdx +857 -0
- package/.docs/raw/reference/agents/MastraModelOutput.mdx +321 -0
- package/.docs/raw/reference/agents/generateVNext.mdx +519 -0
- package/.docs/raw/reference/agents/streamVNext.mdx +6 -20
- package/.docs/raw/reference/auth/clerk.mdx +71 -0
- package/.docs/raw/reference/scorers/answer-similarity.mdx +179 -0
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +1 -0
- package/.docs/raw/server-db/production-server.mdx +27 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +144 -159
- package/.docs/raw/workflows/control-flow.mdx +1 -1
- package/.docs/raw/workflows/suspend-and-resume.mdx +5 -0
- package/CHANGELOG.md +9 -0
- package/dist/stdio.js +11 -4
- package/dist/tools/docs.d.ts.map +1 -1
- package/package.json +4 -4
- /package/.docs/raw/reference/{templates.mdx → templates/overview.mdx} +0 -0
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: ChunkType | Agents | Mastra Docs"
|
|
3
|
+
description: "Documentation for the ChunkType type used in Mastra streaming responses, defining all possible chunk types and their payloads."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Callout } from "nextra/components";
|
|
7
|
+
import { PropertiesTable } from "@/components/properties-table";
|
|
8
|
+
|
|
9
|
+
# ChunkType
|
|
10
|
+
|
|
11
|
+
<Callout type="warning">
|
|
12
|
+
**Experimental API**: This type is part of the experimental [`streamVNext()`](../streamVNext) method. The API may change as we refine the feature based on feedback.
|
|
13
|
+
</Callout>
|
|
14
|
+
|
|
15
|
+
The `ChunkType` type defines the mastra format of stream chunks that can be emitted during streaming responses from agents.
|
|
16
|
+
|
|
17
|
+
## Base Properties
|
|
18
|
+
|
|
19
|
+
All chunks include these base properties:
|
|
20
|
+
|
|
21
|
+
<PropertiesTable
|
|
22
|
+
content={[
|
|
23
|
+
{
|
|
24
|
+
name: "type",
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The specific chunk type identifier"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "runId",
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Unique identifier for this execution run"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "from",
|
|
35
|
+
type: "ChunkFrom",
|
|
36
|
+
description: "Source of the chunk",
|
|
37
|
+
properties: [{
|
|
38
|
+
type: "enum",
|
|
39
|
+
parameters: [
|
|
40
|
+
{ name: "AGENT", type: "'AGENT'", description: "Chunk from agent execution" },
|
|
41
|
+
{ name: "USER", type: "'USER'", description: "Chunk from user input" },
|
|
42
|
+
{ name: "SYSTEM", type: "'SYSTEM'", description: "Chunk from system processes" },
|
|
43
|
+
{ name: "WORKFLOW", type: "'WORKFLOW'", description: "Chunk from workflow execution" }
|
|
44
|
+
]
|
|
45
|
+
}]
|
|
46
|
+
}
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
## Text Chunks
|
|
51
|
+
|
|
52
|
+
### text-start
|
|
53
|
+
|
|
54
|
+
Signals the beginning of text generation.
|
|
55
|
+
|
|
56
|
+
<PropertiesTable
|
|
57
|
+
content={[
|
|
58
|
+
{
|
|
59
|
+
name: "type",
|
|
60
|
+
type: '"text-start"',
|
|
61
|
+
description: "Chunk type identifier"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "payload",
|
|
65
|
+
type: "TextStartPayload",
|
|
66
|
+
description: "Text start information",
|
|
67
|
+
properties: [{
|
|
68
|
+
type: "TextStartPayload",
|
|
69
|
+
parameters: [
|
|
70
|
+
{ name: "id", type: "string", description: "Unique identifier for this text generation" },
|
|
71
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
72
|
+
]
|
|
73
|
+
}]
|
|
74
|
+
}
|
|
75
|
+
]}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
### text-delta
|
|
79
|
+
|
|
80
|
+
Incremental text content during generation.
|
|
81
|
+
|
|
82
|
+
<PropertiesTable
|
|
83
|
+
content={[
|
|
84
|
+
{
|
|
85
|
+
name: "type",
|
|
86
|
+
type: '"text-delta"',
|
|
87
|
+
description: "Chunk type identifier"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "payload",
|
|
91
|
+
type: "TextDeltaPayload",
|
|
92
|
+
description: "Incremental text content",
|
|
93
|
+
properties: [{
|
|
94
|
+
type: "TextDeltaPayload",
|
|
95
|
+
parameters: [
|
|
96
|
+
{ name: "id", type: "string", description: "Unique identifier for this text generation" },
|
|
97
|
+
{ name: "text", type: "string", description: "The incremental text content" },
|
|
98
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
99
|
+
]
|
|
100
|
+
}]
|
|
101
|
+
}
|
|
102
|
+
]}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
### text-end
|
|
106
|
+
|
|
107
|
+
Signals the end of text generation.
|
|
108
|
+
|
|
109
|
+
<PropertiesTable
|
|
110
|
+
content={[
|
|
111
|
+
{
|
|
112
|
+
name: "type",
|
|
113
|
+
type: '"text-end"',
|
|
114
|
+
description: "Chunk type identifier"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "payload",
|
|
118
|
+
type: "TextEndPayload",
|
|
119
|
+
description: "Text end information",
|
|
120
|
+
properties: [{
|
|
121
|
+
type: "TextEndPayload",
|
|
122
|
+
parameters: [
|
|
123
|
+
{ name: "id", type: "string", description: "Unique identifier for this text generation" },
|
|
124
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
125
|
+
]
|
|
126
|
+
}]
|
|
127
|
+
}
|
|
128
|
+
]}
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
## Reasoning Chunks
|
|
132
|
+
|
|
133
|
+
### reasoning-start
|
|
134
|
+
|
|
135
|
+
Signals the beginning of reasoning generation (for models that support reasoning).
|
|
136
|
+
|
|
137
|
+
<PropertiesTable
|
|
138
|
+
content={[
|
|
139
|
+
{
|
|
140
|
+
name: "type",
|
|
141
|
+
type: '"reasoning-start"',
|
|
142
|
+
description: "Chunk type identifier"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "payload",
|
|
146
|
+
type: "ReasoningStartPayload",
|
|
147
|
+
description: "Reasoning start information",
|
|
148
|
+
properties: [{
|
|
149
|
+
type: "ReasoningStartPayload",
|
|
150
|
+
parameters: [
|
|
151
|
+
{ name: "id", type: "string", description: "Unique identifier for this reasoning generation" },
|
|
152
|
+
{ name: "signature", type: "string", isOptional: true, description: "Reasoning signature if available" },
|
|
153
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
154
|
+
]
|
|
155
|
+
}]
|
|
156
|
+
}
|
|
157
|
+
]}
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
### reasoning-delta
|
|
161
|
+
|
|
162
|
+
Incremental reasoning text during generation.
|
|
163
|
+
|
|
164
|
+
<PropertiesTable
|
|
165
|
+
content={[
|
|
166
|
+
{
|
|
167
|
+
name: "type",
|
|
168
|
+
type: '"reasoning-delta"',
|
|
169
|
+
description: "Chunk type identifier"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "payload",
|
|
173
|
+
type: "ReasoningDeltaPayload",
|
|
174
|
+
description: "Incremental reasoning content",
|
|
175
|
+
properties: [{
|
|
176
|
+
type: "ReasoningDeltaPayload",
|
|
177
|
+
parameters: [
|
|
178
|
+
{ name: "id", type: "string", description: "Unique identifier for this reasoning generation" },
|
|
179
|
+
{ name: "text", type: "string", description: "The incremental reasoning text" },
|
|
180
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
181
|
+
]
|
|
182
|
+
}]
|
|
183
|
+
}
|
|
184
|
+
]}
|
|
185
|
+
/>
|
|
186
|
+
|
|
187
|
+
### reasoning-end
|
|
188
|
+
|
|
189
|
+
Signals the end of reasoning generation.
|
|
190
|
+
|
|
191
|
+
<PropertiesTable
|
|
192
|
+
content={[
|
|
193
|
+
{
|
|
194
|
+
name: "type",
|
|
195
|
+
type: '"reasoning-end"',
|
|
196
|
+
description: "Chunk type identifier"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "payload",
|
|
200
|
+
type: "ReasoningEndPayload",
|
|
201
|
+
description: "Reasoning end information",
|
|
202
|
+
properties: [{
|
|
203
|
+
type: "ReasoningEndPayload",
|
|
204
|
+
parameters: [
|
|
205
|
+
{ name: "id", type: "string", description: "Unique identifier for this reasoning generation" },
|
|
206
|
+
{ name: "signature", type: "string", isOptional: true, description: "Final reasoning signature if available" },
|
|
207
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
208
|
+
]
|
|
209
|
+
}]
|
|
210
|
+
}
|
|
211
|
+
]}
|
|
212
|
+
/>
|
|
213
|
+
|
|
214
|
+
### reasoning-signature
|
|
215
|
+
|
|
216
|
+
Contains the reasoning signature from models that support advanced reasoning (like OpenAI's o1 series). The signature represents metadata about the model's internal reasoning process, such as effort level or reasoning approach, but not the actual reasoning content itself.
|
|
217
|
+
|
|
218
|
+
<PropertiesTable
|
|
219
|
+
content={[
|
|
220
|
+
{
|
|
221
|
+
name: "type",
|
|
222
|
+
type: '"reasoning-signature"',
|
|
223
|
+
description: "Chunk type identifier"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "payload",
|
|
227
|
+
type: "ReasoningSignaturePayload",
|
|
228
|
+
description: "Metadata about the model's reasoning process characteristics",
|
|
229
|
+
properties: [{
|
|
230
|
+
type: "ReasoningSignaturePayload",
|
|
231
|
+
parameters: [
|
|
232
|
+
{ name: "id", type: "string", description: "Unique identifier for the reasoning session" },
|
|
233
|
+
{ name: "signature", type: "string", description: "Signature describing the reasoning approach or effort level (e.g., reasoning effort settings)" },
|
|
234
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
235
|
+
]
|
|
236
|
+
}]
|
|
237
|
+
}
|
|
238
|
+
]}
|
|
239
|
+
/>
|
|
240
|
+
|
|
241
|
+
## Tool Chunks
|
|
242
|
+
|
|
243
|
+
### tool-call
|
|
244
|
+
|
|
245
|
+
A tool is being called.
|
|
246
|
+
|
|
247
|
+
<PropertiesTable
|
|
248
|
+
content={[
|
|
249
|
+
{
|
|
250
|
+
name: "type",
|
|
251
|
+
type: '"tool-call"',
|
|
252
|
+
description: "Chunk type identifier"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "payload",
|
|
256
|
+
type: "ToolCallPayload",
|
|
257
|
+
description: "Tool call information",
|
|
258
|
+
properties: [{
|
|
259
|
+
type: "ToolCallPayload",
|
|
260
|
+
parameters: [
|
|
261
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for this tool call" },
|
|
262
|
+
{ name: "toolName", type: "string", description: "Name of the tool being called" },
|
|
263
|
+
{ name: "args", type: "Record<string, any>", isOptional: true, description: "Arguments passed to the tool" },
|
|
264
|
+
{ name: "providerExecuted", type: "boolean", isOptional: true, description: "Whether the provider executed the tool" },
|
|
265
|
+
{ name: "output", type: "any", isOptional: true, description: "Tool output if available" },
|
|
266
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
267
|
+
]
|
|
268
|
+
}]
|
|
269
|
+
}
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
|
|
273
|
+
### tool-result
|
|
274
|
+
|
|
275
|
+
Result from a tool execution.
|
|
276
|
+
|
|
277
|
+
<PropertiesTable
|
|
278
|
+
content={[
|
|
279
|
+
{
|
|
280
|
+
name: "type",
|
|
281
|
+
type: '"tool-result"',
|
|
282
|
+
description: "Chunk type identifier"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "payload",
|
|
286
|
+
type: "ToolResultPayload",
|
|
287
|
+
description: "Tool execution result",
|
|
288
|
+
properties: [{
|
|
289
|
+
type: "ToolResultPayload",
|
|
290
|
+
parameters: [
|
|
291
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for the tool call" },
|
|
292
|
+
{ name: "toolName", type: "string", description: "Name of the executed tool" },
|
|
293
|
+
{ name: "result", type: "any", description: "The result of the tool execution" },
|
|
294
|
+
{ name: "isError", type: "boolean", isOptional: true, description: "Whether the result is an error" },
|
|
295
|
+
{ name: "providerExecuted", type: "boolean", isOptional: true, description: "Whether the provider executed the tool" },
|
|
296
|
+
{ name: "args", type: "Record<string, any>", isOptional: true, description: "Arguments that were passed to the tool" },
|
|
297
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
298
|
+
]
|
|
299
|
+
}]
|
|
300
|
+
}
|
|
301
|
+
]}
|
|
302
|
+
/>
|
|
303
|
+
|
|
304
|
+
### tool-call-input-streaming-start
|
|
305
|
+
|
|
306
|
+
Signals the start of streaming tool call arguments.
|
|
307
|
+
|
|
308
|
+
<PropertiesTable
|
|
309
|
+
content={[
|
|
310
|
+
{
|
|
311
|
+
name: "type",
|
|
312
|
+
type: '"tool-call-input-streaming-start"',
|
|
313
|
+
description: "Chunk type identifier"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: "payload",
|
|
317
|
+
type: "ToolCallInputStreamingStartPayload",
|
|
318
|
+
description: "Tool call input streaming start information",
|
|
319
|
+
properties: [{
|
|
320
|
+
type: "ToolCallInputStreamingStartPayload",
|
|
321
|
+
parameters: [
|
|
322
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for this tool call" },
|
|
323
|
+
{ name: "toolName", type: "string", description: "Name of the tool being called" },
|
|
324
|
+
{ name: "providerExecuted", type: "boolean", isOptional: true, description: "Whether the provider executed the tool" },
|
|
325
|
+
{ name: "dynamic", type: "boolean", isOptional: true, description: "Whether the tool call is dynamic" },
|
|
326
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
327
|
+
]
|
|
328
|
+
}]
|
|
329
|
+
}
|
|
330
|
+
]}
|
|
331
|
+
/>
|
|
332
|
+
|
|
333
|
+
### tool-call-delta
|
|
334
|
+
|
|
335
|
+
Incremental tool call arguments during streaming.
|
|
336
|
+
|
|
337
|
+
<PropertiesTable
|
|
338
|
+
content={[
|
|
339
|
+
{
|
|
340
|
+
name: "type",
|
|
341
|
+
type: '"tool-call-delta"',
|
|
342
|
+
description: "Chunk type identifier"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "payload",
|
|
346
|
+
type: "ToolCallDeltaPayload",
|
|
347
|
+
description: "Incremental tool call arguments",
|
|
348
|
+
properties: [{
|
|
349
|
+
type: "ToolCallDeltaPayload",
|
|
350
|
+
parameters: [
|
|
351
|
+
{ name: "argsTextDelta", type: "string", description: "Incremental text delta for tool arguments" },
|
|
352
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for this tool call" },
|
|
353
|
+
{ name: "toolName", type: "string", isOptional: true, description: "Name of the tool being called" },
|
|
354
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
355
|
+
]
|
|
356
|
+
}]
|
|
357
|
+
}
|
|
358
|
+
]}
|
|
359
|
+
/>
|
|
360
|
+
|
|
361
|
+
### tool-call-input-streaming-end
|
|
362
|
+
|
|
363
|
+
Signals the end of streaming tool call arguments.
|
|
364
|
+
|
|
365
|
+
<PropertiesTable
|
|
366
|
+
content={[
|
|
367
|
+
{
|
|
368
|
+
name: "type",
|
|
369
|
+
type: '"tool-call-input-streaming-end"',
|
|
370
|
+
description: "Chunk type identifier"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: "payload",
|
|
374
|
+
type: "ToolCallInputStreamingEndPayload",
|
|
375
|
+
description: "Tool call input streaming end information",
|
|
376
|
+
properties: [{
|
|
377
|
+
type: "ToolCallInputStreamingEndPayload",
|
|
378
|
+
parameters: [
|
|
379
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for this tool call" },
|
|
380
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
381
|
+
]
|
|
382
|
+
}]
|
|
383
|
+
}
|
|
384
|
+
]}
|
|
385
|
+
/>
|
|
386
|
+
|
|
387
|
+
### tool-error
|
|
388
|
+
|
|
389
|
+
An error occurred during tool execution.
|
|
390
|
+
|
|
391
|
+
<PropertiesTable
|
|
392
|
+
content={[
|
|
393
|
+
{
|
|
394
|
+
name: "type",
|
|
395
|
+
type: '"tool-error"',
|
|
396
|
+
description: "Chunk type identifier"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "payload",
|
|
400
|
+
type: "ToolErrorPayload",
|
|
401
|
+
description: "Tool error information",
|
|
402
|
+
properties: [{
|
|
403
|
+
type: "ToolErrorPayload",
|
|
404
|
+
parameters: [
|
|
405
|
+
{ name: "id", type: "string", isOptional: true, description: "Optional identifier" },
|
|
406
|
+
{ name: "toolCallId", type: "string", description: "Unique identifier for the tool call" },
|
|
407
|
+
{ name: "toolName", type: "string", description: "Name of the tool that failed" },
|
|
408
|
+
{ name: "args", type: "Record<string, any>", isOptional: true, description: "Arguments that were passed to the tool" },
|
|
409
|
+
{ name: "error", type: "unknown", description: "The error that occurred" },
|
|
410
|
+
{ name: "providerExecuted", type: "boolean", isOptional: true, description: "Whether the provider executed the tool" },
|
|
411
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
412
|
+
]
|
|
413
|
+
}]
|
|
414
|
+
}
|
|
415
|
+
]}
|
|
416
|
+
/>
|
|
417
|
+
|
|
418
|
+
## Source and File Chunks
|
|
419
|
+
|
|
420
|
+
### source
|
|
421
|
+
|
|
422
|
+
Contains source information for content.
|
|
423
|
+
|
|
424
|
+
<PropertiesTable
|
|
425
|
+
content={[
|
|
426
|
+
{
|
|
427
|
+
name: "type",
|
|
428
|
+
type: '"source"',
|
|
429
|
+
description: "Chunk type identifier"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "payload",
|
|
433
|
+
type: "SourcePayload",
|
|
434
|
+
description: "Source information",
|
|
435
|
+
properties: [{
|
|
436
|
+
type: "SourcePayload",
|
|
437
|
+
parameters: [
|
|
438
|
+
{ name: "id", type: "string", description: "Unique identifier" },
|
|
439
|
+
{ name: "sourceType", type: "'url' | 'document'", description: "Type of source" },
|
|
440
|
+
{ name: "title", type: "string", description: "Title of the source" },
|
|
441
|
+
{ name: "mimeType", type: "string", isOptional: true, description: "MIME type of the source" },
|
|
442
|
+
{ name: "filename", type: "string", isOptional: true, description: "Filename if applicable" },
|
|
443
|
+
{ name: "url", type: "string", isOptional: true, description: "URL if applicable" },
|
|
444
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
445
|
+
]
|
|
446
|
+
}]
|
|
447
|
+
}
|
|
448
|
+
]}
|
|
449
|
+
/>
|
|
450
|
+
|
|
451
|
+
### file
|
|
452
|
+
|
|
453
|
+
Contains file data.
|
|
454
|
+
|
|
455
|
+
<PropertiesTable
|
|
456
|
+
content={[
|
|
457
|
+
{
|
|
458
|
+
name: "type",
|
|
459
|
+
type: '"file"',
|
|
460
|
+
description: "Chunk type identifier"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
name: "payload",
|
|
464
|
+
type: "FilePayload",
|
|
465
|
+
description: "File data",
|
|
466
|
+
properties: [{
|
|
467
|
+
type: "FilePayload",
|
|
468
|
+
parameters: [
|
|
469
|
+
{ name: "data", type: "string | Uint8Array", description: "The file data" },
|
|
470
|
+
{ name: "base64", type: "string", isOptional: true, description: "Base64 encoded data if applicable" },
|
|
471
|
+
{ name: "mimeType", type: "string", description: "MIME type of the file" },
|
|
472
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
473
|
+
]
|
|
474
|
+
}]
|
|
475
|
+
}
|
|
476
|
+
]}
|
|
477
|
+
/>
|
|
478
|
+
|
|
479
|
+
## Control Chunks
|
|
480
|
+
|
|
481
|
+
### start
|
|
482
|
+
|
|
483
|
+
Signals the start of streaming.
|
|
484
|
+
|
|
485
|
+
<PropertiesTable
|
|
486
|
+
content={[
|
|
487
|
+
{
|
|
488
|
+
name: "type",
|
|
489
|
+
type: '"start"',
|
|
490
|
+
description: "Chunk type identifier"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "payload",
|
|
494
|
+
type: "StartPayload",
|
|
495
|
+
description: "Start information",
|
|
496
|
+
properties: [{
|
|
497
|
+
type: "StartPayload",
|
|
498
|
+
parameters: [
|
|
499
|
+
{ name: "[key: string]", type: "any", description: "Additional start data" }
|
|
500
|
+
]
|
|
501
|
+
}]
|
|
502
|
+
}
|
|
503
|
+
]}
|
|
504
|
+
/>
|
|
505
|
+
|
|
506
|
+
### step-start
|
|
507
|
+
|
|
508
|
+
Signals the start of a processing step.
|
|
509
|
+
|
|
510
|
+
<PropertiesTable
|
|
511
|
+
content={[
|
|
512
|
+
{
|
|
513
|
+
name: "type",
|
|
514
|
+
type: '"step-start"',
|
|
515
|
+
description: "Chunk type identifier"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "payload",
|
|
519
|
+
type: "StepStartPayload",
|
|
520
|
+
description: "Step start information",
|
|
521
|
+
properties: [{
|
|
522
|
+
type: "StepStartPayload",
|
|
523
|
+
parameters: [
|
|
524
|
+
{ name: "messageId", type: "string", isOptional: true, description: "Optional message identifier" },
|
|
525
|
+
{ name: "request", type: "object", description: "Request information including body and other data" },
|
|
526
|
+
{ name: "warnings", type: "LanguageModelV2CallWarning[]", isOptional: true, description: "Any warnings from the language model call" }
|
|
527
|
+
]
|
|
528
|
+
}]
|
|
529
|
+
}
|
|
530
|
+
]}
|
|
531
|
+
/>
|
|
532
|
+
|
|
533
|
+
### step-finish
|
|
534
|
+
|
|
535
|
+
Signals the completion of a processing step.
|
|
536
|
+
|
|
537
|
+
<PropertiesTable
|
|
538
|
+
content={[
|
|
539
|
+
{
|
|
540
|
+
name: "type",
|
|
541
|
+
type: '"step-finish"',
|
|
542
|
+
description: "Chunk type identifier"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: "payload",
|
|
546
|
+
type: "StepFinishPayload",
|
|
547
|
+
description: "Step completion information",
|
|
548
|
+
properties: [{
|
|
549
|
+
type: "StepFinishPayload",
|
|
550
|
+
parameters: [
|
|
551
|
+
{ name: "id", type: "string", isOptional: true, description: "Optional identifier" },
|
|
552
|
+
{ name: "messageId", type: "string", isOptional: true, description: "Optional message identifier" },
|
|
553
|
+
{ name: "stepResult", type: "object", description: "Step execution result with reason, warnings, and continuation info" },
|
|
554
|
+
{ name: "output", type: "object", description: "Output information including usage statistics" },
|
|
555
|
+
{ name: "metadata", type: "object", description: "Execution metadata including request and provider info" },
|
|
556
|
+
{ name: "totalUsage", type: "LanguageModelV2Usage", isOptional: true, description: "Total usage statistics" },
|
|
557
|
+
{ name: "response", type: "LanguageModelV2ResponseMetadata", isOptional: true, description: "Response metadata" },
|
|
558
|
+
{ name: "providerMetadata", type: "SharedV2ProviderMetadata", isOptional: true, description: "Provider-specific metadata" }
|
|
559
|
+
]
|
|
560
|
+
}]
|
|
561
|
+
}
|
|
562
|
+
]}
|
|
563
|
+
/>
|
|
564
|
+
|
|
565
|
+
### raw
|
|
566
|
+
|
|
567
|
+
Contains raw data from the provider.
|
|
568
|
+
|
|
569
|
+
<PropertiesTable
|
|
570
|
+
content={[
|
|
571
|
+
{
|
|
572
|
+
name: "type",
|
|
573
|
+
type: '"raw"',
|
|
574
|
+
description: "Chunk type identifier"
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: "payload",
|
|
578
|
+
type: "RawPayload",
|
|
579
|
+
description: "Raw provider data",
|
|
580
|
+
properties: [{
|
|
581
|
+
type: "RawPayload",
|
|
582
|
+
parameters: [
|
|
583
|
+
{ name: "[key: string]", type: "any", description: "Raw data from the provider" }
|
|
584
|
+
]
|
|
585
|
+
}]
|
|
586
|
+
}
|
|
587
|
+
]}
|
|
588
|
+
/>
|
|
589
|
+
|
|
590
|
+
### finish
|
|
591
|
+
|
|
592
|
+
Stream has completed successfully.
|
|
593
|
+
|
|
594
|
+
<PropertiesTable
|
|
595
|
+
content={[
|
|
596
|
+
{
|
|
597
|
+
name: "type",
|
|
598
|
+
type: '"finish"',
|
|
599
|
+
description: "Chunk type identifier"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: "payload",
|
|
603
|
+
type: "FinishPayload",
|
|
604
|
+
description: "Completion information",
|
|
605
|
+
properties: [{
|
|
606
|
+
type: "FinishPayload",
|
|
607
|
+
parameters: [
|
|
608
|
+
{ name: "stepResult", type: "object", description: "Step execution result" },
|
|
609
|
+
{ name: "output", type: "object", description: "Output information including usage" },
|
|
610
|
+
{ name: "metadata", type: "object", description: "Execution metadata" },
|
|
611
|
+
{ name: "messages", type: "object", description: "Message history" }
|
|
612
|
+
]
|
|
613
|
+
}]
|
|
614
|
+
}
|
|
615
|
+
]}
|
|
616
|
+
/>
|
|
617
|
+
|
|
618
|
+
### error
|
|
619
|
+
|
|
620
|
+
An error occurred during streaming.
|
|
621
|
+
|
|
622
|
+
<PropertiesTable
|
|
623
|
+
content={[
|
|
624
|
+
{
|
|
625
|
+
name: "type",
|
|
626
|
+
type: '"error"',
|
|
627
|
+
description: "Chunk type identifier"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
name: "payload",
|
|
631
|
+
type: "ErrorPayload",
|
|
632
|
+
description: "Error information",
|
|
633
|
+
properties: [{
|
|
634
|
+
type: "ErrorPayload",
|
|
635
|
+
parameters: [
|
|
636
|
+
{ name: "error", type: "unknown", description: "The error that occurred" }
|
|
637
|
+
]
|
|
638
|
+
}]
|
|
639
|
+
}
|
|
640
|
+
]}
|
|
641
|
+
/>
|
|
642
|
+
|
|
643
|
+
### abort
|
|
644
|
+
|
|
645
|
+
Stream was aborted.
|
|
646
|
+
|
|
647
|
+
<PropertiesTable
|
|
648
|
+
content={[
|
|
649
|
+
{
|
|
650
|
+
name: "type",
|
|
651
|
+
type: '"abort"',
|
|
652
|
+
description: "Chunk type identifier"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "payload",
|
|
656
|
+
type: "AbortPayload",
|
|
657
|
+
description: "Abort information",
|
|
658
|
+
properties: [{
|
|
659
|
+
type: "AbortPayload",
|
|
660
|
+
parameters: [
|
|
661
|
+
{ name: "[key: string]", type: "any", description: "Additional abort data" }
|
|
662
|
+
]
|
|
663
|
+
}]
|
|
664
|
+
}
|
|
665
|
+
]}
|
|
666
|
+
/>
|
|
667
|
+
|
|
668
|
+
## Object and Output Chunks
|
|
669
|
+
|
|
670
|
+
### object
|
|
671
|
+
|
|
672
|
+
Emitted when using output generation with defined schemas. Contains partial or complete structured data that conforms to the specified Zod or JSON schema. This chunk is typically skipped in some execution contexts and used for streaming structured object generation.
|
|
673
|
+
|
|
674
|
+
<PropertiesTable
|
|
675
|
+
content={[
|
|
676
|
+
{
|
|
677
|
+
name: "type",
|
|
678
|
+
type: '"object"',
|
|
679
|
+
description: "Chunk type identifier"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
name: "object",
|
|
683
|
+
type: "PartialSchemaOutput<OUTPUT>",
|
|
684
|
+
description: "Partial or complete structured data matching the defined schema. The type is determined by the OUTPUT schema parameter."
|
|
685
|
+
}
|
|
686
|
+
]}
|
|
687
|
+
/>
|
|
688
|
+
|
|
689
|
+
### tool-output
|
|
690
|
+
|
|
691
|
+
Contains output from agent or workflow execution, particularly used for tracking usage statistics and completion events. Often wraps other chunk types (like finish chunks) to provide nested execution context.
|
|
692
|
+
|
|
693
|
+
<PropertiesTable
|
|
694
|
+
content={[
|
|
695
|
+
{
|
|
696
|
+
name: "type",
|
|
697
|
+
type: '"tool-output"',
|
|
698
|
+
description: "Chunk type identifier"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "payload",
|
|
702
|
+
type: "ToolOutputPayload",
|
|
703
|
+
description: "Wrapped execution output with metadata",
|
|
704
|
+
properties: [{
|
|
705
|
+
type: "ToolOutputPayload",
|
|
706
|
+
parameters: [
|
|
707
|
+
{ name: "output", type: "ChunkType", description: "Nested chunk data, often containing finish events with usage statistics" }
|
|
708
|
+
]
|
|
709
|
+
}]
|
|
710
|
+
}
|
|
711
|
+
]}
|
|
712
|
+
/>
|
|
713
|
+
|
|
714
|
+
### step-output
|
|
715
|
+
|
|
716
|
+
Contains output from workflow step execution, used primarily for usage tracking and step completion events. Similar to tool-output but specifically for individual workflow steps.
|
|
717
|
+
|
|
718
|
+
<PropertiesTable
|
|
719
|
+
content={[
|
|
720
|
+
{
|
|
721
|
+
name: "type",
|
|
722
|
+
type: '"step-output"',
|
|
723
|
+
description: "Chunk type identifier"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
name: "payload",
|
|
727
|
+
type: "StepOutputPayload",
|
|
728
|
+
description: "Workflow step execution output with metadata",
|
|
729
|
+
properties: [{
|
|
730
|
+
type: "StepOutputPayload",
|
|
731
|
+
parameters: [
|
|
732
|
+
{ name: "output", type: "ChunkType", description: "Nested chunk data from step execution, typically containing finish events or other step results" }
|
|
733
|
+
]
|
|
734
|
+
}]
|
|
735
|
+
}
|
|
736
|
+
]}
|
|
737
|
+
/>
|
|
738
|
+
|
|
739
|
+
## Metadata and Special Chunks
|
|
740
|
+
|
|
741
|
+
### response-metadata
|
|
742
|
+
|
|
743
|
+
Contains metadata about the LLM provider's response. Emitted by some providers after text generation to provide additional context like model ID, timestamps, and response headers. This chunk is used internally for state tracking and doesn't affect message assembly.
|
|
744
|
+
|
|
745
|
+
<PropertiesTable
|
|
746
|
+
content={[
|
|
747
|
+
{
|
|
748
|
+
name: "type",
|
|
749
|
+
type: '"response-metadata"',
|
|
750
|
+
description: "Chunk type identifier"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "payload",
|
|
754
|
+
type: "ResponseMetadataPayload",
|
|
755
|
+
description: "Provider response metadata for tracking and debugging",
|
|
756
|
+
properties: [{
|
|
757
|
+
type: "ResponseMetadataPayload",
|
|
758
|
+
parameters: [
|
|
759
|
+
{ name: "signature", type: "string", isOptional: true, description: "Response signature if available" },
|
|
760
|
+
{ name: "[key: string]", type: "any", description: "Additional provider-specific metadata fields (e.g., id, modelId, timestamp, headers)" }
|
|
761
|
+
]
|
|
762
|
+
}]
|
|
763
|
+
}
|
|
764
|
+
]}
|
|
765
|
+
/>
|
|
766
|
+
|
|
767
|
+
### watch
|
|
768
|
+
|
|
769
|
+
Contains monitoring and observability data from agent execution. Can include workflow state information, execution progress, or other runtime details depending on the context where `streamVNext()` is used.
|
|
770
|
+
|
|
771
|
+
<PropertiesTable
|
|
772
|
+
content={[
|
|
773
|
+
{
|
|
774
|
+
name: "type",
|
|
775
|
+
type: '"watch"',
|
|
776
|
+
description: "Chunk type identifier"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "payload",
|
|
780
|
+
type: "WatchPayload",
|
|
781
|
+
description: "Monitoring data for observability and debugging of agent execution",
|
|
782
|
+
properties: [{
|
|
783
|
+
type: "WatchPayload",
|
|
784
|
+
parameters: [
|
|
785
|
+
{ name: "workflowState", type: "object", isOptional: true, description: "Current workflow execution state (when used in workflows)" },
|
|
786
|
+
{ name: "eventTimestamp", type: "number", isOptional: true, description: "Timestamp when the event occurred" },
|
|
787
|
+
{ name: "[key: string]", type: "any", description: "Additional monitoring and execution data" }
|
|
788
|
+
]
|
|
789
|
+
}]
|
|
790
|
+
}
|
|
791
|
+
]}
|
|
792
|
+
/>
|
|
793
|
+
|
|
794
|
+
### tripwire
|
|
795
|
+
|
|
796
|
+
Emitted when the stream is forcibly terminated due to content being blocked by output processors. This acts as a safety mechanism to prevent harmful or inappropriate content from being streamed.
|
|
797
|
+
|
|
798
|
+
<PropertiesTable
|
|
799
|
+
content={[
|
|
800
|
+
{
|
|
801
|
+
name: "type",
|
|
802
|
+
type: '"tripwire"',
|
|
803
|
+
description: "Chunk type identifier"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: "payload",
|
|
807
|
+
type: "TripwirePayload",
|
|
808
|
+
description: "Information about why the stream was terminated by safety mechanisms",
|
|
809
|
+
properties: [{
|
|
810
|
+
type: "TripwirePayload",
|
|
811
|
+
parameters: [
|
|
812
|
+
{ name: "tripwireReason", type: "string", description: "Explanation of why the content was blocked (e.g., 'Output processor blocked content')" }
|
|
813
|
+
]
|
|
814
|
+
}]
|
|
815
|
+
}
|
|
816
|
+
]}
|
|
817
|
+
/>
|
|
818
|
+
|
|
819
|
+
## Usage Example
|
|
820
|
+
|
|
821
|
+
```typescript
|
|
822
|
+
const stream = await agent.streamVNext("Hello");
|
|
823
|
+
|
|
824
|
+
for await (const chunk of stream.fullStream) {
|
|
825
|
+
switch (chunk.type) {
|
|
826
|
+
case 'text-delta':
|
|
827
|
+
console.log('Text:', chunk.payload.text);
|
|
828
|
+
break;
|
|
829
|
+
|
|
830
|
+
case 'tool-call':
|
|
831
|
+
console.log('Calling tool:', chunk.payload.toolName);
|
|
832
|
+
break;
|
|
833
|
+
|
|
834
|
+
case 'tool-result':
|
|
835
|
+
console.log('Tool result:', chunk.payload.result);
|
|
836
|
+
break;
|
|
837
|
+
|
|
838
|
+
case 'reasoning-delta':
|
|
839
|
+
console.log('Reasoning:', chunk.payload.text);
|
|
840
|
+
break;
|
|
841
|
+
|
|
842
|
+
case 'finish':
|
|
843
|
+
console.log('Finished:', chunk.payload.stepResult.reason);
|
|
844
|
+
console.log('Usage:', chunk.payload.output.usage);
|
|
845
|
+
break;
|
|
846
|
+
|
|
847
|
+
case 'error':
|
|
848
|
+
console.error('Error:', chunk.payload.error);
|
|
849
|
+
break;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
## Related Types
|
|
855
|
+
|
|
856
|
+
- [MastraModelOutput](/reference/agents/MastraModelOutput) - The stream object that emits these chunks
|
|
857
|
+
- [Agent.streamVNext()](/reference/agents/streamVNext) - Method that returns streams emitting these chunks
|