@mastra/mcp-docs-server 1.0.0-beta.4 → 1.0.0-beta.6

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 (286) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +201 -1
  2. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
  3. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +201 -1
  4. package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
  5. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
  6. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
  7. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +201 -1
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
  10. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +29 -0
  11. package/.docs/organized/changelogs/%40mastra%2Fcore.md +411 -211
  12. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +201 -1
  18. package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
  20. package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +52 -0
  21. package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
  22. package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
  23. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
  24. package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
  25. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
  27. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
  28. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
  29. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
  30. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
  31. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
  32. package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
  33. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
  34. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +201 -1
  35. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
  36. package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
  37. package/.docs/organized/changelogs/%40mastra%2Freact.md +89 -1
  38. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +42 -0
  40. package/.docs/organized/changelogs/%40mastra%2Fserver.md +201 -1
  41. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
  42. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
  43. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
  56. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
  57. package/.docs/organized/changelogs/create-mastra.md +201 -1
  58. package/.docs/organized/changelogs/mastra.md +201 -1
  59. package/.docs/organized/code-examples/agui.md +1 -0
  60. package/.docs/organized/code-examples/ai-sdk-v5.md +1 -0
  61. package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
  62. package/.docs/organized/code-examples/memory-with-processors.md +1 -1
  63. package/.docs/organized/code-examples/quick-start.md +1 -1
  64. package/.docs/organized/code-examples/server-app-access.md +342 -0
  65. package/.docs/raw/agents/adding-voice.mdx +7 -10
  66. package/.docs/raw/agents/agent-approval.mdx +189 -0
  67. package/.docs/raw/agents/guardrails.mdx +26 -23
  68. package/.docs/raw/agents/networks.mdx +2 -2
  69. package/.docs/raw/agents/overview.mdx +27 -62
  70. package/.docs/raw/agents/processors.mdx +279 -0
  71. package/.docs/raw/agents/using-tools.mdx +4 -5
  72. package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
  73. package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
  74. package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
  75. package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
  76. package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
  77. package/.docs/raw/deployment/building-mastra.mdx +1 -1
  78. package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
  79. package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
  80. package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +1 -1
  81. package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
  82. package/.docs/raw/deployment/cloud-providers/index.mdx +20 -27
  83. package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
  84. package/.docs/raw/deployment/mastra-cloud/observability.mdx +19 -17
  85. package/.docs/raw/deployment/mastra-cloud/setting-up.mdx +1 -1
  86. package/.docs/raw/deployment/overview.mdx +2 -2
  87. package/.docs/raw/deployment/web-framework.mdx +5 -5
  88. package/.docs/raw/evals/custom-scorers.mdx +3 -5
  89. package/.docs/raw/evals/overview.mdx +2 -3
  90. package/.docs/raw/evals/running-in-ci.mdx +0 -2
  91. package/.docs/raw/{guides/guide → getting-started}/manual-install.mdx +2 -2
  92. package/.docs/raw/getting-started/project-structure.mdx +1 -1
  93. package/.docs/raw/getting-started/start.mdx +72 -0
  94. package/.docs/raw/getting-started/studio.mdx +1 -1
  95. package/.docs/raw/{frameworks/agentic-uis/ai-sdk.mdx → guides/build-your-ui/ai-sdk-ui.mdx} +113 -11
  96. package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +23 -25
  97. package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +3 -4
  98. package/.docs/raw/guides/{quickstarts/nextjs.mdx → getting-started/next-js.mdx} +11 -11
  99. package/.docs/raw/guides/{quickstarts/standalone-server.mdx → getting-started/quickstart.mdx} +7 -7
  100. package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +23 -25
  101. package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +7 -7
  102. package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
  103. package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
  104. package/.docs/raw/guides/guide/notes-mcp-server.mdx +2 -2
  105. package/.docs/raw/guides/guide/research-assistant.mdx +7 -8
  106. package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
  107. package/.docs/raw/guides/guide/web-search.mdx +12 -10
  108. package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
  109. package/.docs/raw/guides/index.mdx +3 -35
  110. package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
  111. package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +1 -1
  112. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +40 -0
  113. package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +5 -0
  114. package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +51 -0
  115. package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
  116. package/.docs/raw/index.mdx +2 -2
  117. package/.docs/raw/mcp/overview.mdx +3 -5
  118. package/.docs/raw/memory/memory-processors.mdx +264 -79
  119. package/.docs/raw/memory/semantic-recall.mdx +7 -7
  120. package/.docs/raw/memory/storage/memory-with-libsql.mdx +2 -4
  121. package/.docs/raw/memory/storage/memory-with-mongodb.mdx +2 -4
  122. package/.docs/raw/memory/storage/memory-with-pg.mdx +2 -4
  123. package/.docs/raw/memory/storage/memory-with-upstash.mdx +2 -4
  124. package/.docs/raw/memory/threads-and-resources.mdx +3 -3
  125. package/.docs/raw/memory/working-memory.mdx +14 -7
  126. package/.docs/raw/{logging.mdx → observability/logging.mdx} +1 -1
  127. package/.docs/raw/observability/overview.mdx +2 -3
  128. package/.docs/raw/observability/tracing/bridges/otel.mdx +176 -0
  129. package/.docs/raw/observability/tracing/exporters/arize.mdx +17 -0
  130. package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
  131. package/.docs/raw/observability/tracing/exporters/langfuse.mdx +20 -0
  132. package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
  133. package/.docs/raw/observability/tracing/exporters/otel.mdx +25 -5
  134. package/.docs/raw/observability/tracing/exporters/posthog.mdx +107 -0
  135. package/.docs/raw/observability/tracing/overview.mdx +74 -8
  136. package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
  137. package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
  138. package/.docs/raw/rag/overview.mdx +3 -2
  139. package/.docs/raw/rag/retrieval.mdx +43 -38
  140. package/.docs/raw/rag/vector-databases.mdx +93 -2
  141. package/.docs/raw/reference/agents/agent.mdx +7 -10
  142. package/.docs/raw/reference/agents/generate.mdx +55 -6
  143. package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
  144. package/.docs/raw/reference/agents/getLLM.mdx +1 -1
  145. package/.docs/raw/reference/agents/network.mdx +46 -3
  146. package/.docs/raw/reference/cli/mastra.mdx +2 -1
  147. package/.docs/raw/reference/client-js/agents.mdx +3 -3
  148. package/.docs/raw/reference/client-js/memory.mdx +43 -0
  149. package/.docs/raw/reference/client-js/workflows.mdx +92 -63
  150. package/.docs/raw/reference/core/getLogger.mdx +1 -1
  151. package/.docs/raw/reference/core/listLogs.mdx +1 -1
  152. package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
  153. package/.docs/raw/reference/core/mastra-model-gateway.mdx +5 -19
  154. package/.docs/raw/reference/core/setLogger.mdx +1 -1
  155. package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
  156. package/.docs/raw/reference/deployer/netlify.mdx +1 -2
  157. package/.docs/raw/reference/evals/answer-relevancy.mdx +28 -98
  158. package/.docs/raw/reference/evals/answer-similarity.mdx +12 -258
  159. package/.docs/raw/reference/evals/bias.mdx +29 -87
  160. package/.docs/raw/reference/evals/completeness.mdx +31 -90
  161. package/.docs/raw/reference/evals/content-similarity.mdx +28 -88
  162. package/.docs/raw/reference/evals/context-precision.mdx +28 -130
  163. package/.docs/raw/reference/evals/context-relevance.mdx +11 -11
  164. package/.docs/raw/reference/evals/faithfulness.mdx +28 -101
  165. package/.docs/raw/reference/evals/hallucination.mdx +28 -103
  166. package/.docs/raw/reference/evals/keyword-coverage.mdx +28 -107
  167. package/.docs/raw/reference/evals/noise-sensitivity.mdx +11 -11
  168. package/.docs/raw/reference/evals/prompt-alignment.mdx +15 -15
  169. package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
  170. package/.docs/raw/reference/evals/textual-difference.mdx +27 -100
  171. package/.docs/raw/reference/evals/tone-consistency.mdx +25 -98
  172. package/.docs/raw/reference/evals/tool-call-accuracy.mdx +7 -7
  173. package/.docs/raw/reference/evals/toxicity.mdx +29 -92
  174. package/.docs/raw/reference/index.mdx +1 -0
  175. package/.docs/raw/reference/memory/memory-class.mdx +5 -7
  176. package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +150 -0
  177. package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
  178. package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +4 -0
  179. package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
  180. package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +6 -0
  181. package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
  182. package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
  183. package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
  184. package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
  185. package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
  186. package/.docs/raw/reference/processors/language-detector.mdx +10 -3
  187. package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
  188. package/.docs/raw/reference/processors/moderation-processor.mdx +12 -5
  189. package/.docs/raw/reference/processors/pii-detector.mdx +12 -5
  190. package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
  191. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +10 -3
  192. package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
  193. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +3 -4
  194. package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
  195. package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
  196. package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
  197. package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
  198. package/.docs/raw/reference/rag/embeddings.mdx +5 -5
  199. package/.docs/raw/reference/rag/rerank.mdx +1 -2
  200. package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -1
  201. package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
  202. package/.docs/raw/reference/storage/convex.mdx +164 -0
  203. package/.docs/raw/reference/storage/lance.mdx +33 -0
  204. package/.docs/raw/reference/storage/libsql.mdx +37 -0
  205. package/.docs/raw/reference/storage/mongodb.mdx +39 -0
  206. package/.docs/raw/reference/storage/mssql.mdx +37 -0
  207. package/.docs/raw/reference/storage/postgresql.mdx +37 -0
  208. package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
  209. package/.docs/raw/reference/streaming/agents/stream.mdx +64 -2
  210. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
  211. package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
  212. package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
  213. package/.docs/raw/reference/templates/overview.mdx +1 -4
  214. package/.docs/raw/reference/tools/client.mdx +1 -2
  215. package/.docs/raw/reference/tools/create-tool.mdx +132 -0
  216. package/.docs/raw/reference/tools/graph-rag-tool.mdx +5 -5
  217. package/.docs/raw/reference/tools/mcp-client.mdx +76 -21
  218. package/.docs/raw/reference/tools/mcp-server.mdx +1 -2
  219. package/.docs/raw/reference/tools/vector-query-tool.mdx +14 -15
  220. package/.docs/raw/reference/vectors/chroma.mdx +81 -1
  221. package/.docs/raw/reference/vectors/convex.mdx +429 -0
  222. package/.docs/raw/reference/vectors/couchbase.mdx +24 -17
  223. package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
  224. package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
  225. package/.docs/raw/reference/vectors/lance.mdx +38 -22
  226. package/.docs/raw/reference/vectors/libsql.mdx +35 -2
  227. package/.docs/raw/reference/vectors/mongodb.mdx +35 -2
  228. package/.docs/raw/reference/vectors/opensearch.mdx +37 -16
  229. package/.docs/raw/reference/vectors/pg.mdx +43 -36
  230. package/.docs/raw/reference/vectors/pinecone.mdx +48 -1
  231. package/.docs/raw/reference/vectors/qdrant.mdx +36 -1
  232. package/.docs/raw/reference/vectors/turbopuffer.mdx +74 -0
  233. package/.docs/raw/reference/voice/google.mdx +159 -20
  234. package/.docs/raw/reference/voice/openai-realtime.mdx +2 -2
  235. package/.docs/raw/reference/voice/voice.addInstructions.mdx +2 -3
  236. package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
  237. package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
  238. package/.docs/raw/reference/voice/voice.close.mdx +1 -1
  239. package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
  240. package/.docs/raw/reference/voice/voice.off.mdx +1 -1
  241. package/.docs/raw/reference/voice/voice.on.mdx +1 -1
  242. package/.docs/raw/reference/voice/voice.send.mdx +1 -1
  243. package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
  244. package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
  245. package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
  246. package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
  247. package/.docs/raw/reference/workflows/run.mdx +13 -5
  248. package/.docs/raw/reference/workflows/step.mdx +13 -0
  249. package/.docs/raw/reference/workflows/workflow.mdx +19 -0
  250. package/.docs/raw/server-db/mastra-client.mdx +1 -2
  251. package/.docs/raw/server-db/mastra-server.mdx +30 -1
  252. package/.docs/raw/server-db/request-context.mdx +0 -1
  253. package/.docs/raw/server-db/storage.mdx +11 -0
  254. package/.docs/raw/streaming/overview.mdx +26 -15
  255. package/.docs/raw/streaming/tool-streaming.mdx +48 -5
  256. package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
  257. package/.docs/raw/tools-mcp/advanced-usage.mdx +1 -2
  258. package/.docs/raw/tools-mcp/mcp-overview.mdx +3 -5
  259. package/.docs/raw/voice/overview.mdx +21 -41
  260. package/.docs/raw/voice/speech-to-speech.mdx +4 -4
  261. package/.docs/raw/voice/speech-to-text.mdx +1 -2
  262. package/.docs/raw/voice/text-to-speech.mdx +1 -2
  263. package/.docs/raw/workflows/control-flow.mdx +180 -0
  264. package/.docs/raw/workflows/error-handling.mdx +1 -0
  265. package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
  266. package/.docs/raw/workflows/overview.mdx +56 -44
  267. package/.docs/raw/workflows/snapshots.mdx +1 -0
  268. package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
  269. package/.docs/raw/workflows/time-travel.mdx +313 -0
  270. package/.docs/raw/workflows/workflow-state.mdx +191 -0
  271. package/CHANGELOG.md +18 -0
  272. package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
  273. package/dist/prepare-docs/package-changes.d.ts.map +1 -1
  274. package/dist/prepare-docs/prepare.js +1 -1
  275. package/dist/stdio.js +1 -1
  276. package/package.json +7 -7
  277. package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -90
  278. package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -102
  279. package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
  280. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
  281. package/.docs/raw/getting-started/quickstart.mdx +0 -27
  282. package/.docs/raw/getting-started/templates.mdx +0 -73
  283. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
  284. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
  285. /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +0 -0
  286. /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/copilotkit.mdx +0 -0
@@ -0,0 +1,191 @@
1
+ ---
2
+ title: "Workflow state | Workflows"
3
+ description: "Share values across workflow steps using global state that persists through the entire workflow run."
4
+ ---
5
+
6
+ # Workflow State
7
+
8
+ Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. This is useful for tracking progress, accumulating results, or sharing configuration across the entire workflow.
9
+
10
+ ## State vs step input/output
11
+
12
+ It's important to understand the difference between **state** and **step input/output**:
13
+
14
+ - **Step input/output**: Data flows sequentially between steps. Each step receives the previous step's output as its `inputData`, and returns an output for the next step.
15
+ - **State**: A shared store that all steps can read and update via `state` and `setState`. State persists across the entire workflow run, including suspend/resume cycles.
16
+
17
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
18
+ const step1 = createStep({
19
+ id: "step-1",
20
+ inputSchema: z.object({ workflowInput: z.string() }),
21
+ outputSchema: z.object({ step1Output: z.string() }),
22
+ stateSchema: z.object({ sharedCounter: z.number() }),
23
+ execute: async ({ inputData, state, setState }) => {
24
+ // inputData comes from workflow input or previous step's output
25
+ console.log(inputData.workflowInput);
26
+
27
+ // state is the shared workflow state
28
+ console.log(state.sharedCounter);
29
+
30
+ // Update state for subsequent steps
31
+ setState({ ...state, sharedCounter: state.sharedCounter + 1 });
32
+
33
+ // Return output that flows to next step's inputData
34
+ return { step1Output: "processed" };
35
+ },
36
+ });
37
+ ```
38
+
39
+ ## Defining state schemas
40
+
41
+ Define a `stateSchema` on both the workflow and individual steps. The workflow's stateSchema is the master schema containing all possible state values, while each step declares only the subset it needs:
42
+
43
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
44
+ const step1 = createStep({
45
+ // ...
46
+ stateSchema: z.object({
47
+ processedItems: z.array(z.string()),
48
+ }),
49
+ execute: async ({ inputData, state, setState }) => {
50
+ const { message } = inputData;
51
+ const { processedItems } = state;
52
+
53
+ setState({
54
+ ...state,
55
+ processedItems: [...processedItems, "item-1", "item-2"],
56
+ });
57
+
58
+ return {
59
+ formatted: message.toUpperCase(),
60
+ };
61
+ },
62
+ });
63
+
64
+ const step2 = createStep({
65
+ // ...
66
+ stateSchema: z.object({
67
+ metadata: z.object({
68
+ processedBy: z.string(),
69
+ }),
70
+ }),
71
+ execute: async ({ inputData, state }) => {
72
+ const { formatted } = inputData;
73
+ const { metadata } = state;
74
+
75
+ return {
76
+ emphasized: `${formatted}!! ${metadata.processedBy}`,
77
+ };
78
+ },
79
+ });
80
+
81
+ export const testWorkflow = createWorkflow({
82
+ // ...
83
+ stateSchema: z.object({
84
+ processedItems: z.array(z.string()),
85
+ metadata: z.object({
86
+ processedBy: z.string(),
87
+ }),
88
+ }),
89
+ })
90
+ .then(step1)
91
+ .then(step2)
92
+ .commit();
93
+ ```
94
+
95
+ ## Setting initial state
96
+
97
+ Pass `initialState` when starting a workflow run to set the starting values:
98
+
99
+ ```typescript showLineNumbers copy
100
+ const run = await workflow.createRun();
101
+
102
+ const result = await run.start({
103
+ inputData: { message: "Hello" },
104
+ initialState: {
105
+ processedItems: [],
106
+ metadata: { processedBy: "system" },
107
+ },
108
+ });
109
+ ```
110
+
111
+ The `initialState` object should match the structure defined in the workflow's `stateSchema`.
112
+
113
+ ## State persistence across suspend/resume
114
+
115
+ State automatically persists across suspend and resume cycles. When a workflow suspends and later resumes, all state updates made before the suspension are preserved:
116
+
117
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
118
+ const step1 = createStep({
119
+ id: "step-1",
120
+ inputSchema: z.object({}),
121
+ outputSchema: z.object({}),
122
+ stateSchema: z.object({ count: z.number(), items: z.array(z.string()) }),
123
+ resumeSchema: z.object({ proceed: z.boolean() }),
124
+ execute: async ({ state, setState, suspend, resumeData }) => {
125
+ if (!resumeData) {
126
+ // First run: update state and suspend
127
+ setState({ ...state, count: state.count + 1, items: [...state.items, "item-1"] });
128
+ await suspend({});
129
+ return {};
130
+ }
131
+ // After resume: state changes are preserved (count: 1, items: ["item-1"])
132
+ return {};
133
+ },
134
+ });
135
+ ```
136
+
137
+ ## State in nested workflows
138
+
139
+ When using nested workflows, state propagates from parent to child. Changes made by the parent workflow before calling a nested workflow are visible to steps inside the nested workflow:
140
+
141
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
142
+ const nestedStep = createStep({
143
+ id: "nested-step",
144
+ inputSchema: z.object({}),
145
+ outputSchema: z.object({ result: z.string() }),
146
+ stateSchema: z.object({ sharedValue: z.string() }),
147
+ execute: async ({ state }) => {
148
+ // Receives state modified by parent workflow
149
+ return { result: `Received: ${state.sharedValue}` };
150
+ },
151
+ });
152
+
153
+ const nestedWorkflow = createWorkflow({
154
+ id: "nested-workflow",
155
+ inputSchema: z.object({}),
156
+ outputSchema: z.object({ result: z.string() }),
157
+ stateSchema: z.object({ sharedValue: z.string() }),
158
+ })
159
+ .then(nestedStep)
160
+ .commit();
161
+
162
+ const parentStep = createStep({
163
+ id: "parent-step",
164
+ inputSchema: z.object({}),
165
+ outputSchema: z.object({}),
166
+ stateSchema: z.object({ sharedValue: z.string() }),
167
+ execute: async ({ state, setState }) => {
168
+ // Modify state before nested workflow runs
169
+ setState({ ...state, sharedValue: "modified-by-parent" });
170
+ return {};
171
+ },
172
+ });
173
+
174
+ const parentWorkflow = createWorkflow({
175
+ id: "parent-workflow",
176
+ inputSchema: z.object({}),
177
+ outputSchema: z.object({ result: z.string() }),
178
+ stateSchema: z.object({ sharedValue: z.string() }),
179
+ })
180
+ .then(parentStep)
181
+ .then(nestedWorkflow)
182
+ .commit();
183
+ ```
184
+
185
+ ## Related
186
+
187
+ - [Workflows overview](/docs/v1/workflows/overview)
188
+ - [Suspend & Resume](/docs/v1/workflows/suspend-and-resume)
189
+ - [Step Class](/reference/v1/workflows/step)
190
+ - [Workflow Class](/reference/v1/workflows/workflow)
191
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`ac0d2f4`](https://github.com/mastra-ai/mastra/commit/ac0d2f4ff8831f72c1c66c2be809706d17f65789), [`1a0d3fc`](https://github.com/mastra-ai/mastra/commit/1a0d3fc811482c9c376cdf79ee615c23bae9b2d6), [`85a628b`](https://github.com/mastra-ai/mastra/commit/85a628b1224a8f64cd82ea7f033774bf22df7a7e), [`8215ab3`](https://github.com/mastra-ai/mastra/commit/8215ab3c3cc4af96e53ef76f58873a8749ed056a), [`c237233`](https://github.com/mastra-ai/mastra/commit/c23723399ccedf7f5744b3f40997b79246bfbe64), [`15f9e21`](https://github.com/mastra-ai/mastra/commit/15f9e216177201ea6e3f6d0bfb063fcc0953444f), [`ff94dea`](https://github.com/mastra-ai/mastra/commit/ff94dea935f4e34545c63bcb6c29804732698809), [`5b2ff46`](https://github.com/mastra-ai/mastra/commit/5b2ff4651df70c146523a7fca773f8eb0a2272f8), [`db41688`](https://github.com/mastra-ai/mastra/commit/db4168806d007417e2e60b4f68656dca4e5f40c9), [`5ca599d`](https://github.com/mastra-ai/mastra/commit/5ca599d0bb59a1595f19f58473fcd67cc71cef58), [`bff1145`](https://github.com/mastra-ai/mastra/commit/bff114556b3cbadad9b2768488708f8ad0e91475), [`5c8ca24`](https://github.com/mastra-ai/mastra/commit/5c8ca247094e0cc2cdbd7137822fb47241f86e77), [`e191844`](https://github.com/mastra-ai/mastra/commit/e1918444ca3f80e82feef1dad506cd4ec6e2875f), [`22553f1`](https://github.com/mastra-ai/mastra/commit/22553f11c63ee5e966a9c034a349822249584691), [`7237163`](https://github.com/mastra-ai/mastra/commit/72371635dbf96a87df4b073cc48fc655afbdce3d), [`2500740`](https://github.com/mastra-ai/mastra/commit/2500740ea23da067d6e50ec71c625ab3ce275e64), [`873ecbb`](https://github.com/mastra-ai/mastra/commit/873ecbb517586aa17d2f1e99283755b3ebb2863f), [`4cbb849`](https://github.com/mastra-ai/mastra/commit/4cbb8492ee4eb92ac875c59695dfae308cd3d33a), [`06ecd8f`](https://github.com/mastra-ai/mastra/commit/06ecd8fd03932e6a57f55346ee659ecc431d337a), [`4f9bbe5`](https://github.com/mastra-ai/mastra/commit/4f9bbe5968f42c86f4930b8193de3c3c17e5bd36), [`02e51fe`](https://github.com/mastra-ai/mastra/commit/02e51feddb3d4155cfbcc42624fd0d0970d032c0), [`8f3fa3a`](https://github.com/mastra-ai/mastra/commit/8f3fa3a652bb77da092f913ec51ae46e3a7e27dc), [`cd29ad2`](https://github.com/mastra-ai/mastra/commit/cd29ad23a255534e8191f249593849ed29160886), [`bdf4d8c`](https://github.com/mastra-ai/mastra/commit/bdf4d8cdc656d8a2c21d81834bfa3bfa70f56c16), [`854e3da`](https://github.com/mastra-ai/mastra/commit/854e3dad5daac17a91a20986399d3a51f54bf68b), [`ce18d38`](https://github.com/mastra-ai/mastra/commit/ce18d38678c65870350d123955014a8432075fd9), [`cccf9c8`](https://github.com/mastra-ai/mastra/commit/cccf9c8b2d2dfc1a5e63919395b83d78c89682a0), [`5a9bafc`](https://github.com/mastra-ai/mastra/commit/5a9bafcaaa859898e954456e781a1552dc0ad4f1), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f0fdc14`](https://github.com/mastra-ai/mastra/commit/f0fdc14ee233d619266b3d2bbdeea7d25cfc6d13), [`db18bc9`](https://github.com/mastra-ai/mastra/commit/db18bc9c3825e2c1a0ad9a183cc9935f6691bfa1), [`9b37b56`](https://github.com/mastra-ai/mastra/commit/9b37b565e1f2a76c24f728945cc740c2b09be9da), [`41a23c3`](https://github.com/mastra-ai/mastra/commit/41a23c32f9877d71810f37e24930515df2ff7a0f), [`5d171ad`](https://github.com/mastra-ai/mastra/commit/5d171ad9ef340387276b77c2bb3e83e83332d729), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8), [`d1e74a0`](https://github.com/mastra-ai/mastra/commit/d1e74a0a293866dece31022047f5dbab65a304d0), [`39e7869`](https://github.com/mastra-ai/mastra/commit/39e7869bc7d0ee391077ce291474d8a84eedccff), [`adb5346`](https://github.com/mastra-ai/mastra/commit/adb534629c7e7a992e7e163617c41c6239e946a3), [`5761926`](https://github.com/mastra-ai/mastra/commit/57619260c4a2cdd598763abbacd90de594c6bc76), [`c900fdd`](https://github.com/mastra-ai/mastra/commit/c900fdd504c41348efdffb205cfe80d48c38fa33), [`604a79f`](https://github.com/mastra-ai/mastra/commit/604a79fecf276e26a54a3fe01bb94e65315d2e0e), [`887f0b4`](https://github.com/mastra-ai/mastra/commit/887f0b4746cdbd7cb7d6b17ac9f82aeb58037ea5), [`376986c`](https://github.com/mastra-ai/mastra/commit/376986cba2f30faf84006b57cad85e9ce94e51d0), [`2562143`](https://github.com/mastra-ai/mastra/commit/256214336b4faa78646c9c1776612393790d8784), [`ef11a61`](https://github.com/mastra-ai/mastra/commit/ef11a61920fa0ed08a5b7ceedd192875af119749)]:
8
+ - @mastra/core@1.0.0-beta.6
9
+ - @mastra/mcp@1.0.0-beta.4
10
+
11
+ ## 1.0.0-beta.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Ensure changelog truncation includes at least 2 versions before cutting off ([#10496](https://github.com/mastra-ai/mastra/pull/10496))
16
+
17
+ - Updated dependencies [[`21a15de`](https://github.com/mastra-ai/mastra/commit/21a15de369fe82aac26bb642ed7be73505475e8b), [`feb7ee4`](https://github.com/mastra-ai/mastra/commit/feb7ee4d09a75edb46c6669a3beaceec78811747), [`3f5f04d`](https://github.com/mastra-ai/mastra/commit/3f5f04d07b21fd373e70aa7d863226cc7bec4b4b), [`b0e2ea5`](https://github.com/mastra-ai/mastra/commit/b0e2ea5b52c40fae438b9e2f7baee6f0f89c5442), [`c456e01`](https://github.com/mastra-ai/mastra/commit/c456e0149e3c176afcefdbd9bb1d2c5917723725), [`ab035c2`](https://github.com/mastra-ai/mastra/commit/ab035c2ef6d8cc7bb25f06f1a38508bd9e6f126b), [`1a46a56`](https://github.com/mastra-ai/mastra/commit/1a46a566f45a3fcbadc1cf36bf86d351f264bfa3), [`3cf540b`](https://github.com/mastra-ai/mastra/commit/3cf540b9fbfea8f4fc8d3a2319a4e6c0b0cbfd52), [`1c6ce51`](https://github.com/mastra-ai/mastra/commit/1c6ce51f875915ab57fd36873623013699a2a65d), [`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f), [`a97003a`](https://github.com/mastra-ai/mastra/commit/a97003aa1cf2f4022a41912324a1e77263b326b8), [`ccc141e`](https://github.com/mastra-ai/mastra/commit/ccc141ed27da0abc3a3fc28e9e5128152e8e37f4), [`fe3b897`](https://github.com/mastra-ai/mastra/commit/fe3b897c2ccbcd2b10e81b099438c7337feddf89), [`00123ba`](https://github.com/mastra-ai/mastra/commit/00123ba96dc9e5cd0b110420ebdba56d8f237b25), [`29c4309`](https://github.com/mastra-ai/mastra/commit/29c4309f818b24304c041bcb4a8f19b5f13f6b62), [`16785ce`](https://github.com/mastra-ai/mastra/commit/16785ced928f6f22638f4488cf8a125d99211799), [`de8239b`](https://github.com/mastra-ai/mastra/commit/de8239bdcb1d8c0cfa06da21f1569912a66bbc8a), [`b5e6cd7`](https://github.com/mastra-ai/mastra/commit/b5e6cd77fc8c8e64e0494c1d06cee3d84e795d1e), [`e2bbb9c`](https://github.com/mastra-ai/mastra/commit/e2bbb9ceee9bd04c807b06ed9582f01e3bafb3e1), [`3759cb0`](https://github.com/mastra-ai/mastra/commit/3759cb064935b5f74c65ac2f52a1145f7352899d), [`651e772`](https://github.com/mastra-ai/mastra/commit/651e772eb1475fb13e126d3fcc01751297a88214), [`b61b93f`](https://github.com/mastra-ai/mastra/commit/b61b93f9e058b11dd2eec169853175d31dbdd567), [`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013), [`c0b731f`](https://github.com/mastra-ai/mastra/commit/c0b731fb27d712dc8582e846df5c0332a6a0c5ba), [`43ca8f2`](https://github.com/mastra-ai/mastra/commit/43ca8f2c7334851cc7b4d3d2f037d8784bfbdd5f), [`2ca67cc`](https://github.com/mastra-ai/mastra/commit/2ca67cc3bb1f6a617353fdcab197d9efebe60d6f), [`9e67002`](https://github.com/mastra-ai/mastra/commit/9e67002b52c9be19936c420a489dbee9c5fd6a78), [`35edc49`](https://github.com/mastra-ai/mastra/commit/35edc49ac0556db609189641d6341e76771b81fc)]:
18
+ - @mastra/core@1.0.0-beta.5
19
+ - @mastra/mcp@1.0.0-beta.3
20
+
3
21
  ## 1.0.0-beta.4
4
22
 
5
23
  ### Patch Changes
@@ -274,15 +274,35 @@ var SOURCE_DIRS = ["packages", "speech", "stores", "voice", "integrations", "dep
274
274
  fromRepoRoot
275
275
  );
276
276
  var CHANGELOGS_DEST = fromPackageRoot(".docs/organized/changelogs");
277
- var MAX_LINES = 300;
277
+ var MAX_LINES = 500;
278
+ var MIN_VERSIONS = 2;
279
+ var VERSION_HEADER_REGEX = /^## \d+\.\d+\.\d+/;
278
280
  function truncateContent(content, maxLines) {
279
281
  const lines = content.split("\n");
280
282
  if (lines.length <= maxLines) return content;
281
- const visibleLines = lines.slice(0, maxLines);
282
- const hiddenCount = lines.length - maxLines;
283
- return visibleLines.join("\n") + `
283
+ const versionIndices = [];
284
+ for (let i = 0; i < lines.length; i++) {
285
+ if (VERSION_HEADER_REGEX.test(lines[i])) {
286
+ versionIndices.push(i);
287
+ }
288
+ }
289
+ const versionsInMaxLines = versionIndices.filter((idx) => idx < maxLines).length;
290
+ let cutoffLine;
291
+ if (versionsInMaxLines >= MIN_VERSIONS) {
292
+ cutoffLine = maxLines;
293
+ } else if (versionIndices.length > MIN_VERSIONS) {
294
+ cutoffLine = versionIndices[MIN_VERSIONS];
295
+ } else {
296
+ cutoffLine = lines.length;
297
+ }
298
+ const visibleLines = lines.slice(0, cutoffLine);
299
+ const hiddenCount = lines.length - cutoffLine;
300
+ if (hiddenCount > 0) {
301
+ return visibleLines.join("\n") + `
284
302
 
285
303
  ... ${hiddenCount} more lines hidden. See full changelog in package directory.`;
304
+ }
305
+ return visibleLines.join("\n");
286
306
  }
287
307
  async function processPackageDir(packagePath, outputDir) {
288
308
  let packageName;
@@ -1 +1 @@
1
- {"version":3,"file":"package-changes.d.ts","sourceRoot":"","sources":["../../src/prepare-docs/package-changes.ts"],"names":[],"mappings":"AA8DA;;GAEG;AACH,wBAAsB,qBAAqB,kBAmC1C"}
1
+ {"version":3,"file":"package-changes.d.ts","sourceRoot":"","sources":["../../src/prepare-docs/package-changes.ts"],"names":[],"mappings":"AAiGA;;GAEG;AACH,wBAAsB,qBAAqB,kBAmC1C"}
@@ -1 +1 @@
1
- export { prepare } from '../chunk-5NJC7NRO.js';
1
+ export { prepare } from '../chunk-4CM2BQNP.js';
package/dist/stdio.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { fromPackageRoot, prepare, getMatchingPaths, blogPostSchema } from './chunk-5NJC7NRO.js';
2
+ import { fromPackageRoot, prepare, getMatchingPaths, blogPostSchema } from './chunk-4CM2BQNP.js';
3
3
  import * as fs from 'fs';
4
4
  import { existsSync, mkdirSync } from 'fs';
5
5
  import * as os2 from 'os';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,15 +28,15 @@
28
28
  "@modelcontextprotocol/sdk": "^1.17.5",
29
29
  "jsdom": "^26.1.0",
30
30
  "zod": "^3.25.76",
31
- "@mastra/mcp": "^1.0.0-beta.2",
32
- "@mastra/core": "1.0.0-beta.4"
31
+ "@mastra/mcp": "^1.0.0-beta.4",
32
+ "@mastra/core": "1.0.0-beta.6"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.6",
36
36
  "@types/jsdom": "^21.1.7",
37
37
  "@types/node": "22.13.17",
38
- "@vitest/coverage-v8": "4.0.8",
39
- "@vitest/ui": "4.0.8",
38
+ "@vitest/coverage-v8": "4.0.12",
39
+ "@vitest/ui": "4.0.12",
40
40
  "@wong2/mcp-cli": "^1.13.0",
41
41
  "cross-env": "^10.1.0",
42
42
  "eslint": "^9.37.0",
@@ -44,9 +44,9 @@
44
44
  "tsup": "^8.5.0",
45
45
  "tsx": "^4.19.4",
46
46
  "typescript": "^5.8.3",
47
- "vitest": "^4.0.8",
47
+ "vitest": "4.0.12",
48
48
  "@internal/lint": "0.0.53",
49
- "@mastra/core": "1.0.0-beta.4"
49
+ "@mastra/core": "1.0.0-beta.6"
50
50
  },
51
51
  "homepage": "https://mastra.ai",
52
52
  "repository": {
@@ -1,90 +0,0 @@
1
- ---
2
- title: "Human in the Loop with Tools | Agents"
3
- description: Learn how to require approvals and suspend tool execution while keeping humans in control of agent workflows.
4
- ---
5
-
6
- # Human in the Loop with Tools
7
-
8
- Sometimes agents need human oversight before they can run potentially sensitive tools or long-running workflows. Mastra lets you pause tool execution to wait for approval, decline a tool call entirely, or suspend a tool mid-flight until the required data is available.
9
-
10
- ## Tool approvals
11
-
12
- ### Enforcing approval on every tool
13
-
14
- Pass `requireToolApproval: true` when calling `stream` (or `generate`) to automatically pause execution whenever the agent tries to invoke a tool. The stream closes until you explicitly approve or decline the tool call using the original run’s `runId`.
15
-
16
- ```typescript {2,6} title="Require approval before executing any tool" showLineNumbers copy
17
- const stream = await myAgent.stream("Find the user with name - John Smith", {
18
- requireToolApproval: true,
19
- });
20
-
21
- const approvedToolCallStream = await myAgent.approveToolCall({ runId: stream.runId });
22
- const declinedToolCallStream = await myAgent.declineToolCall({ runId: stream.runId });
23
- ```
24
-
25
- ### Requiring approval per tool
26
-
27
- You can also enforce approval on specific tools. Set `requireApproval: true` when creating a tool so the agent pauses only when it tries to invoke that tool.
28
-
29
- ```typescript {8} title="Mark a tool as approval-only" showLineNumbers copy
30
- const findUserTool = createTool({
31
- id: "Find user tool",
32
- description: "Returns the name and email for a matching user",
33
- inputSchema: z.object({
34
- name: z.string(),
35
- }),
36
- execute: async (inputData) => {
37
- return mockFindUser(inputData);
38
- },
39
- requireApproval: true,
40
- });
41
- ```
42
-
43
- When the agent reaches this tool, it emits a tool-call event you can approve or decline with the same `approveToolCall` or `declineToolCall` helpers.
44
-
45
- ## Tool suspension
46
-
47
- Sometimes a tool can’t finish immediately—maybe it’s waiting for external confirmation or extra input. You can suspend and later resume execution using `workflow.suspend`, `resumeStream`, and optional schemas that define what data is required at each step.
48
-
49
- ```typescript {10,14} title="Suspend and resume a tool" showLineNumbers copy
50
- const findUserTool = createTool({
51
- id: "Find user tool",
52
- description: "Returns the name and email for a matching user",
53
- inputSchema: z.object({
54
- name: z.string(),
55
- }),
56
- suspendSchema: z.object({
57
- message: z.string(),
58
- }),
59
- resumeSchema: z.object({
60
- name: z.string(),
61
- }),
62
- execute: async (inputData, { workflow }) => {
63
- if (!workflow.resumeData) {
64
- return workflow.suspend({ message: "Please provide the name of the user" });
65
- }
66
-
67
- return {
68
- name: workflow?.resumeData?.name,
69
- email: "test@test.com",
70
- };
71
- },
72
- });
73
- ```
74
-
75
- To continue execution, call `resumeStream` with the run’s `runId` and the `resumeData` that satisfies the `resumeSchema`. The workflow resumes from the suspension point and the tool completes with the new data.
76
-
77
- ```typescript {1} title="Resume a suspended tool call" showLineNumbers copy
78
- const resumedStream = await myAgent.resumeStream(
79
- { name: "John Smith" },
80
- { runId: stream.runId },
81
- );
82
- ```
83
-
84
- ## Related
85
-
86
- - [Using Tools](./using-tools)
87
- - [Agent Overview](./overview)
88
- - [Tools Overview](../mcp/overview)
89
- - [Agent Memory](./agent-memory)
90
- - [Request Context](/docs/v1/server-db/request-context)
@@ -1,102 +0,0 @@
1
- ---
2
- title: "Using Cedar-OS | Frameworks"
3
- description: "Learn how to integrate Cedar-OS with Mastra"
4
- ---
5
-
6
- import Tabs from "@theme/Tabs";
7
- import TabItem from "@theme/TabItem";
8
- import Steps from "@site/src/components/Steps";
9
- import StepItem from "@site/src/components/StepItem";
10
-
11
- # Using Cedar-OS
12
-
13
- [Cedar-OS](https://docs.cedarcopilot.com/introduction/overview) is an open-source agentic UI framework designed specifically for building the most ambitious AI-native applications. Cedar was built with Mastra in mind.
14
-
15
- :::info
16
-
17
- Also see the [Extending Mastra](https://docs.cedarcopilot.com/agent-backend-connection/mastra) and [Custom Backend Implementation](https://docs.cedarcopilot.com/agent-backend-connection/custom) guides on Cedar's documentation site for more advanced integration patterns.
18
-
19
- :::
20
-
21
- ## Integration Guide
22
-
23
- <Steps>
24
-
25
- <StepItem>
26
-
27
- Run Cedar's CLI command:
28
-
29
- ```bash
30
- npx cedar-os-cli plant-seed
31
- ```
32
-
33
- If starting from scratch, select the **Mastra starter** template for a complete setup with both frontend and backend in a monorepo
34
-
35
- If you already have a Mastra backend, use the **blank frontend cedar repo** option instead. This will give you the option to download components and download all dependencies for Cedar. It is recommended to download at least one of the chat components to get started.
36
-
37
- </StepItem>
38
-
39
- <StepItem>
40
-
41
- Wrap your application with the CedarCopilot provider to connect to your Mastra backend:
42
-
43
- ```tsx
44
- import { CedarCopilot } from "cedar-os";
45
-
46
- function App() {
47
- return (
48
- <CedarCopilot
49
- llmProvider={{
50
- provider: "mastra",
51
- baseURL: "http://localhost:4111", // default dev port for Mastra
52
- apiKey: process.env.NEXT_PUBLIC_MASTRA_API_KEY, // optional — only for backend auth
53
- }}
54
- >
55
- <YourApp />
56
- </CedarCopilot>
57
- );
58
- }
59
- ```
60
-
61
- </StepItem>
62
-
63
- <StepItem>
64
-
65
- Configure your Mastra backend to work with Cedar by following the [Mastra Configuration Options](https://docs.cedarcopilot.com/agent-backend-connection/agent-backend-connection#mastra-configuration-options).
66
-
67
- [Register API routes](https://mastra.ai/en/examples/deployment/custom-api-route) in your Mastra server (or NextJS serverless routes if in a monorepo):
68
-
69
- ```ts mastra/src/index.ts
70
- import { registerApiRoute } from "@mastra/core/server";
71
-
72
- // POST /chat
73
- // The chat's non-streaming default endpoint
74
- registerApiRoute("/chat", {
75
- method: "POST",
76
- // …validate input w/ zod
77
- handler: async (c) => {
78
- /* your agent.generate() logic */
79
- },
80
- });
81
-
82
- // POST /chat/stream (SSE)
83
- // The chat's streaming default endpoint
84
- registerApiRoute("/chat/stream", {
85
- method: "POST",
86
- handler: async (c) => {
87
- /* stream agent output in SSE format */
88
- },
89
- });
90
- ```
91
-
92
- </StepItem>
93
-
94
- <StepItem>
95
-
96
- Drop Cedar components into your frontend – see [Chat Overview](https://docs.cedarcopilot.com/chat/chat-overview).
97
-
98
- Your backend and frontend are now linked! You're ready to start building AI-native experiences with your Mastra agents.
99
-
100
- </StepItem>
101
-
102
- </Steps>