@mastra/core 1.0.0-beta.21 → 1.0.0-beta.22

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 (362) hide show
  1. package/CHANGELOG.md +356 -0
  2. package/dist/action/index.d.ts +7 -7
  3. package/dist/action/index.d.ts.map +1 -1
  4. package/dist/agent/agent-legacy.d.ts.map +1 -1
  5. package/dist/agent/agent.d.ts +100 -18
  6. package/dist/agent/agent.d.ts.map +1 -1
  7. package/dist/agent/agent.types.d.ts +22 -18
  8. package/dist/agent/agent.types.d.ts.map +1 -1
  9. package/dist/agent/index.cjs +13 -13
  10. package/dist/agent/index.d.ts +1 -1
  11. package/dist/agent/index.d.ts.map +1 -1
  12. package/dist/agent/index.js +2 -2
  13. package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
  14. package/dist/agent/message-list/index.cjs +18 -18
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/message-list.d.ts +2 -1
  17. package/dist/agent/message-list/message-list.d.ts.map +1 -1
  18. package/dist/agent/trip-wire.d.ts +1 -2
  19. package/dist/agent/trip-wire.d.ts.map +1 -1
  20. package/dist/agent/types.d.ts +9 -10
  21. package/dist/agent/types.d.ts.map +1 -1
  22. package/dist/agent/utils.d.ts +7 -42
  23. package/dist/agent/utils.d.ts.map +1 -1
  24. package/dist/agent/workflows/prepare-stream/index.d.ts +6 -118
  25. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  26. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +7 -11
  27. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  28. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +4 -68
  29. package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
  30. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +3 -45
  31. package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
  32. package/dist/agent/workflows/prepare-stream/schema.d.ts +10 -10
  33. package/dist/agent/workflows/prepare-stream/stream-step.d.ts +2 -8
  34. package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
  35. package/dist/{chunk-HJXEZSNI.js → chunk-3XY64RAM.js} +5 -5
  36. package/dist/{chunk-HJXEZSNI.js.map → chunk-3XY64RAM.js.map} +1 -1
  37. package/dist/{chunk-XSJNTLM7.js → chunk-453NPBJ7.js} +479 -47
  38. package/dist/chunk-453NPBJ7.js.map +1 -0
  39. package/dist/{chunk-3CZ42NBZ.js → chunk-5UVSKF5L.js} +17 -14
  40. package/dist/chunk-5UVSKF5L.js.map +1 -0
  41. package/dist/{chunk-XKDVT3ZH.cjs → chunk-67ZKOPA4.cjs} +480 -48
  42. package/dist/chunk-67ZKOPA4.cjs.map +1 -0
  43. package/dist/{chunk-YLP5IWH2.js → chunk-7IYWOBLG.js} +4 -4
  44. package/dist/{chunk-YLP5IWH2.js.map → chunk-7IYWOBLG.js.map} +1 -1
  45. package/dist/{chunk-3RCMDLCG.cjs → chunk-ALQFYWAR.cjs} +12 -12
  46. package/dist/{chunk-3RCMDLCG.cjs.map → chunk-ALQFYWAR.cjs.map} +1 -1
  47. package/dist/{chunk-PC3FBUWH.js → chunk-C4CIC3LZ.js} +2 -2
  48. package/dist/chunk-C4CIC3LZ.js.map +1 -0
  49. package/dist/{chunk-7JGQWNV5.js → chunk-CPLRD2VP.js} +3 -3
  50. package/dist/{chunk-7JGQWNV5.js.map → chunk-CPLRD2VP.js.map} +1 -1
  51. package/dist/{chunk-AHN7K3VE.js → chunk-CQ2E577C.js} +5 -5
  52. package/dist/chunk-CQ2E577C.js.map +1 -0
  53. package/dist/{chunk-A4MCHA5L.cjs → chunk-CVLIEFWM.cjs} +100 -819
  54. package/dist/chunk-CVLIEFWM.cjs.map +1 -0
  55. package/dist/{chunk-XBZWAUZ3.js → chunk-IFPQ2MLB.js} +25 -12
  56. package/dist/chunk-IFPQ2MLB.js.map +1 -0
  57. package/dist/{chunk-DVJZZAZA.cjs → chunk-IHD36QFA.cjs} +7 -7
  58. package/dist/{chunk-DVJZZAZA.cjs.map → chunk-IHD36QFA.cjs.map} +1 -1
  59. package/dist/{chunk-WMJEP45F.cjs → chunk-J4KVR4DZ.cjs} +25 -18
  60. package/dist/chunk-J4KVR4DZ.cjs.map +1 -0
  61. package/dist/{chunk-3RFSIHFR.js → chunk-K2LPTKSY.js} +4 -720
  62. package/dist/chunk-K2LPTKSY.js.map +1 -0
  63. package/dist/{chunk-FY3PYSMK.cjs → chunk-KHO4KFXW.cjs} +5 -5
  64. package/dist/{chunk-FY3PYSMK.cjs.map → chunk-KHO4KFXW.cjs.map} +1 -1
  65. package/dist/{chunk-W7R7GPNN.cjs → chunk-MGPIVG2O.cjs} +9 -9
  66. package/dist/chunk-MGPIVG2O.cjs.map +1 -0
  67. package/dist/{chunk-KGE3KAM7.js → chunk-N3PAHTKU.js} +23 -3
  68. package/dist/chunk-N3PAHTKU.js.map +1 -0
  69. package/dist/{chunk-O4H44CMA.js → chunk-N7TDP7ZE.js} +586 -117
  70. package/dist/chunk-N7TDP7ZE.js.map +1 -0
  71. package/dist/{chunk-I5GMA5UM.cjs → chunk-NPIYNC5A.cjs} +9 -9
  72. package/dist/{chunk-I5GMA5UM.cjs.map → chunk-NPIYNC5A.cjs.map} +1 -1
  73. package/dist/{chunk-AW7FISLD.cjs → chunk-OZ75PBBK.cjs} +27 -7
  74. package/dist/chunk-OZ75PBBK.cjs.map +1 -0
  75. package/dist/{chunk-JMAPJWVG.cjs → chunk-OZCUIZRA.cjs} +2021 -1426
  76. package/dist/chunk-OZCUIZRA.cjs.map +1 -0
  77. package/dist/{chunk-6OPEMI2Q.cjs → chunk-PM3UIIBK.cjs} +2 -3
  78. package/dist/{chunk-6OPEMI2Q.cjs.map → chunk-PM3UIIBK.cjs.map} +1 -1
  79. package/dist/{chunk-CISH55FP.js → chunk-PSIJ6OSV.js} +16 -9
  80. package/dist/chunk-PSIJ6OSV.js.map +1 -0
  81. package/dist/{chunk-UOZ3GJY2.cjs → chunk-PTK74KG4.cjs} +2 -2
  82. package/dist/chunk-PTK74KG4.cjs.map +1 -0
  83. package/dist/{chunk-O5IPTMEH.cjs → chunk-Q5QQDMSD.cjs} +32 -29
  84. package/dist/chunk-Q5QQDMSD.cjs.map +1 -0
  85. package/dist/{chunk-UVHSM2GU.cjs → chunk-SMM2C4KH.cjs} +6 -4
  86. package/dist/chunk-SMM2C4KH.cjs.map +1 -0
  87. package/dist/{chunk-UXLQEGIN.cjs → chunk-SVPXZEU7.cjs} +35 -22
  88. package/dist/chunk-SVPXZEU7.cjs.map +1 -0
  89. package/dist/{chunk-SOSXN7X4.cjs → chunk-TU6MNGBB.cjs} +619 -151
  90. package/dist/chunk-TU6MNGBB.cjs.map +1 -0
  91. package/dist/{chunk-EK7E4ETB.js → chunk-TX5GUG5Q.js} +3 -3
  92. package/dist/{chunk-EK7E4ETB.js.map → chunk-TX5GUG5Q.js.map} +1 -1
  93. package/dist/{chunk-SQ7T6FWC.cjs → chunk-UAH236P2.cjs} +13 -13
  94. package/dist/{chunk-SQ7T6FWC.cjs.map → chunk-UAH236P2.cjs.map} +1 -1
  95. package/dist/{chunk-AIJ6HPJG.js → chunk-UL7TJCKA.js} +4 -4
  96. package/dist/{chunk-AIJ6HPJG.js.map → chunk-UL7TJCKA.js.map} +1 -1
  97. package/dist/{chunk-IC2MIQBW.js → chunk-UVOQLIWL.js} +1922 -1326
  98. package/dist/chunk-UVOQLIWL.js.map +1 -0
  99. package/dist/{chunk-IMLORTHO.js → chunk-WANKWENG.js} +5 -5
  100. package/dist/{chunk-IMLORTHO.js.map → chunk-WANKWENG.js.map} +1 -1
  101. package/dist/{chunk-ICU4Z5MO.cjs → chunk-X7DR353F.cjs} +8 -8
  102. package/dist/{chunk-ICU4Z5MO.cjs.map → chunk-X7DR353F.cjs.map} +1 -1
  103. package/dist/{chunk-6TBWJV35.js → chunk-Y22QMA7S.js} +6 -4
  104. package/dist/chunk-Y22QMA7S.js.map +1 -0
  105. package/dist/{chunk-FT7DFPAL.js → chunk-YYNZEEOO.js} +5 -5
  106. package/dist/{chunk-FT7DFPAL.js.map → chunk-YYNZEEOO.js.map} +1 -1
  107. package/dist/di/index.cjs +4 -4
  108. package/dist/di/index.js +1 -1
  109. package/dist/docs/README.md +6 -5
  110. package/dist/docs/SKILL.md +6 -5
  111. package/dist/docs/SOURCE_MAP.json +288 -293
  112. package/dist/docs/agents/01-overview.md +2 -2
  113. package/dist/docs/agents/02-using-tools.md +5 -0
  114. package/dist/docs/agents/04-structured-output.md +24 -4
  115. package/dist/docs/agents/06-processors.md +65 -1
  116. package/dist/docs/agents/08-agent-approval.md +5 -6
  117. package/dist/docs/agents/09-network-approval.md +274 -0
  118. package/dist/docs/agents/{10-reference.md → 11-reference.md} +1 -1
  119. package/dist/docs/ai-sdk/01-reference.md +1 -1
  120. package/dist/docs/cli/01-reference.md +1 -1
  121. package/dist/docs/client-js/01-reference.md +10 -5
  122. package/dist/docs/configuration.mdx/01-reference.md +750 -0
  123. package/dist/docs/core/01-reference.md +9 -35
  124. package/dist/docs/deployer/01-reference.md +19 -6
  125. package/dist/docs/evals/01-overview.md +5 -5
  126. package/dist/docs/evals/02-custom-scorers.md +49 -6
  127. package/dist/docs/evals/04-reference.md +10 -4
  128. package/dist/docs/mcp/01-overview.md +26 -16
  129. package/dist/docs/mcp/02-publishing-mcp-server.md +2 -2
  130. package/dist/docs/memory/01-overview.md +2 -2
  131. package/dist/docs/memory/02-storage.md +59 -25
  132. package/dist/docs/memory/03-working-memory.md +10 -6
  133. package/dist/docs/memory/04-semantic-recall.md +2 -4
  134. package/dist/docs/memory/05-memory-processors.md +2 -3
  135. package/dist/docs/memory/06-reference.md +2 -4
  136. package/dist/docs/observability/01-overview.md +1 -1
  137. package/dist/docs/observability/02-logging.md +4 -5
  138. package/dist/docs/observability/03-overview.md +69 -13
  139. package/dist/docs/observability/09-datadog.md +169 -0
  140. package/dist/docs/observability/10-laminar.md +95 -0
  141. package/dist/docs/observability/{11-otel.md → 13-otel.md} +12 -7
  142. package/dist/docs/observability/{13-reference.md → 15-reference.md} +125 -1
  143. package/dist/docs/processors/01-reference.md +23 -0
  144. package/dist/docs/rag/01-overview.md +1 -1
  145. package/dist/docs/rag/02-chunking-and-embedding.md +0 -1
  146. package/dist/docs/rag/03-vector-databases.md +10 -5
  147. package/dist/docs/rag/04-retrieval.md +5 -6
  148. package/dist/docs/rag/06-reference.md +4 -5
  149. package/dist/docs/server/01-mastra-server.md +32 -49
  150. package/dist/docs/server/02-custom-adapters.md +5 -2
  151. package/dist/docs/server/04-request-context.md +50 -11
  152. package/dist/docs/server/05-custom-api-routes.md +1 -1
  153. package/dist/docs/server/06-mastra-client.md +2 -2
  154. package/dist/docs/storage/01-reference.md +99 -23
  155. package/dist/docs/streaming/04-reference.md +6 -1
  156. package/dist/docs/tools/01-reference.md +380 -25
  157. package/dist/docs/tools-mcp/01-mcp-overview.md +10 -2
  158. package/dist/docs/tools-mcp/02-overview.md +4 -4
  159. package/dist/docs/vectors/01-reference.md +24 -11
  160. package/dist/docs/voice/01-overview.md +2 -2
  161. package/dist/docs/voice/05-reference.md +2 -2
  162. package/dist/docs/workflows/01-overview.md +5 -5
  163. package/dist/docs/workflows/04-agents-and-tools.md +4 -6
  164. package/dist/docs/workflows/06-suspend-and-resume.md +5 -7
  165. package/dist/docs/workflows/11-reference.md +1 -91
  166. package/dist/evals/base.d.ts.map +1 -1
  167. package/dist/evals/index.cjs +20 -20
  168. package/dist/evals/index.js +3 -3
  169. package/dist/evals/scoreTraces/index.cjs +5 -5
  170. package/dist/evals/scoreTraces/index.js +2 -2
  171. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts +4 -67
  172. package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
  173. package/dist/index.cjs +2 -2
  174. package/dist/index.js +1 -1
  175. package/dist/integration/index.cjs +2 -2
  176. package/dist/integration/index.js +1 -1
  177. package/dist/llm/index.cjs +9 -9
  178. package/dist/llm/index.js +2 -2
  179. package/dist/llm/model/model.loop.d.ts +1 -2
  180. package/dist/llm/model/model.loop.d.ts.map +1 -1
  181. package/dist/llm/model/model.loop.types.d.ts +1 -2
  182. package/dist/llm/model/model.loop.types.d.ts.map +1 -1
  183. package/dist/llm/model/provider-types.generated.d.ts +224 -18
  184. package/dist/loop/index.cjs +12 -12
  185. package/dist/loop/index.js +1 -1
  186. package/dist/loop/loop.d.ts +1 -2
  187. package/dist/loop/loop.d.ts.map +1 -1
  188. package/dist/loop/network/index.d.ts +21 -80
  189. package/dist/loop/network/index.d.ts.map +1 -1
  190. package/dist/loop/network/run-command-tool.d.ts +14 -11
  191. package/dist/loop/network/run-command-tool.d.ts.map +1 -1
  192. package/dist/loop/network/validation.d.ts +3 -4
  193. package/dist/loop/network/validation.d.ts.map +1 -1
  194. package/dist/loop/test-utils/options.d.ts.map +1 -1
  195. package/dist/loop/types.d.ts +4 -5
  196. package/dist/loop/types.d.ts.map +1 -1
  197. package/dist/loop/workflows/agentic-execution/index.d.ts +31 -804
  198. package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
  199. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +22 -539
  200. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  201. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +13 -294
  202. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  203. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +2 -41
  204. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  205. package/dist/loop/workflows/agentic-loop/index.d.ts +32 -805
  206. package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
  207. package/dist/loop/workflows/schema.d.ts +90 -91
  208. package/dist/loop/workflows/schema.d.ts.map +1 -1
  209. package/dist/loop/workflows/stream.d.ts +1 -2
  210. package/dist/loop/workflows/stream.d.ts.map +1 -1
  211. package/dist/mastra/index.cjs +2 -2
  212. package/dist/mastra/index.d.ts +28 -9
  213. package/dist/mastra/index.d.ts.map +1 -1
  214. package/dist/mastra/index.js +1 -1
  215. package/dist/memory/index.cjs +11 -11
  216. package/dist/memory/index.js +1 -1
  217. package/dist/memory/memory.d.ts +4 -2
  218. package/dist/memory/memory.d.ts.map +1 -1
  219. package/dist/observability/index.cjs +11 -11
  220. package/dist/observability/index.js +1 -1
  221. package/dist/observability/types/tracing.d.ts +45 -7
  222. package/dist/observability/types/tracing.d.ts.map +1 -1
  223. package/dist/processors/index.cjs +38 -38
  224. package/dist/processors/index.d.ts +3 -3
  225. package/dist/processors/index.d.ts.map +1 -1
  226. package/dist/processors/index.js +1 -1
  227. package/dist/processors/memory/semantic-recall.d.ts +2 -0
  228. package/dist/processors/memory/semantic-recall.d.ts.map +1 -1
  229. package/dist/processors/processors/structured-output.d.ts +2 -2
  230. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  231. package/dist/processors/processors/token-limiter.d.ts +16 -10
  232. package/dist/processors/processors/token-limiter.d.ts.map +1 -1
  233. package/dist/processors/runner.d.ts +4 -4
  234. package/dist/processors/runner.d.ts.map +1 -1
  235. package/dist/processors/step-schema.d.ts +66 -67
  236. package/dist/processors/step-schema.d.ts.map +1 -1
  237. package/dist/provider-registry-C3IAGLLU.js +3 -0
  238. package/dist/{provider-registry-6DWM3X3I.js.map → provider-registry-C3IAGLLU.js.map} +1 -1
  239. package/dist/provider-registry-YH4FCTT2.cjs +40 -0
  240. package/dist/{provider-registry-DCECMUCQ.cjs.map → provider-registry-YH4FCTT2.cjs.map} +1 -1
  241. package/dist/provider-registry.json +477 -45
  242. package/dist/relevance/index.cjs +3 -3
  243. package/dist/relevance/index.js +1 -1
  244. package/dist/request-context/index.cjs +4 -4
  245. package/dist/request-context/index.d.ts +10 -9
  246. package/dist/request-context/index.d.ts.map +1 -1
  247. package/dist/request-context/index.js +1 -1
  248. package/dist/server/types.d.ts +1 -1
  249. package/dist/storage/constants.cjs +14 -14
  250. package/dist/storage/constants.d.ts +1 -1
  251. package/dist/storage/constants.js +1 -1
  252. package/dist/storage/domains/observability/types.d.ts +90 -90
  253. package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
  254. package/dist/storage/index.cjs +93 -93
  255. package/dist/storage/index.js +2 -2
  256. package/dist/stream/MastraAgentNetworkStream.d.ts +8 -12
  257. package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
  258. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  259. package/dist/stream/aisdk/v5/execute.d.ts +2 -3
  260. package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
  261. package/dist/stream/aisdk/v5/transform.d.ts +2 -3
  262. package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
  263. package/dist/stream/base/output-format-handlers.d.ts +2 -2
  264. package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
  265. package/dist/stream/base/output.d.ts +76 -50
  266. package/dist/stream/base/output.d.ts.map +1 -1
  267. package/dist/stream/base/schema.d.ts +7 -2
  268. package/dist/stream/base/schema.d.ts.map +1 -1
  269. package/dist/stream/index.cjs +11 -15
  270. package/dist/stream/index.d.ts +2 -2
  271. package/dist/stream/index.d.ts.map +1 -1
  272. package/dist/stream/index.js +2 -2
  273. package/dist/stream/types.d.ts +72 -26
  274. package/dist/stream/types.d.ts.map +1 -1
  275. package/dist/test-utils/llm-mock.cjs +4 -4
  276. package/dist/test-utils/llm-mock.js +1 -1
  277. package/dist/tool-loop-agent/index.cjs +4 -4
  278. package/dist/tool-loop-agent/index.d.ts +1 -1
  279. package/dist/tool-loop-agent/index.d.ts.map +1 -1
  280. package/dist/tool-loop-agent/index.js +1 -1
  281. package/dist/tool-loop-agent/tool-loop-processor.d.ts +1 -2
  282. package/dist/tool-loop-agent/tool-loop-processor.d.ts.map +1 -1
  283. package/dist/tools/index.cjs +4 -4
  284. package/dist/tools/index.js +1 -1
  285. package/dist/tools/is-vercel-tool.cjs +2 -2
  286. package/dist/tools/is-vercel-tool.js +1 -1
  287. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  288. package/dist/tools/tool.d.ts +27 -14
  289. package/dist/tools/tool.d.ts.map +1 -1
  290. package/dist/tools/types.d.ts +76 -20
  291. package/dist/tools/types.d.ts.map +1 -1
  292. package/dist/tools/ui-types.d.ts +3 -4
  293. package/dist/tools/ui-types.d.ts.map +1 -1
  294. package/dist/tools/validation.d.ts +4 -4
  295. package/dist/tools/validation.d.ts.map +1 -1
  296. package/dist/types/dynamic-argument.d.ts +61 -1
  297. package/dist/types/dynamic-argument.d.ts.map +1 -1
  298. package/dist/types/zod-compat.d.ts +3 -11
  299. package/dist/types/zod-compat.d.ts.map +1 -1
  300. package/dist/utils.cjs +22 -22
  301. package/dist/utils.d.ts +1 -1
  302. package/dist/utils.d.ts.map +1 -1
  303. package/dist/utils.js +1 -1
  304. package/dist/vector/index.cjs +2 -2
  305. package/dist/vector/index.js +1 -1
  306. package/dist/voice/index.cjs +6 -6
  307. package/dist/voice/index.js +1 -1
  308. package/dist/workflows/default.d.ts +114 -2
  309. package/dist/workflows/default.d.ts.map +1 -1
  310. package/dist/workflows/evented/index.cjs +10 -10
  311. package/dist/workflows/evented/index.js +1 -1
  312. package/dist/workflows/evented/step-executor.d.ts +1 -1
  313. package/dist/workflows/evented/step-executor.d.ts.map +1 -1
  314. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  315. package/dist/workflows/evented/workflow-event-processor/utils.d.ts +1 -1
  316. package/dist/workflows/evented/workflow.d.ts +74 -21
  317. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  318. package/dist/workflows/handlers/control-flow.d.ts +2 -2
  319. package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
  320. package/dist/workflows/handlers/sleep.d.ts.map +1 -1
  321. package/dist/workflows/handlers/step.d.ts +1 -1
  322. package/dist/workflows/handlers/step.d.ts.map +1 -1
  323. package/dist/workflows/index.cjs +23 -23
  324. package/dist/workflows/index.js +1 -1
  325. package/dist/workflows/step.d.ts +28 -24
  326. package/dist/workflows/step.d.ts.map +1 -1
  327. package/dist/workflows/types.d.ts +91 -54
  328. package/dist/workflows/types.d.ts.map +1 -1
  329. package/dist/workflows/workflow.d.ts +165 -118
  330. package/dist/workflows/workflow.d.ts.map +1 -1
  331. package/package.json +4 -4
  332. package/src/llm/model/provider-types.generated.d.ts +224 -18
  333. package/dist/chunk-3CZ42NBZ.js.map +0 -1
  334. package/dist/chunk-3RFSIHFR.js.map +0 -1
  335. package/dist/chunk-6TBWJV35.js.map +0 -1
  336. package/dist/chunk-A4MCHA5L.cjs.map +0 -1
  337. package/dist/chunk-AHN7K3VE.js.map +0 -1
  338. package/dist/chunk-AW7FISLD.cjs.map +0 -1
  339. package/dist/chunk-CISH55FP.js.map +0 -1
  340. package/dist/chunk-IC2MIQBW.js.map +0 -1
  341. package/dist/chunk-JMAPJWVG.cjs.map +0 -1
  342. package/dist/chunk-KGE3KAM7.js.map +0 -1
  343. package/dist/chunk-O4H44CMA.js.map +0 -1
  344. package/dist/chunk-O5IPTMEH.cjs.map +0 -1
  345. package/dist/chunk-PC3FBUWH.js.map +0 -1
  346. package/dist/chunk-SOSXN7X4.cjs.map +0 -1
  347. package/dist/chunk-UOZ3GJY2.cjs.map +0 -1
  348. package/dist/chunk-UVHSM2GU.cjs.map +0 -1
  349. package/dist/chunk-UXLQEGIN.cjs.map +0 -1
  350. package/dist/chunk-W7R7GPNN.cjs.map +0 -1
  351. package/dist/chunk-WMJEP45F.cjs.map +0 -1
  352. package/dist/chunk-XBZWAUZ3.js.map +0 -1
  353. package/dist/chunk-XKDVT3ZH.cjs.map +0 -1
  354. package/dist/chunk-XSJNTLM7.js.map +0 -1
  355. package/dist/provider-registry-6DWM3X3I.js +0 -3
  356. package/dist/provider-registry-DCECMUCQ.cjs +0 -40
  357. package/dist/stream/aisdk/v5/output.d.ts +0 -121
  358. package/dist/stream/aisdk/v5/output.d.ts.map +0 -1
  359. /package/dist/docs/agents/{09-adding-voice.md → 10-adding-voice.md} +0 -0
  360. /package/dist/docs/observability/{09-langfuse.md → 11-langfuse.md} +0 -0
  361. /package/dist/docs/observability/{10-langsmith.md → 12-langsmith.md} +0 -0
  362. /package/dist/docs/observability/{12-posthog.md → 14-posthog.md} +0 -0
@@ -200,6 +200,43 @@ export const tool = createTool({
200
200
  });
201
201
  ```
202
202
 
203
+ ## Example with MCP Annotations
204
+
205
+ When exposing tools via MCP (Model Context Protocol), you can add annotations to describe tool behavior and customize how clients display the tool. These MCP-specific properties are grouped under the `mcp` property:
206
+
207
+ ```typescript title="src/mastra/tools/weather-tool.ts"
208
+ import { createTool } from "@mastra/core/tools";
209
+ import { z } from "zod";
210
+
211
+ export const weatherTool = createTool({
212
+ id: "get-weather",
213
+ description: "Get current weather for a location",
214
+ inputSchema: z.object({
215
+ location: z.string().describe("City name or coordinates"),
216
+ }),
217
+ // MCP-specific properties
218
+ mcp: {
219
+ // Annotations for client behavior hints
220
+ annotations: {
221
+ title: "Weather Lookup", // Human-readable display name
222
+ readOnlyHint: true, // Tool doesn't modify environment
223
+ destructiveHint: false, // Tool doesn't perform destructive updates
224
+ idempotentHint: true, // Same args = same result
225
+ openWorldHint: true, // Interacts with external API
226
+ },
227
+ // Custom metadata for client-specific functionality
228
+ _meta: {
229
+ version: "1.0.0",
230
+ category: "weather",
231
+ },
232
+ },
233
+ execute: async (inputData) => {
234
+ const weather = await fetchWeather(inputData.location);
235
+ return { weather };
236
+ },
237
+ });
238
+ ```
239
+
203
240
  ## Parameters
204
241
 
205
242
  ## Returns
@@ -306,6 +343,23 @@ Additionally:
306
343
 
307
344
  Hook errors are caught and logged automatically, but do not prevent tool execution from continuing. If a hook throws an error, it will be logged to the console but will not fail the tool call.
308
345
 
346
+ ## MCP Tool Annotations
347
+
348
+ When exposing tools via the Model Context Protocol (MCP), you can provide annotations that describe tool behavior. These annotations help MCP clients like OpenAI Apps SDK understand how to present and handle your tools.
349
+
350
+ MCP-specific properties are grouped under the `mcp` property, which includes `annotations` and `_meta`:
351
+
352
+ ```typescript
353
+ mcp: {
354
+ annotations: { /* behavior hints */ },
355
+ _meta: { /* custom metadata */ },
356
+ }
357
+ ```
358
+
359
+ ### ToolAnnotations Properties
360
+
361
+ These annotations follow the [MCP specification](https://spec.modelcontextprotocol.io/specification/2025-03-26/server/tools/#tool-annotations) and are passed through when tools are listed via MCP.
362
+
309
363
  ## Related
310
364
 
311
365
  - [MCP Overview](https://mastra.ai/docs/v1/mcp/overview)
@@ -793,7 +847,7 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
793
847
  Intended to be passed onto an Agent definition.
794
848
 
795
849
  ```ts
796
- new Agent({ tools: await mcp.listTools() });
850
+ new Agent({ id: "agent", tools: await mcp.listTools() });
797
851
  ```
798
852
 
799
853
  ### listToolsets()
@@ -1338,6 +1392,104 @@ await mcpClient.elicitation.onRequest("interactiveServer", async (request) => {
1338
1392
  - **Clear UI**: Make it obvious what information is being requested and why
1339
1393
  - **Security**: Never auto-accept requests for sensitive information
1340
1394
 
1395
+ ## OAuth Authentication
1396
+
1397
+ For connecting to MCP servers that require OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `MCPOAuthClientProvider`:
1398
+
1399
+ ```typescript
1400
+ import { MCPClient, MCPOAuthClientProvider } from "@mastra/mcp";
1401
+
1402
+ // Create an OAuth provider
1403
+ const oauthProvider = new MCPOAuthClientProvider({
1404
+ redirectUrl: "http://localhost:3000/oauth/callback",
1405
+ clientMetadata: {
1406
+ redirect_uris: ["http://localhost:3000/oauth/callback"],
1407
+ client_name: "My MCP Client",
1408
+ grant_types: ["authorization_code", "refresh_token"],
1409
+ response_types: ["code"],
1410
+ },
1411
+ onRedirectToAuthorization: (url) => {
1412
+ // Handle authorization redirect (open browser, redirect response, etc.)
1413
+ console.log(`Please visit: ${url}`);
1414
+ },
1415
+ });
1416
+
1417
+ // Use the provider with MCPClient
1418
+ const client = new MCPClient({
1419
+ servers: {
1420
+ protectedServer: {
1421
+ url: new URL("https://mcp.example.com/mcp"),
1422
+ authProvider: oauthProvider,
1423
+ },
1424
+ },
1425
+ });
1426
+ ```
1427
+
1428
+ ### Quick Token Provider
1429
+
1430
+ For testing or when you already have a valid access token:
1431
+
1432
+ ```typescript
1433
+ import { MCPClient, createSimpleTokenProvider } from "@mastra/mcp";
1434
+
1435
+ const provider = createSimpleTokenProvider("your-access-token", {
1436
+ redirectUrl: "http://localhost:3000/callback",
1437
+ clientMetadata: {
1438
+ redirect_uris: ["http://localhost:3000/callback"],
1439
+ client_name: "Test Client",
1440
+ },
1441
+ });
1442
+
1443
+ const client = new MCPClient({
1444
+ servers: {
1445
+ testServer: {
1446
+ url: new URL("https://mcp.example.com/mcp"),
1447
+ authProvider: provider,
1448
+ },
1449
+ },
1450
+ });
1451
+ ```
1452
+
1453
+ ### Custom Token Storage
1454
+
1455
+ For persistent token storage across sessions, implement the `OAuthStorage` interface:
1456
+
1457
+ ```typescript
1458
+ import { MCPOAuthClientProvider, OAuthStorage } from "@mastra/mcp";
1459
+
1460
+ class DatabaseOAuthStorage implements OAuthStorage {
1461
+ constructor(private db: Database, private userId: string) {}
1462
+
1463
+ async set(key: string, value: string): Promise<void> {
1464
+ await this.db.query(
1465
+ "INSERT INTO oauth_tokens (user_id, key, value) VALUES (?, ?, ?) ON CONFLICT DO UPDATE SET value = ?",
1466
+ [this.userId, key, value, value]
1467
+ );
1468
+ }
1469
+
1470
+ async get(key: string): Promise<string | undefined> {
1471
+ const result = await this.db.query(
1472
+ "SELECT value FROM oauth_tokens WHERE user_id = ? AND key = ?",
1473
+ [this.userId, key]
1474
+ );
1475
+ return result?.[0]?.value;
1476
+ }
1477
+
1478
+ async delete(key: string): Promise<void> {
1479
+ await this.db.query(
1480
+ "DELETE FROM oauth_tokens WHERE user_id = ? AND key = ?",
1481
+ [this.userId, key]
1482
+ );
1483
+ }
1484
+ }
1485
+
1486
+ const provider = new MCPOAuthClientProvider({
1487
+ redirectUrl: "http://localhost:3000/callback",
1488
+ clientMetadata: { /* ... */ },
1489
+ storage: new DatabaseOAuthStorage(db, "user-123"),
1490
+ });
1491
+ ```
1492
+
1341
1493
  ## Examples
1342
1494
 
1343
1495
  ### Static Tool Configuration
@@ -1369,6 +1521,7 @@ const mcp = new MCPClient({
1369
1521
 
1370
1522
  // Create an agent with access to all tools
1371
1523
  const agent = new Agent({
1524
+ id: "multi-tool-agent",
1372
1525
  name: "Multi-tool Agent",
1373
1526
  instructions: "You have access to multiple tool servers.",
1374
1527
  model: "openai/gpt-5.1",
@@ -1424,6 +1577,7 @@ import { MCPClient } from "@mastra/mcp";
1424
1577
 
1425
1578
  // Create the agent first, without any tools
1426
1579
  const agent = new Agent({
1580
+ id: "multi-tool-agent",
1427
1581
  name: "Multi-tool Agent",
1428
1582
  instructions: "You help users check stocks and weather.",
1429
1583
  model: "openai/gpt-5.1",
@@ -2507,44 +2661,245 @@ type ElicitResult = {
2507
2661
  };
2508
2662
  ```
2509
2663
 
2664
+ ## OAuth Protection
2665
+
2666
+ To protect your MCP server with OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `createOAuthMiddleware` function:
2667
+
2668
+ ```typescript
2669
+ import http from "node:http";
2670
+ import { MCPServer, createOAuthMiddleware, createStaticTokenValidator } from "@mastra/mcp";
2671
+
2672
+ const mcpServer = new MCPServer({
2673
+ id: "protected-server",
2674
+ name: "Protected MCP Server",
2675
+ version: "1.0.0",
2676
+ tools: { /* your tools */ },
2677
+ });
2678
+
2679
+ // Create OAuth middleware
2680
+ const oauthMiddleware = createOAuthMiddleware({
2681
+ oauth: {
2682
+ resource: "https://mcp.example.com/mcp",
2683
+ authorizationServers: ["https://auth.example.com"],
2684
+ scopesSupported: ["mcp:read", "mcp:write"],
2685
+ resourceName: "My Protected MCP Server",
2686
+ validateToken: createStaticTokenValidator(["allowed-token-1"]),
2687
+ },
2688
+ mcpPath: "/mcp",
2689
+ });
2690
+
2691
+ // Create HTTP server with OAuth protection
2692
+ const httpServer = http.createServer(async (req, res) => {
2693
+ const url = new URL(req.url || "", "https://mcp.example.com");
2694
+
2695
+ // Apply OAuth middleware first
2696
+ const result = await oauthMiddleware(req, res, url);
2697
+ if (!result.proceed) return; // Middleware handled response (401, metadata, etc.)
2698
+
2699
+ // Token is valid, proceed to MCP handler
2700
+ await mcpServer.startHTTP({ url, httpPath: "/mcp", req, res });
2701
+ });
2702
+
2703
+ httpServer.listen(3000);
2704
+ ```
2705
+
2706
+ The middleware automatically:
2707
+
2708
+ - Serves **Protected Resource Metadata** at `/.well-known/oauth-protected-resource` (RFC 9728)
2709
+ - Returns `401 Unauthorized` with proper `WWW-Authenticate` headers when authentication is required
2710
+ - Validates bearer tokens using your provided validator
2711
+
2712
+ ### Token Validation
2713
+
2714
+ For production, use proper token validation:
2715
+
2716
+ ```typescript
2717
+ import { createOAuthMiddleware, createIntrospectionValidator } from "@mastra/mcp";
2718
+
2719
+ // Option 1: Token introspection (RFC 7662)
2720
+ const middleware = createOAuthMiddleware({
2721
+ oauth: {
2722
+ resource: "https://mcp.example.com/mcp",
2723
+ authorizationServers: ["https://auth.example.com"],
2724
+ validateToken: createIntrospectionValidator(
2725
+ "https://auth.example.com/oauth/introspect",
2726
+ { clientId: "mcp-server", clientSecret: "secret" }
2727
+ ),
2728
+ },
2729
+ });
2730
+
2731
+ // Option 2: Custom validation (JWT, database lookup, etc.)
2732
+ const customMiddleware = createOAuthMiddleware({
2733
+ oauth: {
2734
+ resource: "https://mcp.example.com/mcp",
2735
+ authorizationServers: ["https://auth.example.com"],
2736
+ validateToken: async (token, resource) => {
2737
+ const decoded = await verifyJWT(token);
2738
+ if (!decoded) {
2739
+ return { valid: false, error: "invalid_token" };
2740
+ }
2741
+ return {
2742
+ valid: true,
2743
+ scopes: decoded.scope?.split(" ") || [],
2744
+ subject: decoded.sub,
2745
+ };
2746
+ },
2747
+ },
2748
+ });
2749
+ ```
2750
+
2751
+ ### OAuth Middleware Options
2752
+
2510
2753
  ## Authentication Context
2511
2754
 
2512
- Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports:
2755
+ Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports. This allows you to pass authentication info, user context, or any custom data from your HTTP middleware to your MCP tools.
2756
+
2757
+ ### How It Works
2758
+
2759
+ Whatever you set on `req.auth` in your HTTP middleware becomes available as `context.mcp.extra.authInfo` in your tools:
2760
+
2761
+ ```
2762
+ req.auth = { ... } → context?.mcp?.extra?.authInfo.extra = { ... }
2763
+ ```
2764
+
2765
+ ### Setting Up Authentication Middleware
2766
+
2767
+ To pass data to your tools, populate `req.auth` on the Node.js request object in your HTTP server middleware before calling `server.startHTTP()`.
2768
+
2769
+ ```typescript
2770
+ import express from "express";
2771
+
2772
+ const app = express();
2773
+
2774
+ // Auth middleware - set req.auth before the MCP handler
2775
+ app.use("/mcp", (req, res, next) => {
2776
+ const token = req.headers.authorization?.replace("Bearer ", "");
2777
+ const user = verifyToken(token);
2778
+
2779
+ // This entire object becomes context.mcp.extra.authInfo
2780
+ // @ts-ignore - req.auth is read by the MCP SDK
2781
+ req.auth = {
2782
+ token,
2783
+ userId: user.userId,
2784
+ email: user.email,
2785
+ };
2786
+ next();
2787
+ });
2788
+
2789
+ app.all("/mcp", async (req, res) => {
2790
+ const url = new URL(req.url, `http://${req.headers.host}`);
2791
+ await server.startHTTP({ url, httpPath: "/mcp", req, res });
2792
+ });
2793
+ ```
2794
+
2795
+ ### Accessing Auth Data in Tools
2796
+
2797
+ The `req.auth` object is available as `context.mcp.extra.authInfo` in your tool's execute function:
2513
2798
 
2514
2799
  ```typescript
2515
2800
  execute: async (inputData, context) => {
2516
- if (!context.mcp?.extra?.authInfo?.token) {
2517
- return "Authentication required";
2801
+ // Access the auth data you set in middleware
2802
+ const authInfo = context?.mcp?.extra?.authInfo;
2803
+
2804
+ if (!authInfo?.extra?.userId) {
2805
+ return { error: "Authentication required" };
2518
2806
  }
2519
2807
 
2520
- // Use the auth token
2808
+ // Use the auth data
2809
+ console.log("User ID:", authInfo.extra.userId);
2810
+ console.log("Email:", authInfo.extra.email);
2811
+
2521
2812
  const response = await fetch("/api/data", {
2522
- headers: { Authorization: `Bearer ${context.mcp.extra.authInfo.token}` },
2523
- signal: context.mcp.extra.signal,
2813
+ headers: { Authorization: `Bearer ${authInfo.token}` },
2814
+ signal: context?.mcp?.extra?.signal,
2524
2815
  });
2525
2816
 
2526
2817
  return response.json();
2527
2818
  };
2528
2819
  ```
2529
2820
 
2530
- The `extra` object contains:
2531
-
2532
- - `authInfo`: Authentication info (when provided by server middleware)
2533
- - `sessionId`: Session identifier
2534
- - `signal`: AbortSignal for cancellation
2535
- - `sendNotification`/`sendRequest`: MCP protocol functions
2536
-
2537
- > Note: To enable authentication, your HTTP server needs middleware that populates `req.auth` before calling `server.startHTTP()`. For example:
2538
- >
2539
- > ```typescript
2540
- > httpServer.createServer((req, res) => {
2541
- > // Add auth middleware
2542
- > req.auth = validateAuthToken(req.headers.authorization);
2543
- >
2544
- > // Then pass to MCP server
2545
- > await server.startHTTP({ url, httpPath, req, res });
2546
- > });
2547
- > ```
2821
+ ### The `extra` Object
2822
+
2823
+ The full `context.mcp.extra` object contains:
2824
+
2825
+ | Property | Description |
2826
+ |----------|-------------|
2827
+ | `authInfo` | Whatever you set on `req.auth` in your middleware |
2828
+ | `sessionId` | Session identifier for the MCP connection |
2829
+ | `signal` | AbortSignal for request cancellation |
2830
+ | `sendNotification` | MCP protocol function for sending notifications |
2831
+ | `sendRequest` | MCP protocol function for sending requests |
2832
+
2833
+ ### Complete Example
2834
+
2835
+ Here's a complete example showing the data flow from middleware to tool:
2836
+
2837
+ ```typescript
2838
+ import express from "express";
2839
+ import { MCPServer } from "@mastra/mcp";
2840
+ import { createTool } from "@mastra/core/tools";
2841
+ import { z } from "zod";
2842
+
2843
+ const verifyToken = (token: string) => {
2844
+ // TODO: Implement token verification
2845
+ return {
2846
+ userId: "123",
2847
+ email: "test@test.com",
2848
+ };
2849
+ };
2850
+
2851
+ // 1. Define your tool that uses auth context
2852
+ const getUserData = createTool({
2853
+ id: "get-user-data",
2854
+ description: "Fetches data for the authenticated user",
2855
+ inputSchema: z.object({}),
2856
+ execute: async (inputData, context) => {
2857
+ const authInfo = context?.mcp?.extra?.authInfo;
2858
+
2859
+ if (!authInfo?.extra?.userId) {
2860
+ return { error: "Authentication required" };
2861
+ }
2862
+
2863
+ // Access the data you set in middleware
2864
+ return {
2865
+ userId: authInfo.extra.userId,
2866
+ email: authInfo.extra.email,
2867
+ };
2868
+ },
2869
+ });
2870
+
2871
+ // 2. Create the MCP server with your tools
2872
+ const server = new MCPServer({
2873
+ id: "my-server",
2874
+ name: "My Server",
2875
+ version: "1.0.0",
2876
+ tools: { getUserData },
2877
+ });
2878
+
2879
+ // 3. Set up Express with auth middleware
2880
+ const app = express();
2881
+
2882
+ app.use("/mcp", (req, res, next) => {
2883
+ const token = req.headers.authorization?.replace("Bearer ", "");
2884
+ const user = verifyToken(token);
2885
+
2886
+ // This entire object becomes context.mcp.extra.authInfo
2887
+ // @ts-ignore - req.auth is read by the MCP SDK
2888
+ req.auth = {
2889
+ token,
2890
+ userId: user.userId,
2891
+ email: user.email,
2892
+ };
2893
+ next();
2894
+ });
2895
+
2896
+ app.all("/mcp", async (req, res) => {
2897
+ const url = new URL(req.url, `http://${req.headers.host}`);
2898
+ await server.startHTTP({ url, httpPath: "/mcp", req, res });
2899
+ });
2900
+
2901
+ app.listen(3000);
2902
+ ```
2548
2903
 
2549
2904
  ## Related Information
2550
2905
 
@@ -1,8 +1,8 @@
1
1
  > Learn about the Model Context Protocol (MCP), how to use third-party tools via MCPClient, connect to registries, and share your own tools using MCPServer.
2
2
 
3
3
  > **Code References:**
4
- - `Agent`: dist/agent/agent.d.ts → dist/chunk-IC2MIQBW.js:16163
5
- - `Mastra`: dist/mastra/index.d.ts → dist/chunk-XBZWAUZ3.js:24
4
+ - `Agent`: dist/agent/agent.d.ts → dist/chunk-UVOQLIWL.js:16630
5
+ - `Mastra`: dist/mastra/index.d.ts → dist/chunk-IFPQ2MLB.js:24
6
6
 
7
7
  # MCP Overview
8
8
 
@@ -50,6 +50,10 @@ export const testMcpClient = new MCPClient({
50
50
 
51
51
  Visit [MCPClient](https://mastra.ai/reference/v1/tools/mcp-client) for a full list of configuration options.
52
52
 
53
+ > **Note:** Authentication
54
+
55
+ For connecting to OAuth-protected MCP servers, see the [OAuth Authentication](https://mastra.ai/reference/v1/tools/mcp-client#oauth-authentication) section.
56
+
53
57
  ## Using `MCPClient` with an agent
54
58
 
55
59
  To use tools from an MCP server in an agent, import your `MCPClient` and call `.listTools()` in the `tools` parameter. This loads from the defined MCP servers, making them available to the agent.
@@ -103,6 +107,10 @@ export const testMcpServer = new MCPServer({
103
107
 
104
108
  Visit [MCPServer](https://mastra.ai/reference/v1/tools/mcp-server) for a full list of configuration options.
105
109
 
110
+ > **Note:** Authentication
111
+
112
+ To protect your MCP server with OAuth, see the [OAuth Protection](https://mastra.ai/reference/v1/tools/mcp-server#oauth-protection) section.
113
+
106
114
  ### Serverless deployments
107
115
 
108
116
  `MCPServer` can be deployed in serverless environments (Cloudflare Workers, Vercel Edge Functions, AWS Lambda, etc.) by enabling the `serverless: true` option in `startHTTP()`. This runs the server in stateless mode, where each request is handled independently without session management.
@@ -1,8 +1,8 @@
1
1
  > Understand what tools are in Mastra, how to add them to agents, and best practices for designing effective tools.
2
2
 
3
3
  > **Code References:**
4
- - `createTool`: dist/tools/index.d.ts → dist/chunk-KGE3KAM7.js:285
5
- - `Tool`: dist/tools/tool.d.ts → dist/chunk-KGE3KAM7.js:115
4
+ - `createTool`: dist/tools/index.d.ts → dist/chunk-N3PAHTKU.js:305
5
+ - `Tool`: dist/tools/tool.d.ts → dist/chunk-N3PAHTKU.js:115
6
6
 
7
7
  # Using Tools
8
8
 
@@ -69,8 +69,8 @@ const advancedTools = () => {};
69
69
  const baseTools = () => {};
70
70
 
71
71
  export const testTool = createTool({
72
- execute: async ({ requestContext }) => {
73
- const userTier = requestContext.get("user-tier") as UserTier["user-tier"];
72
+ execute: async (inputData, context) => {
73
+ const userTier = context?.requestContext?.get("user-tier") as UserTier["user-tier"];
74
74
 
75
75
  return userTier === "enterprise" ? advancedTools : baseTools;
76
76
  },
@@ -26,7 +26,7 @@ import { LibSQLVector } from "@mastra/libsql";
26
26
  // Create a new vector store instance
27
27
  const store = new LibSQLVector({
28
28
  id: 'libsql-vector',
29
- connectionUrl: process.env.DATABASE_URL,
29
+ url: process.env.DATABASE_URL,
30
30
  // Optional: for Turso cloud databases
31
31
  authToken: process.env.DATABASE_AUTH_TOKEN,
32
32
  });
@@ -193,7 +193,7 @@ export const libsqlAgent = new Agent({
193
193
  }),
194
194
  vector: new LibSQLVector({
195
195
  id: 'libsql-agent-vector',
196
- connectionUrl: "file:libsql-agent.db",
196
+ url: "file:libsql-agent.db",
197
197
  }),
198
198
  embedder: fastembed,
199
199
  options: {
@@ -202,9 +202,7 @@ export const libsqlAgent = new Agent({
202
202
  topK: 3,
203
203
  messageRange: 2,
204
204
  },
205
- threads: {
206
- generateTitle: true, // Explicitly enable automatic title generation
207
- },
205
+ generateTitle: true, // Explicitly enable automatic title generation
208
206
  },
209
207
  }),
210
208
  });
@@ -235,8 +233,23 @@ import { MongoDBVector } from "@mastra/mongodb";
235
233
 
236
234
  const store = new MongoDBVector({
237
235
  id: 'mongodb-vector',
238
- url: process.env.MONGODB_URL,
239
- database: process.env.MONGODB_DATABASE,
236
+ uri: process.env.MONGODB_URI,
237
+ dbName: process.env.MONGODB_DATABASE,
238
+ });
239
+ ```
240
+
241
+ ### Custom Embedding Field Path
242
+
243
+ If you need to store embeddings in a nested field structure (e.g., to integrate with existing MongoDB collections), use the `embeddingFieldPath` option:
244
+
245
+ ```typescript
246
+ import { MongoDBVector } from "@mastra/mongodb";
247
+
248
+ const store = new MongoDBVector({
249
+ id: 'mongodb-vector',
250
+ uri: process.env.MONGODB_URI,
251
+ dbName: process.env.MONGODB_DATABASE,
252
+ embeddingFieldPath: 'text.contentEmbedding', // Store embeddings at text.contentEmbedding
240
253
  });
241
254
  ```
242
255
 
@@ -370,10 +383,12 @@ export const mongodbAgent = new Agent({
370
383
  model: "openai/gpt-5.1",
371
384
  memory: new Memory({
372
385
  storage: new MongoDBStore({
373
- url: process.env.MONGODB_URI!,
386
+ id: 'mongodb-storage',
387
+ uri: process.env.MONGODB_URI!,
374
388
  dbName: process.env.MONGODB_DB_NAME!,
375
389
  }),
376
390
  vector: new MongoDBVector({
391
+ id: 'mongodb-vector',
377
392
  uri: process.env.MONGODB_URI!,
378
393
  dbName: process.env.MONGODB_DB_NAME!,
379
394
  }),
@@ -384,9 +399,7 @@ export const mongodbAgent = new Agent({
384
399
  topK: 3,
385
400
  messageRange: 2,
386
401
  },
387
- threads: {
388
- generateTitle: true, // generates descriptive thread titles automatically
389
- },
402
+ generateTitle: true, // generates descriptive thread titles automatically
390
403
  },
391
404
  }),
392
405
  });
@@ -1,8 +1,8 @@
1
1
  > Overview of voice capabilities in Mastra, including text-to-speech, speech-to-text, and real-time speech-to-speech interactions.
2
2
 
3
3
  > **Code References:**
4
- - `Agent`: dist/agent/agent.d.ts → dist/chunk-IC2MIQBW.js:16163
5
- - `CompositeVoice`: dist/voice/index.d.ts → dist/chunk-EK7E4ETB.js:192
4
+ - `Agent`: dist/agent/agent.d.ts → dist/chunk-UVOQLIWL.js:16630
5
+ - `CompositeVoice`: dist/voice/index.d.ts → dist/chunk-TX5GUG5Q.js:192
6
6
 
7
7
  # Voice in Mastra
8
8
 
@@ -595,7 +595,7 @@ import { CompositeVoice } from "@mastra/core/voice";
595
595
  import { OpenAIRealtimeVoice } from "@mastra/voice-openai-realtime";
596
596
  const realtimeVoice = new OpenAIRealtimeVoice();
597
597
  const voice = new CompositeVoice({
598
- realtimeProvider: realtimeVoice,
598
+ realtime: realtimeVoice,
599
599
  });
600
600
  // This will use the OpenAIRealtimeVoice provider
601
601
  await voice.connect();
@@ -880,7 +880,7 @@ const speaker = new Speaker({
880
880
 
881
881
  const realtimeVoice = new OpenAIRealtimeVoice();
882
882
  const voice = new CompositeVoice({
883
- realtimeProvider: realtimeVoice,
883
+ realtime: realtimeVoice,
884
884
  });
885
885
 
886
886
  // Connect to the real-time service
@@ -1,11 +1,11 @@
1
1
  > Workflows in Mastra help you orchestrate complex sequences of tasks with features like branching, parallel execution, resource suspension, and more.
2
2
 
3
3
  > **Code References:**
4
- - `createStep`: dist/workflows/index.d.ts → dist/chunk-IC2MIQBW.js:7656
5
- - `createWorkflow`: dist/workflows/index.d.ts → dist/chunk-IC2MIQBW.js:8318
6
- - `cloneWorkflow`: dist/workflows/index.d.ts → dist/chunk-IC2MIQBW.js:8321
7
- - `Mastra`: dist/mastra/index.d.ts → dist/chunk-XBZWAUZ3.js:24
8
- - `Workflow`: dist/workflows/workflow.d.ts → dist/chunk-IC2MIQBW.js:8334
4
+ - `createStep`: dist/workflows/index.d.ts → dist/chunk-UVOQLIWL.js:7570
5
+ - `createWorkflow`: dist/workflows/index.d.ts → dist/chunk-UVOQLIWL.js:8230
6
+ - `cloneWorkflow`: dist/workflows/index.d.ts → dist/chunk-UVOQLIWL.js:8233
7
+ - `Mastra`: dist/mastra/index.d.ts → dist/chunk-IFPQ2MLB.js:24
8
+ - `Workflow`: dist/workflows/workflow.d.ts → dist/chunk-UVOQLIWL.js:8246
9
9
 
10
10
  # Workflows overview
11
11
 
@@ -131,12 +131,10 @@ const step2 = createStep({
131
131
  execute: async ({ inputData, requestContext }) => {
132
132
  const { formatted } = inputData;
133
133
 
134
- const response = await testTool.execute({
135
- context: {
136
- text: formatted,
137
- },
138
- requestContext,
139
- });
134
+ const response = await testTool.execute(
135
+ { text: formatted },
136
+ { requestContext },
137
+ );
140
138
 
141
139
  return {
142
140
  emphasized: response.emphasized,