@mastra/mcp-docs-server 1.0.0-beta.10 → 1.0.0-beta.13

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.
Files changed (168) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +12 -12
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +50 -50
  3. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +45 -45
  5. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +109 -109
  6. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +39 -39
  7. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +39 -39
  8. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +38 -0
  9. package/.docs/organized/changelogs/%40mastra%2Fcore.md +264 -264
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +25 -25
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +37 -37
  12. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +39 -39
  13. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  14. package/.docs/organized/changelogs/%40mastra%2Flance.md +39 -39
  15. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +45 -45
  16. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +22 -22
  17. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +13 -13
  18. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +39 -39
  19. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +39 -39
  20. package/.docs/organized/changelogs/%40mastra%2Fpg.md +45 -45
  21. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +104 -104
  22. package/.docs/organized/changelogs/%40mastra%2Freact.md +66 -0
  23. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  24. package/.docs/organized/changelogs/%40mastra%2Fserver.md +59 -59
  25. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +39 -39
  26. package/.docs/organized/changelogs/create-mastra.md +31 -31
  27. package/.docs/organized/changelogs/mastra.md +49 -49
  28. package/.docs/organized/code-examples/quick-start.md +0 -4
  29. package/.docs/organized/code-examples/stock-price-tool.md +21 -2
  30. package/.docs/raw/agents/agent-approval.mdx +136 -2
  31. package/.docs/raw/agents/agent-memory.mdx +4 -4
  32. package/.docs/raw/agents/guardrails.mdx +44 -7
  33. package/.docs/raw/agents/networks.mdx +1 -1
  34. package/.docs/raw/agents/overview.mdx +2 -2
  35. package/.docs/raw/agents/processors.mdx +151 -0
  36. package/.docs/raw/agents/using-tools.mdx +1 -1
  37. package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +1 -2
  38. package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +1 -1
  39. package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -2
  40. package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +1 -1
  41. package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +1 -1
  42. package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +1 -1
  43. package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +1 -1
  44. package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +1 -1
  45. package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +2 -2
  46. package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -2
  47. package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +1 -2
  48. package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +3 -4
  49. package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +2 -3
  50. package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +2 -3
  51. package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +1 -2
  52. package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +2 -3
  53. package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +2 -3
  54. package/.docs/raw/deployment/cloud-providers.mdx +20 -0
  55. package/.docs/raw/deployment/{building-mastra.mdx → mastra-server.mdx} +2 -2
  56. package/.docs/raw/deployment/monorepo.mdx +23 -44
  57. package/.docs/raw/deployment/overview.mdx +28 -53
  58. package/.docs/raw/deployment/web-framework.mdx +12 -14
  59. package/.docs/raw/getting-started/mcp-docs-server.mdx +57 -0
  60. package/.docs/raw/getting-started/start.mdx +10 -1
  61. package/.docs/raw/getting-started/studio.mdx +25 -2
  62. package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +1021 -67
  63. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/aws-lambda.mdx +3 -6
  64. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/azure-app-services.mdx +4 -6
  65. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/cloudflare-deployer.mdx +4 -0
  66. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/digital-ocean.mdx +3 -6
  67. package/.docs/raw/guides/deployment/index.mdx +32 -0
  68. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/netlify-deployer.mdx +4 -0
  69. package/.docs/raw/{deployment/cloud-providers → guides/deployment}/vercel-deployer.mdx +4 -0
  70. package/.docs/raw/guides/getting-started/express.mdx +71 -152
  71. package/.docs/raw/guides/getting-started/hono.mdx +227 -0
  72. package/.docs/raw/guides/getting-started/next-js.mdx +173 -63
  73. package/.docs/raw/guides/getting-started/vite-react.mdx +307 -137
  74. package/.docs/raw/guides/guide/research-assistant.mdx +4 -4
  75. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +70 -0
  76. package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +17 -0
  77. package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +6 -0
  78. package/.docs/raw/index.mdx +1 -1
  79. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/dashboard.mdx +2 -6
  80. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/observability.mdx +1 -5
  81. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/overview.mdx +2 -6
  82. package/.docs/raw/{deployment/mastra-cloud → mastra-cloud}/setting-up.mdx +3 -6
  83. package/.docs/raw/memory/overview.mdx +1 -1
  84. package/.docs/raw/memory/storage/memory-with-libsql.mdx +1 -1
  85. package/.docs/raw/memory/storage/memory-with-mongodb.mdx +1 -1
  86. package/.docs/raw/memory/storage/memory-with-pg.mdx +1 -1
  87. package/.docs/raw/memory/storage/memory-with-upstash.mdx +1 -1
  88. package/.docs/raw/{server-db/storage.mdx → memory/storage/overview.mdx} +2 -2
  89. package/.docs/raw/observability/logging.mdx +1 -1
  90. package/.docs/raw/observability/tracing/exporters/cloud.mdx +1 -1
  91. package/.docs/raw/observability/tracing/exporters/default.mdx +1 -1
  92. package/.docs/raw/rag/chunking-and-embedding.mdx +12 -25
  93. package/.docs/raw/rag/graph-rag.mdx +220 -0
  94. package/.docs/raw/rag/overview.mdx +1 -2
  95. package/.docs/raw/rag/retrieval.mdx +13 -29
  96. package/.docs/raw/rag/vector-databases.mdx +7 -3
  97. package/.docs/raw/reference/agents/agent.mdx +11 -4
  98. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +1 -1
  99. package/.docs/raw/reference/agents/getDefaultOptions.mdx +1 -1
  100. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +1 -1
  101. package/.docs/raw/reference/agents/getInstructions.mdx +1 -1
  102. package/.docs/raw/reference/agents/getLLM.mdx +1 -1
  103. package/.docs/raw/reference/agents/getMemory.mdx +1 -1
  104. package/.docs/raw/reference/agents/getModel.mdx +1 -1
  105. package/.docs/raw/reference/agents/listScorers.mdx +1 -1
  106. package/.docs/raw/reference/ai-sdk/chat-route.mdx +1 -1
  107. package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +1 -1
  108. package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +1 -1
  109. package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +1 -1
  110. package/.docs/raw/reference/ai-sdk/network-route.mdx +1 -1
  111. package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +127 -0
  112. package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +107 -0
  113. package/.docs/raw/reference/ai-sdk/workflow-route.mdx +1 -1
  114. package/.docs/raw/reference/auth/auth0.mdx +1 -1
  115. package/.docs/raw/reference/auth/clerk.mdx +1 -1
  116. package/.docs/raw/reference/auth/firebase.mdx +1 -1
  117. package/.docs/raw/reference/auth/jwt.mdx +1 -1
  118. package/.docs/raw/reference/auth/supabase.mdx +1 -1
  119. package/.docs/raw/reference/auth/workos.mdx +1 -1
  120. package/.docs/raw/reference/cli/mastra.mdx +1 -1
  121. package/.docs/raw/reference/client-js/mastra-client.mdx +1 -1
  122. package/.docs/raw/reference/client-js/workflows.mdx +20 -0
  123. package/.docs/raw/reference/core/getServer.mdx +3 -3
  124. package/.docs/raw/reference/core/getStorage.mdx +1 -1
  125. package/.docs/raw/reference/core/getStoredAgentById.mdx +1 -1
  126. package/.docs/raw/reference/core/listStoredAgents.mdx +1 -1
  127. package/.docs/raw/reference/core/setStorage.mdx +1 -1
  128. package/.docs/raw/reference/logging/pino-logger.mdx +1 -1
  129. package/.docs/raw/reference/processors/processor-interface.mdx +314 -13
  130. package/.docs/raw/reference/rag/database-config.mdx +1 -1
  131. package/.docs/raw/reference/server/create-route.mdx +1 -1
  132. package/.docs/raw/reference/server/express-adapter.mdx +4 -4
  133. package/.docs/raw/reference/server/hono-adapter.mdx +4 -4
  134. package/.docs/raw/reference/server/mastra-server.mdx +2 -2
  135. package/.docs/raw/reference/server/routes.mdx +28 -1
  136. package/.docs/raw/reference/streaming/ChunkType.mdx +23 -2
  137. package/.docs/raw/reference/streaming/agents/stream.mdx +38 -29
  138. package/.docs/raw/reference/streaming/workflows/stream.mdx +33 -20
  139. package/.docs/raw/reference/tools/create-tool.mdx +23 -1
  140. package/.docs/raw/reference/tools/graph-rag-tool.mdx +3 -3
  141. package/.docs/raw/reference/tools/vector-query-tool.mdx +3 -3
  142. package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +143 -0
  143. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +35 -0
  144. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +68 -3
  145. package/.docs/raw/reference/workflows/workflow.mdx +37 -0
  146. package/.docs/raw/{auth → server/auth}/auth0.mdx +1 -1
  147. package/.docs/raw/{auth → server/auth}/clerk.mdx +1 -1
  148. package/.docs/raw/{auth → server/auth}/firebase.mdx +1 -1
  149. package/.docs/raw/{auth → server/auth}/index.mdx +6 -6
  150. package/.docs/raw/{auth → server/auth}/jwt.mdx +1 -1
  151. package/.docs/raw/{auth → server/auth}/supabase.mdx +1 -1
  152. package/.docs/raw/{auth → server/auth}/workos.mdx +1 -1
  153. package/.docs/raw/{server-db → server}/custom-adapters.mdx +3 -3
  154. package/.docs/raw/{server-db → server}/custom-api-routes.mdx +1 -1
  155. package/.docs/raw/{server-db → server}/mastra-client.mdx +2 -2
  156. package/.docs/raw/{server-db → server}/mastra-server.mdx +12 -10
  157. package/.docs/raw/{server-db → server}/middleware.mdx +2 -2
  158. package/.docs/raw/{server-db → server}/request-context.mdx +3 -3
  159. package/.docs/raw/{server-db → server}/server-adapters.mdx +6 -6
  160. package/.docs/raw/tools-mcp/overview.mdx +2 -2
  161. package/.docs/raw/workflows/control-flow.mdx +348 -2
  162. package/.docs/raw/workflows/error-handling.mdx +162 -1
  163. package/.docs/raw/workflows/overview.mdx +2 -2
  164. package/CHANGELOG.md +21 -0
  165. package/package.json +5 -5
  166. package/.docs/organized/changelogs/%40internal%2Fai-sdk-v4.md +0 -1
  167. package/.docs/raw/deployment/cloud-providers/index.mdx +0 -55
  168. /package/.docs/raw/{deployment/cloud-providers → guides/deployment}/amazon-ec2.mdx +0 -0
@@ -72,4 +72,4 @@ await agent.getDefaultGenerateOptionsLegacy({
72
72
  ## Related
73
73
 
74
74
  - [Agent generation](/docs/v1/agents/overview#generating-responses)
75
- - [Request Context](/docs/v1/server-db/request-context)
75
+ - [Request Context](/docs/v1/server/request-context)
@@ -66,4 +66,4 @@ await agent.getDefaultOptions({
66
66
  ## Related
67
67
 
68
68
  - [Streaming with agents](/docs/v1/streaming/overview#streaming-with-agents)
69
- - [Request Context](/docs/v1/server-db/request-context)
69
+ - [Request Context](/docs/v1/server/request-context)
@@ -72,4 +72,4 @@ await agent.getDefaultStreamOptionsLegacy({
72
72
  ## Related
73
73
 
74
74
  - [Streaming with agents](/docs/v1/streaming/overview#streaming-with-agents)
75
- - [Request Context](/docs/v1/server-db/request-context)
75
+ - [Request Context](/docs/v1/server/request-context)
@@ -66,4 +66,4 @@ await agent.getInstructions({
66
66
  ## Related
67
67
 
68
68
  - [Agents overview](/docs/v1/agents/overview)
69
- - [Request Context](/docs/v1/server-db/request-context)
69
+ - [Request Context](/docs/v1/server/request-context)
@@ -75,4 +75,4 @@ await agent.getLLM({
75
75
  ## Related
76
76
 
77
77
  - [Agents overview](/docs/v1/agents/overview)
78
- - [Request Context](/docs/v1/server-db/request-context)
78
+ - [Request Context](/docs/v1/server/request-context)
@@ -66,4 +66,4 @@ await agent.getMemory({
66
66
  ## Related
67
67
 
68
68
  - [Agent memory](/docs/v1/agents/agent-memory)
69
- - [Request Context](/docs/v1/server-db/request-context)
69
+ - [Request Context](/docs/v1/server/request-context)
@@ -66,4 +66,4 @@ await agent.getModel({
66
66
  ## Related
67
67
 
68
68
  - [Agents overview](/docs/v1/agents/overview)
69
- - [Request Context](/docs/v1/server-db/request-context)
69
+ - [Request Context](/docs/v1/server/request-context)
@@ -66,4 +66,4 @@ await agent.listScorers({
66
66
  ## Related
67
67
 
68
68
  - [Agents overview](/docs/v1/agents/overview)
69
- - [Request Context](/docs/v1/server-db/request-context)
69
+ - [Request Context](/docs/v1/server/request-context)
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # chatRoute()
9
9
 
10
- Creates a chat route handler for streaming agent conversations using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](/docs/v1/server-db/custom-api-routes).
10
+ Creates a chat route handler for streaming agent conversations using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](/docs/v1/server/custom-api-routes).
11
11
 
12
12
  Use [`handleChatStream()`](/reference/v1/ai-sdk/handle-chat-stream) if you need a framework-agnostic handler.
13
13
 
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # handleChatStream()
9
9
 
10
- Framework-agnostic handler for streaming agent chat in AI SDK-compatible format. Use this function directly when you need to handle chat streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server-db/custom-api-routes) feature.
10
+ Framework-agnostic handler for streaming agent chat in AI SDK-compatible format. Use this function directly when you need to handle chat streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server/custom-api-routes) feature.
11
11
 
12
12
  `handleChatStream()` returns a `ReadableStream` that you can wrap with [`createUIMessageStreamResponse()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/create-ui-message-stream-response).
13
13
 
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # handleNetworkStream()
9
9
 
10
- Framework-agnostic handler for streaming network execution in AI SDK-compatible format. Use this function directly when you need to handle network streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server-db/custom-api-routes) feature.
10
+ Framework-agnostic handler for streaming network execution in AI SDK-compatible format. Use this function directly when you need to handle network streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server/custom-api-routes) feature.
11
11
 
12
12
  `handleNetworkStream()` returns a `ReadableStream` that you can wrap with [`createUIMessageStreamResponse()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/create-ui-message-stream-response).
13
13
 
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # handleWorkflowStream()
9
9
 
10
- Framework-agnostic handler for streaming workflow execution in AI SDK-compatible format. Use this function directly when you need to handle workflow streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server-db/custom-api-routes) feature.
10
+ Framework-agnostic handler for streaming workflow execution in AI SDK-compatible format. Use this function directly when you need to handle workflow streaming outside Hono or Mastra's own [apiRoutes](/docs/v1/server/custom-api-routes) feature.
11
11
 
12
12
  `handleWorkflowStream()` returns a `ReadableStream` that you can wrap with [`createUIMessageStreamResponse()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/create-ui-message-stream-response).
13
13
 
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # networkRoute()
9
9
 
10
- Creates a network route handler for streaming network execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent network, and streams the response back to the client in AI SDK-compatible format. Agent networks allow a routing agent to delegate tasks to other agents. You have to use it inside a [custom API route](/docs/v1/server-db/custom-api-routes).
10
+ Creates a network route handler for streaming network execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent network, and streams the response back to the client in AI SDK-compatible format. Agent networks allow a routing agent to delegate tasks to other agents. You have to use it inside a [custom API route](/docs/v1/server/custom-api-routes).
11
11
 
12
12
  Use [`handleNetworkStream()`](/reference/v1/ai-sdk/handle-network-stream) if you need a framework-agnostic handler.
13
13
 
@@ -0,0 +1,127 @@
1
+ ---
2
+ title: "Reference: toAISdkV4Messages() | AI SDK"
3
+ description: API reference for toAISdkV4Messages(), a function to convert Mastra messages to AI SDK v4 UI messages.
4
+ ---
5
+
6
+ import PropertiesTable from "@site/src/components/PropertiesTable";
7
+
8
+ # toAISdkV4Messages()
9
+
10
+ Converts messages from various input formats to AI SDK V4 UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V4 `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
11
+
12
+ ## Usage example
13
+
14
+ ```typescript title="app/chat/page.tsx" copy
15
+ import { toAISdkV4Messages } from "@mastra/ai-sdk";
16
+ import { useChat } from "ai/react"; // AI SDK V4
17
+
18
+ // Stored messages from your database, memory or API
19
+ const storedMessages = [
20
+ { id: "1", role: "user", parts: [{ type: "text", text: "Hello" }] },
21
+ { id: "2", role: "assistant", parts: [{ type: "text", text: "Hi there!" }] }
22
+ ];
23
+
24
+ export default function Chat() {
25
+ const { messages } = useChat({
26
+ initialMessages: toAISdkV4Messages(storedMessages)
27
+ });
28
+
29
+ return (
30
+ <div>
31
+ {messages.map((message) => (
32
+ <div key={message.id}>
33
+ {message.role}: {message.content}
34
+ </div>
35
+ ))}
36
+ </div>
37
+ );
38
+ }
39
+ ```
40
+
41
+ ## Parameters
42
+
43
+ <PropertiesTable
44
+ content={[
45
+ {
46
+ name: "messages",
47
+ type: "MessageListInput",
48
+ description: "Messages to convert. Can be a string, array of strings, a single message object, or an array of message objects in any supported format.",
49
+ isOptional: false,
50
+ },
51
+ ]}
52
+ />
53
+
54
+ ## Returns
55
+
56
+ Returns an array of AI SDK V4 `UIMessage` objects with the following structure:
57
+
58
+ <PropertiesTable
59
+ content={[
60
+ {
61
+ name: "id",
62
+ type: "string",
63
+ description: "Unique message identifier.",
64
+ },
65
+ {
66
+ name: "role",
67
+ type: "'user' | 'assistant' | 'system'",
68
+ description: "The role of the message sender.",
69
+ },
70
+ {
71
+ name: "content",
72
+ type: "string",
73
+ description: "Text content of the message.",
74
+ },
75
+ {
76
+ name: "parts",
77
+ type: "UIMessagePart[]",
78
+ description: "Array of UI parts including text, tool-invocation, file, reasoning, source, and step markers.",
79
+ },
80
+ {
81
+ name: "createdAt",
82
+ type: "Date",
83
+ description: "Message creation timestamp.",
84
+ },
85
+ {
86
+ name: "toolInvocations",
87
+ type: "ToolInvocation[]",
88
+ description: "Array of tool invocations for assistant messages.",
89
+ isOptional: true,
90
+ },
91
+ {
92
+ name: "experimental_attachments",
93
+ type: "Attachment[]",
94
+ description: "File attachments on the message.",
95
+ isOptional: true,
96
+ },
97
+ {
98
+ name: "metadata",
99
+ type: "Record<string, unknown>",
100
+ description: "Custom metadata attached to the message.",
101
+ isOptional: true,
102
+ },
103
+ ]}
104
+ />
105
+
106
+ ## Examples
107
+
108
+ ### Converting simple text messages
109
+
110
+ ```typescript copy
111
+ import { toAISdkV4Messages } from "@mastra/ai-sdk";
112
+
113
+ const messages = toAISdkV4Messages(["Hello", "How can I help you today?"]);
114
+ // Returns array of UIMessage objects with user role and content string
115
+ ```
116
+
117
+ ### Loading messages with Mastra client
118
+
119
+ ```typescript copy
120
+ import { MastraClient } from "@mastra/client-js";
121
+ import { toAISdkV4Messages } from "@mastra/ai-sdk";
122
+
123
+ const client = new MastraClient();
124
+
125
+ const { messages } = await client.listThreadMessages("thread-id", { agentId: "myAgent" });
126
+ const uiMessages = toAISdkV4Messages(messages);
127
+ ```
@@ -0,0 +1,107 @@
1
+ ---
2
+ title: "Reference: toAISdkV5Messages() | AI SDK"
3
+ description: API reference for toAISdkV5Messages(), a function to convert Mastra messages to AI SDK v5 UI messages.
4
+ ---
5
+
6
+ import PropertiesTable from "@site/src/components/PropertiesTable";
7
+
8
+ # toAISdkV5Messages()
9
+
10
+ Converts messages from various input formats to AI SDK V5 UI message format. This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V5 `UIMessage` format, which is suitable for use with AI SDK UI components like `useChat()`.
11
+
12
+ ## Usage example
13
+
14
+ ```typescript title="app/chat/page.tsx" copy
15
+ import { toAISdkV5Messages } from "@mastra/ai-sdk";
16
+ import { useChat } from "ai/react";
17
+
18
+ // Stored messages from your database, memory or API
19
+ const storedMessages = [
20
+ { id: "1", role: "user", content: "Hello", parts: [{ type: "text", text: "Hello" }] },
21
+ { id: "2", role: "assistant", content: "Hi there!", parts: [{ type: "text", text: "Hi there!" }] }
22
+ ];
23
+
24
+ export default function Chat() {
25
+ const { messages } = useChat({
26
+ initialMessages: toAISdkV5Messages(storedMessages)
27
+ });
28
+
29
+ return (
30
+ <div>
31
+ {messages.map((message) => (
32
+ <div key={message.id}>
33
+ {message.role}: {message.parts.map(part =>
34
+ part.type === "text" ? part.text : null
35
+ )}
36
+ </div>
37
+ ))}
38
+ </div>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Parameters
44
+
45
+ <PropertiesTable
46
+ content={[
47
+ {
48
+ name: "messages",
49
+ type: "MessageListInput",
50
+ description: "Messages to convert. Can be a string, array of strings, a single message object, or an array of message objects in any supported format.",
51
+ isOptional: false,
52
+ },
53
+ ]}
54
+ />
55
+
56
+ ## Returns
57
+
58
+ Returns an array of AI SDK V5 `UIMessage` objects with the following structure:
59
+
60
+ <PropertiesTable
61
+ content={[
62
+ {
63
+ name: "id",
64
+ type: "string",
65
+ description: "Unique message identifier.",
66
+ },
67
+ {
68
+ name: "role",
69
+ type: "'user' | 'assistant' | 'system'",
70
+ description: "The role of the message sender.",
71
+ },
72
+ {
73
+ name: "parts",
74
+ type: "UIMessagePart[]",
75
+ description: "Array of UI parts including text, tool results, files, reasoning, sources, and step markers.",
76
+ },
77
+ {
78
+ name: "metadata",
79
+ type: "Record<string, unknown>",
80
+ description: "Optional metadata including createdAt, threadId, resourceId, and custom fields.",
81
+ isOptional: true,
82
+ },
83
+ ]}
84
+ />
85
+
86
+ ## Examples
87
+
88
+ ### Converting simple text messages
89
+
90
+ ```typescript copy
91
+ import { toAISdkV5Messages } from "@mastra/ai-sdk";
92
+
93
+ const messages = toAISdkV5Messages(["Hello", "How can I help you today?"]);
94
+ // Returns array of UIMessage objects with user role
95
+ ```
96
+
97
+ ### Loading messages with Mastra client
98
+
99
+ ```typescript copy
100
+ import { MastraClient } from "@mastra/client-js";
101
+ import { toAISdkV5Messages } from "@mastra/ai-sdk";
102
+
103
+ const client = new MastraClient();
104
+
105
+ const { messages } = await client.listThreadMessages("thread-id", { agentId: "myAgent" });
106
+ const uiMessages = toAISdkV5Messages(messages);
107
+ ```
@@ -7,7 +7,7 @@ import PropertiesTable from "@site/src/components/PropertiesTable";
7
7
 
8
8
  # workflowRoute()
9
9
 
10
- Creates a workflow route handler for streaming workflow execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts input data, executes a workflow, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](/docs/v1/server-db/custom-api-routes).
10
+ Creates a workflow route handler for streaming workflow execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts input data, executes a workflow, and streams the response back to the client in AI SDK-compatible format. You have to use it inside a [custom API route](/docs/v1/server/custom-api-routes).
11
11
 
12
12
  Use [`handleWorkflowStream()`](/reference/v1/ai-sdk/handle-workflow-stream) if you need a framework-agnostic handler.
13
13
 
@@ -118,4 +118,4 @@ The exact properties available depend on your Auth0 configuration, scopes reques
118
118
 
119
119
  ## Related
120
120
 
121
- [MastraAuthAuth0 Class](/docs/v1/auth/auth0)
121
+ [MastraAuthAuth0 Class](/docs/v1/server/auth/auth0)
@@ -71,4 +71,4 @@ export const mastra = new Mastra({
71
71
 
72
72
  ## Related
73
73
 
74
- [MastraAuthClerk Class](/docs/v1/auth/clerk)
74
+ [MastraAuthClerk Class](/docs/v1/server/auth/clerk)
@@ -132,4 +132,4 @@ The `FirebaseUser` type used in the `authorizeUser` function corresponds to Fire
132
132
 
133
133
  ## Related
134
134
 
135
- [MastraAuthFirebase Class](/docs/v1/auth/firebase)
135
+ [MastraAuthFirebase Class](/docs/v1/server/auth/firebase)
@@ -39,4 +39,4 @@ export const mastra = new Mastra({
39
39
 
40
40
  ## Related
41
41
 
42
- [MastraJwtAuth](/docs/v1/auth/jwt)
42
+ [MastraJwtAuth](/docs/v1/server/auth/jwt)
@@ -62,4 +62,4 @@ export const mastra = new Mastra({
62
62
 
63
63
  ## Related
64
64
 
65
- [MastraAuthSupabase](/docs/v1/auth/supabase)
65
+ [MastraAuthSupabase](/docs/v1/server/auth/supabase)
@@ -129,4 +129,4 @@ The properties with `urn:myapp:` prefixes are custom claims configured in your W
129
129
 
130
130
  ## Related
131
131
 
132
- [MastraAuthWorkos Class](/docs/v1/auth/workos)
132
+ [MastraAuthWorkos Class](/docs/v1/server/auth/workos)
@@ -86,7 +86,7 @@ Under the hood Mastra's Rollup server locates your Mastra entry file and bundles
86
86
 
87
87
  The output in `.mastra` can be deployed to any cloud server using [`mastra start`](#mastra-start).
88
88
 
89
- If you're deploying to a [serverless platform](/docs/v1/deployment/cloud-providers) you need to install the correct deployer in order to receive the correct output in `.mastra`.
89
+ If you're deploying to a [serverless platform](/guides/v1/deployment) you need to install the correct deployer in order to receive the correct output in `.mastra`.
90
90
 
91
91
  It accepts [common flags][common-flags].
92
92
 
@@ -5,7 +5,7 @@ description: Learn how to interact with Mastra using the client-js SDK.
5
5
 
6
6
  # Mastra Client SDK
7
7
 
8
- The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](/docs/v1/deployment/building-mastra) from your client environment.
8
+ The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](/docs/v1/deployment/mastra-server) from your client environment.
9
9
 
10
10
  ## Usage example
11
11
 
@@ -48,8 +48,16 @@ const run = await workflow.createRun();
48
48
 
49
49
  // Or with an existing runId
50
50
  const run = await workflow.createRun({ runId: "existing-run-id" });
51
+
52
+ // Or with a resourceId to associate the run with a specific resource
53
+ const run = await workflow.createRun({
54
+ runId: "my-run-id",
55
+ resourceId: "user-123"
56
+ });
51
57
  ```
52
58
 
59
+ The `resourceId` parameter associates the workflow run with a specific resource (e.g., user ID, tenant ID). This value is persisted with the run and can be used for filtering and querying runs later.
60
+
53
61
  ### startAsync()
54
62
 
55
63
  Start a workflow run and await the full result:
@@ -80,6 +88,18 @@ const result = await run.startAsync({
80
88
 
81
89
  The `initialState` object should match the structure defined in the workflow's `stateSchema`. See [Workflow State](/docs/v1/workflows/workflow-state) for more details.
82
90
 
91
+ To associate a run with a specific resource, pass `resourceId` to `createRun()`:
92
+
93
+ ```typescript
94
+ const run = await workflow.createRun({ resourceId: "user-123" });
95
+
96
+ const result = await run.startAsync({
97
+ inputData: {
98
+ city: "New York",
99
+ },
100
+ });
101
+ ```
102
+
83
103
  ### start()
84
104
 
85
105
  Start a workflow run without waiting for completion:
@@ -25,12 +25,12 @@ This method does not accept any parameters.
25
25
  name: "server",
26
26
  type: "ServerConfig | undefined",
27
27
  description:
28
- "The configured server configuration including port, timeout, API routes, middleware, CORS settings, and build options, or undefined if no server has been configured.",
28
+ "The configured server configuration including port, host, studioBase, timeout, API routes, middleware, CORS settings, and build options, or undefined if no server has been configured.",
29
29
  },
30
30
  ]}
31
31
  />
32
32
 
33
33
  ## Related
34
34
 
35
- - [Server deployment](/docs/v1/deployment/building-mastra)
36
- - [Server configuration](/docs/v1/server-db/custom-api-routes)
35
+ - [Server deployment](/docs/v1/deployment/mastra-server)
36
+ - [Server configuration](/docs/v1/server/custom-api-routes)
@@ -32,5 +32,5 @@ This method does not accept any parameters.
32
32
 
33
33
  ## Related
34
34
 
35
- - [Storage overview](/docs/v1/server-db/storage)
35
+ - [Storage overview](/docs/v1/memory/storage/overview)
36
36
  - [Storage reference](/reference/v1/storage/libsql)
@@ -179,5 +179,5 @@ When using `raw: true`, the returned object has the following structure:
179
179
  ## Related
180
180
 
181
181
  - [Mastra.listStoredAgents()](/reference/v1/core/listStoredAgents)
182
- - [Storage overview](/docs/v1/server-db/storage)
182
+ - [Storage overview](/docs/v1/memory/storage/overview)
183
183
  - [Agents overview](/docs/v1/agents/overview)
@@ -147,5 +147,5 @@ async function getAllStoredAgents(mastra: Mastra) {
147
147
  ## Related
148
148
 
149
149
  - [Mastra.getStoredAgentById()](/reference/v1/core/getStoredAgentById)
150
- - [Storage overview](/docs/v1/server-db/storage)
150
+ - [Storage overview](/docs/v1/memory/storage/overview)
151
151
  - [Agents overview](/docs/v1/agents/overview)
@@ -36,5 +36,5 @@ This method does not return a value.
36
36
 
37
37
  ## Related
38
38
 
39
- - [Storage overview](/docs/v1/server-db/storage)
39
+ - [Storage overview](/docs/v1/memory/storage/overview)
40
40
  - [Storage reference](/reference/v1/storage/libsql)
@@ -7,7 +7,7 @@ description: Documentation for PinoLogger, which provides methods to record even
7
7
 
8
8
  A Logger instance is created using `new PinoLogger()` and provides methods to record events at various severity levels.
9
9
 
10
- When deploying to Mastra Cloud, logs are displayed on the [Logs](/docs/v1/deployment/mastra-cloud/dashboard#logs) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
10
+ When deploying to Mastra Cloud, logs are displayed on the [Logs](/docs/v1/mastra-cloud/dashboard#logs) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
11
11
 
12
12
  ## Usage example
13
13