@mastra/mcp-docs-server 0.13.19-alpha.1 → 0.13.19-alpha.3

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 (31) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +9 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
  3. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fcore.md +19 -19
  5. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +16 -0
  6. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +17 -17
  7. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +15 -15
  8. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +11 -11
  9. package/.docs/organized/changelogs/%40mastra%2Fserver.md +19 -19
  10. package/.docs/organized/changelogs/create-mastra.md +7 -7
  11. package/.docs/organized/changelogs/mastra.md +11 -11
  12. package/.docs/raw/agents/dynamic-agents.mdx +5 -5
  13. package/.docs/raw/agents/runtime-context.mdx +103 -0
  14. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +1 -1
  15. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +1 -1
  16. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +1 -1
  17. package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +1 -1
  18. package/.docs/raw/reference/agents/getInstructions.mdx +1 -1
  19. package/.docs/raw/reference/agents/getLLM.mdx +1 -1
  20. package/.docs/raw/reference/agents/getMemory.mdx +1 -1
  21. package/.docs/raw/reference/agents/getModel.mdx +1 -1
  22. package/.docs/raw/reference/agents/getScorers.mdx +1 -1
  23. package/.docs/raw/reference/agents/streamVNext.mdx +120 -29
  24. package/.docs/raw/reference/tools/create-tool.mdx +1 -1
  25. package/.docs/raw/reference/tools/graph-rag-tool.mdx +2 -2
  26. package/.docs/raw/reference/tools/vector-query-tool.mdx +2 -2
  27. package/.docs/raw/tools-mcp/runtime-context.mdx +63 -0
  28. package/CHANGELOG.md +14 -0
  29. package/package.json +3 -3
  30. package/.docs/raw/agents/runtime-variables.mdx +0 -116
  31. package/.docs/raw/tools-mcp/dynamic-context.mdx +0 -131
@@ -1,5 +1,14 @@
1
1
  # @mastra/agent-builder
2
2
 
3
+ ## 0.0.3-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Move `zod` from `dependencies` to `devDependencies` and add it to `peerDependencies` ([#7585](https://github.com/mastra-ai/mastra/pull/7585))
8
+
9
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
10
+ - @mastra/core@0.16.1-alpha.2
11
+
3
12
  ## 0.0.3-alpha.0
4
13
 
5
14
  ### Patch Changes
@@ -1,5 +1,19 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.12.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+
10
+ ## 0.12.1-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
15
+ - @mastra/core@0.16.1-alpha.2
16
+
3
17
  ## 0.12.1-alpha.1
4
18
 
5
19
  ### Patch Changes
@@ -285,18 +299,4 @@
285
299
  - Updated dependencies [[`943a7f3`](https://github.com/mastra-ai/mastra/commit/943a7f3dbc6a8ab3f9b7bc7c8a1c5b319c3d7f56), [`be49354`](https://github.com/mastra-ai/mastra/commit/be493546dca540101923ec700feb31f9a13939f2), [`d591ab3`](https://github.com/mastra-ai/mastra/commit/d591ab3ecc985c1870c0db347f8d7a20f7360536), [`ba82abe`](https://github.com/mastra-ai/mastra/commit/ba82abe76e869316bb5a9c95e8ea3946f3436fae), [`727f7e5`](https://github.com/mastra-ai/mastra/commit/727f7e5086e62e0dfe3356fb6dcd8bcb420af246), [`82d9f64`](https://github.com/mastra-ai/mastra/commit/82d9f647fbe4f0177320e7c05073fce88599aa95), [`4189486`](https://github.com/mastra-ai/mastra/commit/4189486c6718fda78347bdf4ce4d3fc33b2236e1), [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01)]:
286
300
  - @mastra/core@0.14.2-alpha.1
287
301
 
288
- ## 0.10.24-alpha.0
289
-
290
- ### Patch Changes
291
-
292
- - [#6949](https://github.com/mastra-ai/mastra/pull/6949) [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1) Thanks [@CalebBarnes](https://github.com/CalebBarnes)! - stream/generate vnext: simplify internal output schema handling, improve types and typescript generics, and add jsdoc comments
293
-
294
- - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
295
- - @mastra/core@0.14.2-alpha.0
296
-
297
- ## 0.10.23
298
-
299
- ### Patch Changes
300
-
301
-
302
- ... 2409 more lines hidden. See full changelog in package directory.
302
+ ... 2423 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,14 @@
1
1
  # @mastra/cloud
2
2
 
3
+ ## 0.1.13-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Rename cloud exporter to MastraCloudAITracingExporter and provide default value for trace endpoint ([#7600](https://github.com/mastra-ai/mastra/pull/7600))
8
+
9
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
10
+ - @mastra/core@0.16.1-alpha.2
11
+
3
12
  ## 0.1.12
4
13
 
5
14
  ### Patch Changes
@@ -289,14 +298,5 @@
289
298
 
290
299
  - 63f6b7d: dependencies updates:
291
300
  - Updated dependency [`@opentelemetry/otlp-transformer@^0.201.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/otlp-transformer/v/0.201.1) (from `^0.201.0`, in `dependencies`)
292
- - Updated dependency [`@opentelemetry/otlp-exporter-base@^0.201.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/otlp-exporter-base/v/0.201.1) (from `^0.201.0`, in `dependencies`)
293
- - Updated dependencies [63f6b7d]
294
- - Updated dependencies [36f1c36]
295
- - Updated dependencies [10d352e]
296
- - Updated dependencies [53d3c37]
297
- - @mastra/core@0.10.6-alpha.0
298
-
299
- ## 0.1.2
300
-
301
301
 
302
- ... 392 more lines hidden. See full changelog in package directory.
302
+ ... 401 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,23 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 0.16.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Add prepareStep to generate/stream VNext options. ([#7646](https://github.com/mastra-ai/mastra/pull/7646))
8
+
9
+ ## 0.16.1-alpha.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed provider defined tools for stream/generate vnext ([#7642](https://github.com/mastra-ai/mastra/pull/7642))
14
+
15
+ - Change to createRunAsync ([#7632](https://github.com/mastra-ai/mastra/pull/7632))
16
+
17
+ - Flatten loop config in stream options and pass to loop options ([#7643](https://github.com/mastra-ai/mastra/pull/7643))
18
+
19
+ - Fix issue with response message id consistency between stream/generate response and the message ids saveed in the DB. Also fixed the custom generatorId implementation to work with this. ([#7606](https://github.com/mastra-ai/mastra/pull/7606))
20
+
3
21
  ## 0.16.1-alpha.1
4
22
 
5
23
  ### Patch Changes
@@ -281,22 +299,4 @@
281
299
 
282
300
  - [#7116](https://github.com/mastra-ai/mastra/pull/7116) [`56041d0`](https://github.com/mastra-ai/mastra/commit/56041d018863a3da6b98c512e47348647c075fb3) Thanks [@DanielSLew](https://github.com/DanielSLew)! - Don't set supportsStructuredOutputs for every v2 model
283
301
 
284
- - [#7109](https://github.com/mastra-ai/mastra/pull/7109) [`5de1555`](https://github.com/mastra-ai/mastra/commit/5de15554d3d6695211945a36928f6657e76cddc9) Thanks [@epinzur](https://github.com/epinzur)! - Fixed tracingContext on tool executions in AI tracing
285
-
286
- - [#7025](https://github.com/mastra-ai/mastra/pull/7025) [`1ed5a3e`](https://github.com/mastra-ai/mastra/commit/1ed5a3e19330374c4347a4237cd2f4b9ffb60376) Thanks [@YujohnNattrass](https://github.com/YujohnNattrass)! - Support workflows for run experiments
287
-
288
- ## 0.15.2
289
-
290
- ### Patch Changes
291
-
292
- - Updated dependencies [[`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430)]:
293
- - @mastra/schema-compat@0.11.1
294
-
295
- ## 0.15.0
296
-
297
- ### Minor Changes
298
-
299
- - [#7032](https://github.com/mastra-ai/mastra/pull/7032) [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump zod peerdep to 3.25.0 to support both v3/v4
300
-
301
-
302
- ... 3082 more lines hidden. See full changelog in package directory.
302
+ ... 3100 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,21 @@
1
1
  # @mastra/deployer-cloud
2
2
 
3
+ ## 0.16.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+ - @mastra/deployer@0.16.1-alpha.3
10
+
11
+ ## 0.16.1-alpha.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
16
+ - @mastra/core@0.16.1-alpha.2
17
+ - @mastra/deployer@0.16.1-alpha.2
18
+
3
19
  ## 0.16.1-alpha.1
4
20
 
5
21
  ### Patch Changes
@@ -1,5 +1,21 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.16.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+ - @mastra/server@0.16.1-alpha.3
10
+
11
+ ## 0.16.1-alpha.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`81d1383`](https://github.com/mastra-ai/mastra/commit/81d13836fe81c5f02a86e6f40416005898a405ba), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
16
+ - @mastra/core@0.16.1-alpha.2
17
+ - @mastra/server@0.16.1-alpha.2
18
+
3
19
  ## 0.16.1-alpha.1
4
20
 
5
21
  ### Patch Changes
@@ -283,20 +299,4 @@
283
299
 
284
300
  ## 0.15.0
285
301
 
286
- ### Minor Changes
287
-
288
- - [#7028](https://github.com/mastra-ai/mastra/pull/7028) [`da58ccc`](https://github.com/mastra-ai/mastra/commit/da58ccc1f2ac33da0cb97b00443fc6208b45bdec) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump core peerdependency
289
-
290
- - [#7032](https://github.com/mastra-ai/mastra/pull/7032) [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump zod peerdep to 3.25.0 to support both v3/v4
291
-
292
- ### Patch Changes
293
-
294
- - [#6798](https://github.com/mastra-ai/mastra/pull/6798) [`e9a36bd`](https://github.com/mastra-ai/mastra/commit/e9a36bd03ed032528b60186a318f563ebf59c01a) Thanks [@dane-ai-mastra](https://github.com/apps/dane-ai-mastra)! - dependencies updates:
295
- - Updated dependency [`rollup@~4.46.4` ↗︎](https://www.npmjs.com/package/rollup/v/4.46.4) (from `~4.46.2`, in `dependencies`)
296
-
297
- - [#6965](https://github.com/mastra-ai/mastra/pull/6965) [`2b38a60`](https://github.com/mastra-ai/mastra/commit/2b38a60da0c1153028d8241c7748b41c5fb81121) Thanks [@dane-ai-mastra](https://github.com/apps/dane-ai-mastra)! - dependencies updates:
298
- - Updated dependency [`rollup@~4.47.1` ↗︎](https://www.npmjs.com/package/rollup/v/4.47.1) (from `~4.46.4`, in `dependencies`)
299
-
300
- - [#6995](https://github.com/mastra-ai/mastra/pull/6995) [`681252d`](https://github.com/mastra-ai/mastra/commit/681252d20e57fcee6821377dea96cacab3bc230f) Thanks [@wardpeet](https://github.com/wardpeet)! - Improve type resolving
301
-
302
- ... 3927 more lines hidden. See full changelog in package directory.
302
+ ... 3943 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.19-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+
10
+ ## 0.13.19-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
15
+ - @mastra/core@0.16.1-alpha.2
16
+
3
17
  ## 0.13.19-alpha.1
4
18
 
5
19
  ### Patch Changes
@@ -284,19 +298,5 @@
284
298
 
285
299
  ### Patch Changes
286
300
 
287
- - Updated dependencies [[`0f00e17`](https://github.com/mastra-ai/mastra/commit/0f00e172953ccdccadb35ed3d70f5e4d89115869), [`217cd7a`](https://github.com/mastra-ai/mastra/commit/217cd7a4ce171e9a575c41bb8c83300f4db03236)]:
288
- - @mastra/core@0.14.1-alpha.1
289
-
290
- ## 0.13.13-alpha.0
291
-
292
- ### Patch Changes
293
-
294
- - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
295
- - @mastra/core@0.14.1-alpha.0
296
-
297
- ## 0.13.12
298
-
299
- ### Patch Changes
300
-
301
301
 
302
- ... 1663 more lines hidden. See full changelog in package directory.
302
+ ... 1677 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,15 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 6.1.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix template slug when getting template environment variables ([#7650](https://github.com/mastra-ai/mastra/pull/7650))
8
+
9
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
10
+ - @mastra/core@0.16.1-alpha.3
11
+ - @mastra/client-js@0.12.1-alpha.3
12
+
3
13
  ## 6.1.1-alpha.1
4
14
 
5
15
  ### Patch Changes
@@ -288,15 +298,5 @@
288
298
  - @mastra/core@0.14.2-alpha.0
289
299
  - @mastra/client-js@0.10.24-alpha.0
290
300
 
291
- ## 5.2.1
292
-
293
- ### Patch Changes
294
-
295
- - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`0f00e17`](https://github.com/mastra-ai/mastra/commit/0f00e172953ccdccadb35ed3d70f5e4d89115869), [`217cd7a`](https://github.com/mastra-ai/mastra/commit/217cd7a4ce171e9a575c41bb8c83300f4db03236), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
296
- - @mastra/core@0.14.1
297
- - @mastra/client-js@0.10.23
298
-
299
- ## 5.2.1-alpha.0
300
-
301
301
 
302
- ... 2865 more lines hidden. See full changelog in package directory.
302
+ ... 2875 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,23 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 0.16.1-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+
10
+ ## 0.16.1-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Flatten loop config in stream options and pass to loop options ([#7643](https://github.com/mastra-ai/mastra/pull/7643))
15
+
16
+ - Fix a bug where `typescript` was bundled into `dist` ([#7585](https://github.com/mastra-ai/mastra/pull/7585))
17
+
18
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
19
+ - @mastra/core@0.16.1-alpha.2
20
+
3
21
  ## 0.16.1-alpha.1
4
22
 
5
23
  ### Patch Changes
@@ -280,23 +298,5 @@
280
298
 
281
299
  - [#6995](https://github.com/mastra-ai/mastra/pull/6995) [`681252d`](https://github.com/mastra-ai/mastra/commit/681252d20e57fcee6821377dea96cacab3bc230f) Thanks [@wardpeet](https://github.com/wardpeet)! - Improve type resolving
282
300
 
283
- - [#6967](https://github.com/mastra-ai/mastra/pull/6967) [`01be5d3`](https://github.com/mastra-ai/mastra/commit/01be5d358fad8faa101e5c69dfa54562c02cc0af) Thanks [@YujohnNattrass](https://github.com/YujohnNattrass)! - Implement AI traces for server apis and client sdk
284
-
285
- - [#6942](https://github.com/mastra-ai/mastra/pull/6942) [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01) Thanks [@wardpeet](https://github.com/wardpeet)! - Add zod as peerdeps for all packages
286
-
287
- - Updated dependencies [[`943a7f3`](https://github.com/mastra-ai/mastra/commit/943a7f3dbc6a8ab3f9b7bc7c8a1c5b319c3d7f56), [`be49354`](https://github.com/mastra-ai/mastra/commit/be493546dca540101923ec700feb31f9a13939f2), [`d591ab3`](https://github.com/mastra-ai/mastra/commit/d591ab3ecc985c1870c0db347f8d7a20f7360536), [`ba82abe`](https://github.com/mastra-ai/mastra/commit/ba82abe76e869316bb5a9c95e8ea3946f3436fae), [`727f7e5`](https://github.com/mastra-ai/mastra/commit/727f7e5086e62e0dfe3356fb6dcd8bcb420af246), [`82d9f64`](https://github.com/mastra-ai/mastra/commit/82d9f647fbe4f0177320e7c05073fce88599aa95), [`4189486`](https://github.com/mastra-ai/mastra/commit/4189486c6718fda78347bdf4ce4d3fc33b2236e1), [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01)]:
288
- - @mastra/core@0.14.2-alpha.1
289
-
290
- ## 0.14.2-alpha.0
291
-
292
- ### Patch Changes
293
-
294
- - [#6933](https://github.com/mastra-ai/mastra/pull/6933) [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b) Thanks [@NikAiyer](https://github.com/NikAiyer)! - Add util functions for workflow server handlers and made processor process function async
295
-
296
- - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
297
- - @mastra/core@0.14.2-alpha.0
298
-
299
- ## 0.14.1
300
-
301
301
 
302
- ... 3220 more lines hidden. See full changelog in package directory.
302
+ ... 3238 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,11 @@
1
1
  # create-mastra
2
2
 
3
+ ## 0.12.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix template slug when getting template environment variables ([#7650](https://github.com/mastra-ai/mastra/pull/7650))
8
+
3
9
  ## 0.12.1-alpha.1
4
10
 
5
11
  ### Patch Changes
@@ -292,11 +298,5 @@
292
298
  - 9cdfcb5: fix infinite rerenders on agents table + share runtime context for cloud
293
299
  - 794d9f3: Fix thread creation in playground
294
300
  - aa9528a: Display reasoning in playground
295
- - 45174f3: share network list between core and cloud
296
- - 48f5532: export workflow list for usage in cloud
297
- - e1d0080: abstract Link component between cloud and core
298
- - f9b1508: add the same agent table as in cloud and export it from the playground
299
- - dfbeec6: Fix navigation to vnext AgentNetwork agents
300
-
301
301
 
302
- ... 1349 more lines hidden. See full changelog in package directory.
302
+ ... 1355 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,15 @@
1
1
  # mastra
2
2
 
3
+ ## 0.12.1-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix template slug when getting template environment variables ([#7650](https://github.com/mastra-ai/mastra/pull/7650))
8
+
9
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
10
+ - @mastra/core@0.16.1-alpha.3
11
+ - @mastra/deployer@0.16.1-alpha.3
12
+
3
13
  ## 0.12.1-alpha.1
4
14
 
5
15
  ### Patch Changes
@@ -288,15 +298,5 @@
288
298
 
289
299
  - [#6948](https://github.com/mastra-ai/mastra/pull/6948) [`a8070e6`](https://github.com/mastra-ai/mastra/commit/a8070e63ab384ae14a214faaf8634c53b7064bc3) Thanks [@taofeeq-deru](https://github.com/taofeeq-deru)! - Preserve run state in workflows after viewing traces
290
300
 
291
- - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`e9a36bd`](https://github.com/mastra-ai/mastra/commit/e9a36bd03ed032528b60186a318f563ebf59c01a), [`2b38a60`](https://github.com/mastra-ai/mastra/commit/2b38a60da0c1153028d8241c7748b41c5fb81121), [`e38f807`](https://github.com/mastra-ai/mastra/commit/e38f8072853cc803ba48394e1930825129708400), [`943a7f3`](https://github.com/mastra-ai/mastra/commit/943a7f3dbc6a8ab3f9b7bc7c8a1c5b319c3d7f56), [`681252d`](https://github.com/mastra-ai/mastra/commit/681252d20e57fcee6821377dea96cacab3bc230f), [`01be5d3`](https://github.com/mastra-ai/mastra/commit/01be5d358fad8faa101e5c69dfa54562c02cc0af), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`24d9ee3`](https://github.com/mastra-ai/mastra/commit/24d9ee3db1c09d15f27a5d0971b102abcfcf7dfd), [`da58ccc`](https://github.com/mastra-ai/mastra/commit/da58ccc1f2ac33da0cb97b00443fc6208b45bdec), [`be49354`](https://github.com/mastra-ai/mastra/commit/be493546dca540101923ec700feb31f9a13939f2), [`d591ab3`](https://github.com/mastra-ai/mastra/commit/d591ab3ecc985c1870c0db347f8d7a20f7360536), [`ba82abe`](https://github.com/mastra-ai/mastra/commit/ba82abe76e869316bb5a9c95e8ea3946f3436fae), [`2a96802`](https://github.com/mastra-ai/mastra/commit/2a96802f76790ebb86a1bcb254398dccf27e5479), [`727f7e5`](https://github.com/mastra-ai/mastra/commit/727f7e5086e62e0dfe3356fb6dcd8bcb420af246), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`82d9f64`](https://github.com/mastra-ai/mastra/commit/82d9f647fbe4f0177320e7c05073fce88599aa95), [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6), [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c), [`de24804`](https://github.com/mastra-ai/mastra/commit/de248044e79b407d211b339ce3ed4dc6e1630704), [`4189486`](https://github.com/mastra-ai/mastra/commit/4189486c6718fda78347bdf4ce4d3fc33b2236e1), [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
292
- - @mastra/core@0.15.0
293
- - @mastra/deployer@0.15.0
294
- - @mastra/mcp@0.11.0
295
-
296
- ## 0.11.0-alpha.3
297
-
298
- ### Minor Changes
299
-
300
- - [#7032](https://github.com/mastra-ai/mastra/pull/7032) [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c) Thanks [@wardpeet](https://github.com/wardpeet)! - Bump zod peerdep to 3.25.0 to support both v3/v4
301
301
 
302
- ... 5390 more lines hidden. See full changelog in package directory.
302
+ ... 5400 more lines hidden. See full changelog in package directory.
@@ -5,7 +5,7 @@ description: Dynamically configure your agent's instruction, model, tools, and m
5
5
 
6
6
  # Dynamic Agents
7
7
 
8
- Dynamic agents use [runtime context](./runtime-variables), like user IDs and other important parameters, to adjust their settings in real-time.
8
+ Dynamic agents use [runtime context](./runtime-context), like user IDs and other important parameters, to adjust their settings in real-time.
9
9
 
10
10
  This means they can change the model they use, update their instructions, select different tools, and configure memory as needed.
11
11
 
@@ -25,12 +25,12 @@ const supportAgent = new Agent({
25
25
 
26
26
  return `You are a customer support agent for our SaaS platform.
27
27
  The current user is on the ${userTier} tier and prefers ${language} language.
28
-
28
+
29
29
  For ${userTier} tier users:
30
30
  ${userTier === "free" ? "- Provide basic support and documentation links" : ""}
31
31
  ${userTier === "pro" ? "- Offer detailed technical support and best practices" : ""}
32
32
  ${userTier === "enterprise" ? "- Provide priority support with custom solutions" : ""}
33
-
33
+
34
34
  Always respond in ${language} language.`;
35
35
  },
36
36
 
@@ -58,7 +58,7 @@ const supportAgent = new Agent({
58
58
 
59
59
  memory: ({ runtimeContext }) => {
60
60
  const userTier = runtimeContext.get("user-tier");
61
-
61
+
62
62
  if (userTier === "enterprise") {
63
63
  return new Memory({
64
64
  storage: new LibSQLStore({ url: "file:enterprise.db" }),
@@ -76,7 +76,7 @@ const supportAgent = new Agent({
76
76
  },
77
77
  });
78
78
  }
79
-
79
+
80
80
  // Basic memory for free tier
81
81
  return new Memory({
82
82
  storage: new LibSQLStore({ url: "file:free.db" }),
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: "Runtime context | Agents | Mastra Docs"
3
+ description: Learn how to use Mastra's RuntimeContext to provide dynamic, request-specific configuration to agents.
4
+ ---
5
+
6
+ # Agent Runtime Context
7
+
8
+ Mastra provides `RuntimeContext`, a dependency injection system that lets you configure agents with runtime variables. If you find yourself creating multiple agents that perform similar tasks, runtime context allows you to consolidate them into a single, more flexible agent.
9
+
10
+ ## Overview
11
+
12
+ The dependency injection system allows you to:
13
+
14
+ 1. Pass runtime configuration variables to agents through a type-safe `runtimeContext`
15
+ 2. Access these variables within tool execution contexts
16
+ 3. Modify agent behavior without changing the underlying code
17
+ 4. Share configuration across multiple tools within the same agent
18
+
19
+ ## Using `runtimeContext` with agents
20
+
21
+ Agents can access `runtimeContext` via the `instructions` parameter, and retrieve variables using `runtimeContext.get()`. This allows agent behavior to adapt dynamically based on user input or external configuration, without changing the underlying implementation.
22
+
23
+ ```typescript {6-7,14} filename="src/mastra/agents/test-weather-agent.ts" showLineNumbers copy
24
+ import { openai } from "@ai-sdk/openai";
25
+ import { Agent } from "@mastra/core/agent";
26
+
27
+ export const testWeatherAgent = new Agent({
28
+ name: "test-weather-agent",
29
+ instructions: async ({ runtimeContext }) => {
30
+ const temperatureUnit = runtimeContext.get("temperature-unit");
31
+
32
+ return `You are a weather assistant that provides current weather information for any city.
33
+
34
+ When a user asks for weather:
35
+ - Extract the city name from their request
36
+ - Respond with: temperature, feels-like temperature, humidity, wind speed, and conditions
37
+ - Use ${temperatureUnit} for all temperature values
38
+ - If no city is mentioned, ask for a city name
39
+ `;
40
+ },
41
+ model: openai("gpt-4o-mini")
42
+ });
43
+ ```
44
+
45
+ ### Example usage
46
+
47
+ In this example, `temperature-unit` is set using `runtimeContext.set()` to either **celsius** or **fahrenheit**, allowing the agent to respond with temperatures in the appropriate unit.
48
+
49
+ ```typescript {12} filename="src/test-weather-agent.ts" showLineNumbers copy
50
+ import { mastra } from "./mastra";
51
+ import { RuntimeContext } from "@mastra/core/runtime-context";
52
+
53
+ const agent = mastra.getAgent("testWeatherAgent");
54
+
55
+ export type WeatherRuntimeContext = {
56
+ "temperature-unit": "celsius" | "fahrenheit";
57
+ };
58
+
59
+ const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
60
+
61
+ runtimeContext.set("temperature-unit", "fahrenheit");
62
+
63
+ const response = await agent.generate("What's the weather in London?", {
64
+ runtimeContext
65
+ });
66
+
67
+ console.log(response.text);
68
+ ```
69
+
70
+ ## Accessing `runtimeContext` with server middleware
71
+
72
+ You can populate `runtimeContext` dynamically in server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
73
+
74
+ ```typescript {2,12-21} filename="src/mastra/index.ts" showLineNumbers copy
75
+ import { Mastra } from "@mastra/core/mastra";
76
+ import { RuntimeContext } from "@mastra/core/runtime-context";
77
+ import { testWeatherAgent } from "./agents/test-weather-agent";
78
+
79
+ type WeatherRuntimeContext = {
80
+ "temperature-unit": "celsius" | "fahrenheit";
81
+ };
82
+
83
+ export const mastra = new Mastra({
84
+ agents: { testWeatherAgent },
85
+ server: {
86
+ middleware: [
87
+ async (context, next) => {
88
+ const country = context.req.header("CF-IPCountry");
89
+ const runtimeContext = context.get("runtimeContext") as RuntimeContext<WeatherRuntimeContext>;
90
+
91
+ runtimeContext.set("temperature-unit", country === "US" ? "fahrenheit" : "celsius");
92
+
93
+ await next();
94
+ }
95
+ ]
96
+ }
97
+ });
98
+ ```
99
+
100
+ ## Related
101
+
102
+ - [Dynamic Agents](./dynamic-agents.mdx)
103
+ - [Tool Runtime Context](../tools-mcp/runtime-context.mdx)
@@ -287,7 +287,7 @@ export const mastra = new Mastra({
287
287
  });
288
288
  ```
289
289
 
290
- > You can then access this data in your tools via the `runtimeContext` parameter. See the [Runtime Context documentation](/docs/agents/runtime-variables) for more details.
290
+ > You can then access this data in your tools via the `runtimeContext` parameter. See the [Agent Runtime Context documentation](/docs/agents/runtime-context) for more details.
291
291
 
292
292
  ## Streaming data
293
293
 
@@ -64,4 +64,4 @@ await agent.getDefaultGenerateOptions({
64
64
  ## Related
65
65
 
66
66
  - [Agent generation](../../docs/agents/overview.mdx#generate)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -65,4 +65,4 @@ await agent.getDefaultStreamOptions({
65
65
 
66
66
  - [Generating responses](../../docs/agents/overview.mdx#generating-responses)
67
67
  - [Streaming responses](../../docs/agents/overview.mdx#streaming-responses)
68
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
68
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -64,4 +64,4 @@ await agent.getDefaultVNextStreamOptions({
64
64
  ## Related
65
65
 
66
66
  - [Streaming with agents](../../docs/streaming/overview.mdx#streaming-with-agents)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -64,4 +64,4 @@ await agent.getInstructions({
64
64
  ## Related
65
65
 
66
66
  - [Agents overview](../../docs/agents/overview.mdx)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -71,4 +71,4 @@ await agent.getLLM({
71
71
  ## Related
72
72
 
73
73
  - [Agents overview](../../docs/agents/overview.mdx)
74
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
74
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -64,4 +64,4 @@ await agent.getMemory({
64
64
  ## Related
65
65
 
66
66
  - [Agent memory](../../docs/agents/agent-memory.mdx)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -64,4 +64,4 @@ await agent.getModel({
64
64
  ## Related
65
65
 
66
66
  - [Agents overview](../../docs/agents/overview.mdx)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -64,4 +64,4 @@ await agent.getScorers({
64
64
  ## Related
65
65
 
66
66
  - [Agents overview](../../docs/agents/overview.mdx)
67
- - [Runtime variables](../../docs/agents/runtime-variables.mdx)
67
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
@@ -41,7 +41,7 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
41
41
  ]}
42
42
  />
43
43
 
44
- ### Options parameters
44
+ ### Options
45
45
 
46
46
  <PropertiesTable
47
47
  content={[
@@ -52,16 +52,99 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
52
52
  defaultValue: "'mastra'",
53
53
  description: "Determines the output stream format. Use 'mastra' for Mastra's native format (default) or 'aisdk' for AI SDK v5 compatibility.",
54
54
  },
55
+ {
56
+ name: "maxSteps",
57
+ type: "number",
58
+ isOptional: true,
59
+ description: "Maximum number of steps to run during execution.",
60
+ },
61
+ {
62
+ name: "scorers",
63
+ type: "MastraScorers | Record<string, { scorer: MastraScorer['name']; sampling?: ScoringSamplingConfig }>",
64
+ isOptional: true,
65
+ description: "Evaluation scorers to run on the execution results.",
66
+ properties: [
67
+ {
68
+ parameters: [{
69
+ name: "scorer",
70
+ type: "string",
71
+ isOptional: false,
72
+ description: "Name of the scorer to use."
73
+ }]
74
+ },
75
+ {
76
+ parameters: [{
77
+ name: "sampling",
78
+ type: "ScoringSamplingConfig",
79
+ isOptional: true,
80
+ description: "Sampling configuration for the scorer.",
81
+ properties: [
82
+ {
83
+ parameters: [{
84
+ name: "type",
85
+ type: "'none' | 'ratio'",
86
+ isOptional: false,
87
+ description: "Type of sampling strategy. Use 'none' to disable sampling or 'ratio' for percentage-based sampling."
88
+ }]
89
+ },
90
+ {
91
+ parameters: [{
92
+ name: "rate",
93
+ type: "number",
94
+ isOptional: true,
95
+ description: "Sampling rate (0-1). Required when type is 'ratio'."
96
+ }]
97
+ }
98
+ ]
99
+ }]
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ name: "tracingContext",
105
+ type: "TracingContext",
106
+ isOptional: true,
107
+ description: "AI tracing context for span hierarchy and metadata.",
108
+ },
109
+ {
110
+ name: "returnScorerData",
111
+ type: "boolean",
112
+ isOptional: true,
113
+ description: "Whether to return detailed scoring data in the response.",
114
+ },
115
+ {
116
+ name: "onChunk",
117
+ type: "(chunk: ChunkType) => Promise<void> | void",
118
+ isOptional: true,
119
+ description: "Callback function called for each chunk during streaming."
120
+ },
121
+ {
122
+ name: "onError",
123
+ type: "({ error }: { error: Error | string }) => Promise<void> | void",
124
+ isOptional: true,
125
+ description: "Callback function called when an error occurs during streaming."
126
+ },
127
+ {
128
+ name: "onAbort",
129
+ type: "(event: any) => Promise<void> | void",
130
+ isOptional: true,
131
+ description: "Callback function called when the stream is aborted."
132
+ },
55
133
  {
56
134
  name: "abortSignal",
57
135
  type: "AbortSignal",
58
136
  isOptional: true,
59
- description:
60
- "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.",
137
+ description: "Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated."
138
+ },
139
+ {
140
+ name: "activeTools",
141
+ type: "Array<keyof ToolSet> | undefined",
142
+ isOptional: true,
143
+ description: "Array of active tool names that can be used during execution."
61
144
  },
62
145
  {
63
146
  name: "context",
64
- type: "CoreMessage[]",
147
+ type: "ModelMessage[]",
65
148
  isOptional: true,
66
149
  description: "Additional context messages to provide to the agent.",
67
150
  },
@@ -83,8 +166,8 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
83
166
  parameters: [{
84
167
  name: "model",
85
168
  type: "MastraLanguageModel",
86
- isOptional: false,
87
- description: "Model to use for the internal structuring agent."
169
+ isOptional: true,
170
+ description: "Model to use for the internal structuring agent. If not provided, falls back to the agent's model."
88
171
  }]
89
172
  },
90
173
  {
@@ -178,13 +261,6 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
178
261
  }
179
262
  ]
180
263
  },
181
- {
182
- name: "maxRetries",
183
- type: "number",
184
- isOptional: true,
185
- defaultValue: "2",
186
- description: "Maximum number of retries. Set to 0 to disable retries.",
187
- },
188
264
  {
189
265
  name: "memoryOptions",
190
266
  type: "MemoryConfig",
@@ -271,10 +347,10 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
271
347
  },
272
348
  {
273
349
  parameters: [{
274
- name: "maxTokens",
350
+ name: "maxRetries",
275
351
  type: "number",
276
352
  isOptional: true,
277
- description: "Maximum number of tokens to generate."
353
+ description: "Maximum number of retries for failed requests."
278
354
  }]
279
355
  },
280
356
  {
@@ -317,14 +393,6 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
317
393
  description: "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated."
318
394
  }]
319
395
  },
320
- {
321
- parameters: [{
322
- name: "seed",
323
- type: "number",
324
- isOptional: true,
325
- description: "The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results."
326
- }]
327
- }
328
396
  ]
329
397
  },
330
398
  {
@@ -443,12 +511,6 @@ const aiSdkStream = await agent.streamVNext("message for agent", {
443
511
  isOptional: true,
444
512
  description: "Runtime context for dependency injection and contextual information.",
445
513
  },
446
- {
447
- name: "experimental_generateMessageId",
448
- type: "IDGenerator",
449
- isOptional: true,
450
- description: "Generate a unique ID for each message.",
451
- },
452
514
  {
453
515
  name: "stopWhen",
454
516
  type: "StopCondition | StopCondition[]",
@@ -523,6 +585,35 @@ for await (const part of stream.fullStream) {
523
585
  return stream.toUIMessageStreamResponse();
524
586
  ```
525
587
 
588
+ ### Using Callbacks
589
+
590
+ All callback functions are now available as top-level properties for a cleaner API experience.
591
+
592
+ ```typescript showLineNumbers copy
593
+ const stream = await agent.streamVNext("Tell me a story", {
594
+ onFinish: (result) => {
595
+ console.log('Streaming finished:', result);
596
+ },
597
+ onStepFinish: (step) => {
598
+ console.log('Step completed:', step);
599
+ },
600
+ onChunk: (chunk) => {
601
+ console.log('Received chunk:', chunk);
602
+ },
603
+ onError: ({ error }) => {
604
+ console.error('Streaming error:', error);
605
+ },
606
+ onAbort: (event) => {
607
+ console.log('Stream aborted:', event);
608
+ },
609
+ });
610
+
611
+ // Process the stream
612
+ for await (const chunk of stream.textStream) {
613
+ console.log(chunk);
614
+ }
615
+ ```
616
+
526
617
  ### Advanced Example with Options
527
618
 
528
619
  ```typescript showLineNumbers copy
@@ -93,5 +93,5 @@ The `createTool()` function returns a `Tool` object.
93
93
 
94
94
  - [Tools Overview](/docs/tools-mcp/overview.mdx)
95
95
  - [Using Tools with Agents](/docs/agents/using-tools-and-mcp.mdx)
96
- - [Dynamic Tool Context](/docs/tools-mcp/dynamic-context.mdx)
96
+ - [Tool Runtime Context](/docs/tools-mcp/runtime-context.mdx)
97
97
  - [Advanced Tool Usage](/docs/tools-mcp/advanced-usage.mdx)
@@ -253,8 +253,8 @@ const response = await agent.generate(
253
253
 
254
254
  For more information on runtime context, please see:
255
255
 
256
- - [Runtime Variables](../../docs/agents/runtime-variables.mdx)
257
- - [Dynamic Context](../../docs/tools-mcp/dynamic-context.mdx)
256
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
257
+ - [Tool Runtime Context](../../docs/tools-mcp/runtime-context.mdx)
258
258
 
259
259
  ## Related
260
260
 
@@ -558,8 +558,8 @@ const response = await agent.generate(
558
558
 
559
559
  For more information on runtime context, please see:
560
560
 
561
- - [Runtime Variables](../../docs/agents/runtime-variables.mdx)
562
- - [Dynamic Context](../../docs/tools-mcp/dynamic-context.mdx)
561
+ - [Agent Runtime Context](../../docs/agents/runtime-context.mdx)
562
+ - [Tool Runtime Context](../../docs/tools-mcp/runtime-context.mdx)
563
563
 
564
564
  ## Usage Without a Mastra Server
565
565
 
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: "Runtime context | Tools & MCP | Mastra Docs"
3
+ description: Learn how to use Mastra's RuntimeContext to provide dynamic, request-specific configuration to tools.
4
+ ---
5
+
6
+ import { Callout } from "nextra/components";
7
+
8
+ # Tool Runtime Context
9
+
10
+ Mastra provides `RuntimeContext`, a dependency injection system that lets you configure tools with runtime variables. If you find yourself creating multiple tools that perform similar tasks, runtime context allows you to consolidate them into a single, more flexible tool.
11
+
12
+ ## Overview
13
+
14
+ The dependency injection system allows you to:
15
+
16
+ 1. Pass runtime configuration variables to tools through a type-safe `runtimeContext`.
17
+ 2. Access these variables within tool execution context.
18
+ 3. Modify tool behavior without changing the underlying code.
19
+ 4. Share configuration across multiple tools within the same agent.
20
+
21
+ <Callout>
22
+ **Note:** `RuntimeContext` is primarily used for passing data *into* tool
23
+ executions. It's distinct from agent memory, which handles conversation
24
+ history and state persistence across multiple calls.
25
+ </Callout>
26
+
27
+
28
+ ## Accessing `runtimeContext` in tools
29
+
30
+ Tools can access the same `runtimeContext` used by their parent agent, allowing them to adjust behavior based on runtime configuration. In this example, the `temperature-unit` is retrieved within the tool’s `execute` function to ensure consistent formatting with the agent’s instructions.
31
+
32
+ ```typescript {14-15} filename="src/mastra/tools/test-weather-tool" showLineNumbers copy
33
+ import { createTool } from "@mastra/core/tools";
34
+ import { z } from "zod";
35
+
36
+ type WeatherRuntimeContext = {
37
+ "temperature-unit": "celsius" | "fahrenheit";
38
+ };
39
+
40
+ export const testWeatherTool = createTool({
41
+ id: "getWeather",
42
+ description: "Get the current weather for a location",
43
+ inputSchema: z.object({
44
+ location: z.string().describe("The location to get weather for")
45
+ }),
46
+ execute: async ({ context, runtimeContext }) => {
47
+ const temperatureUnit = runtimeContext.get("temperature-unit") as WeatherRuntimeContext["temperature-unit"];
48
+
49
+ const weather = await fetchWeather(context.location, temperatureUnit);
50
+
51
+ return { result: weather };
52
+ }
53
+ });
54
+
55
+ async function fetchWeather(location: string, temperatureUnit: WeatherRuntimeContext["temperature-unit"]) {
56
+ // ...
57
+ }
58
+ ```
59
+
60
+
61
+ ## Related
62
+
63
+ [Agent Runtime Context](../agents/runtime-context.mdx)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.19-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`fd9bbfe`](https://github.com/mastra-ai/mastra/commit/fd9bbfee22484f8493582325f53e8171bf8e682b)]:
8
+ - @mastra/core@0.16.1-alpha.3
9
+
10
+ ## 0.13.19-alpha.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`827d876`](https://github.com/mastra-ai/mastra/commit/827d8766f36a900afcaf64a040f7ba76249009b3), [`7eaf1d1`](https://github.com/mastra-ai/mastra/commit/7eaf1d1cec7e828d7a98efc2a748ac395bbdba3b), [`f3427cd`](https://github.com/mastra-ai/mastra/commit/f3427cdaf9eecd63360dfc897a4acbf5f4143a4e), [`05f13b8`](https://github.com/mastra-ai/mastra/commit/05f13b8fb269ccfc4de98e9db58dbe16eae55a5e)]:
15
+ - @mastra/core@0.16.1-alpha.2
16
+
3
17
  ## 0.13.19-alpha.1
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.19-alpha.1",
3
+ "version": "0.13.19-alpha.3",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "uuid": "^11.1.0",
34
34
  "zod": "^3.25.76",
35
35
  "zod-to-json-schema": "^3.24.6",
36
- "@mastra/core": "0.16.1-alpha.1",
36
+ "@mastra/core": "0.16.1-alpha.3",
37
37
  "@mastra/mcp": "^0.12.0-alpha.1"
38
38
  },
39
39
  "devDependencies": {
@@ -50,7 +50,7 @@
50
50
  "typescript": "^5.8.3",
51
51
  "vitest": "^3.2.4",
52
52
  "@internal/lint": "0.0.36",
53
- "@mastra/core": "0.16.1-alpha.1"
53
+ "@mastra/core": "0.16.1-alpha.3"
54
54
  },
55
55
  "homepage": "https://mastra.ai",
56
56
  "repository": {
@@ -1,116 +0,0 @@
1
- ---
2
- title: "Runtime context | Agents | Mastra Docs"
3
- description: Learn how to use Mastra's dependency injection system to provide runtime configuration to agents and tools.
4
- ---
5
-
6
- # Agent Runtime Context
7
-
8
- Mastra provides runtime context, which is a system based on dependency injection that enables you to configure your agents and tools with runtime variables. If you find yourself creating several different agents that do very similar things, runtime context allows you to combine them into one agent.
9
-
10
- ## Overview
11
-
12
- The dependency injection system allows you to:
13
-
14
- 1. Pass runtime configuration variables to agents through a type-safe runtimeContext
15
- 2. Access these variables within tool execution contexts
16
- 3. Modify agent behavior without changing the underlying code
17
- 4. Share configuration across multiple tools within the same agent
18
-
19
- ## Basic Usage
20
-
21
- ```typescript
22
- const agent = mastra.getAgent("weatherAgent");
23
-
24
- // Define your runtimeContext's type structure
25
- type WeatherRuntimeContext = {
26
- "temperature-scale": "celsius" | "fahrenheit";
27
- };
28
-
29
- const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
30
- runtimeContext.set("temperature-scale", "celsius");
31
-
32
- const response = await agent.generate("What's the weather like today?", {
33
- runtimeContext,
34
- });
35
-
36
- console.log(response.text);
37
- ```
38
-
39
- ## Using with REST API
40
-
41
- Here's how to dynamically set temperature units based on a user's location using the Cloudflare `CF-IPCountry` header:
42
-
43
- ```typescript filename="src/index.ts"
44
- import { Mastra } from "@mastra/core";
45
- import { RuntimeContext } from "@mastra/core/di";
46
- import { agent as weatherAgent } from "./agents/weather";
47
-
48
- // Define RuntimeContext type with clear, descriptive types
49
- type WeatherRuntimeContext = {
50
- "temperature-scale": "celsius" | "fahrenheit";
51
- };
52
-
53
- export const mastra = new Mastra({
54
- agents: {
55
- weather: weatherAgent,
56
- },
57
- server: {
58
- middleware: [
59
- async (c, next) => {
60
- const country = c.req.header("CF-IPCountry");
61
- const runtimeContext = c.get<WeatherRuntimeContext>("runtimeContext");
62
-
63
- // Set temperature scale based on country
64
- runtimeContext.set(
65
- "temperature-scale",
66
- country === "US" ? "fahrenheit" : "celsius",
67
- );
68
-
69
- await next(); // Don't forget to call next()
70
- },
71
- ],
72
- },
73
- });
74
- ```
75
-
76
- ## Creating Tools with Variables
77
-
78
- Tools can access runtimeContext variables and must conform to the agent's runtimeContext type:
79
-
80
- ```typescript
81
- import { createTool } from "@mastra/core/tools";
82
- import { z } from "zod";
83
-
84
- export const weatherTool = createTool({
85
- id: "getWeather",
86
- description: "Get the current weather for a location",
87
- inputSchema: z.object({
88
- location: z.string().describe("The location to get weather for"),
89
- }),
90
- execute: async ({ context, runtimeContext }) => {
91
- // Type-safe access to runtimeContext variables
92
- const temperatureUnit = runtimeContext.get("temperature-scale");
93
-
94
- const weather = await fetchWeather(context.location, {
95
- temperatureUnit,
96
- });
97
-
98
- return { result: weather };
99
- },
100
- });
101
-
102
- async function fetchWeather(
103
- location: string,
104
- { temperatureUnit }: { temperatureUnit: "celsius" | "fahrenheit" },
105
- ): Promise<WeatherResponse> {
106
- // Implementation of weather API call
107
- const response = await weatherApi.fetch(location, temperatureUnit);
108
-
109
- return {
110
- location,
111
- temperature: "72°F",
112
- conditions: "Sunny",
113
- unit: temperatureUnit,
114
- };
115
- }
116
- ```
@@ -1,131 +0,0 @@
1
- ---
2
- title: "Dynamic Tool Context | Tools & MCP | Mastra Docs"
3
- description: Learn how to use Mastra's RuntimeContext to provide dynamic, request-specific configuration to tools.
4
- ---
5
-
6
- import { Callout } from "nextra/components";
7
-
8
- # Dynamic Tool Context
9
-
10
- Mastra provides `RuntimeContext`, a system based on dependency injection, that allows you to pass dynamic, request-specific configuration to your tools during execution. This is useful when a tool's behavior needs to change based on user identity, request headers, or other runtime factors, without altering the tool's core code.
11
-
12
- <Callout>
13
- **Note:** `RuntimeContext` is primarily used for passing data *into* tool
14
- executions. It's distinct from agent memory, which handles conversation
15
- history and state persistence across multiple calls.
16
- </Callout>
17
-
18
- ## Basic Usage
19
-
20
- To use `RuntimeContext`, first define a type structure for your dynamic configuration. Then, create an instance of `RuntimeContext` typed with your definition and set the desired values. Finally, include the `runtimeContext` instance in the options object when calling `agent.generate()` or `agent.stream()`.
21
-
22
- ```typescript
23
- import { RuntimeContext } from "@mastra/core/di";
24
- // Assume 'agent' is an already defined Mastra Agent instance
25
-
26
- // Define the context type
27
- type WeatherRuntimeContext = {
28
- "temperature-scale": "celsius" | "fahrenheit";
29
- };
30
-
31
- // Instantiate RuntimeContext and set values
32
- const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
33
- runtimeContext.set("temperature-scale", "celsius");
34
-
35
- // Pass to agent call
36
- const response = await agent.generate("What's the weather like today?", {
37
- runtimeContext, // Pass the context here
38
- });
39
-
40
- console.log(response.text);
41
- ```
42
-
43
- ## Accessing Context in Tools
44
-
45
- Tools receive the `runtimeContext` as part of the second argument to their `execute` function. You can then use the `.get()` method to retrieve values.
46
-
47
- ```typescript filename="src/mastra/tools/weather-tool.ts"
48
- import { createTool } from "@mastra/core/tools";
49
- import { z } from "zod";
50
- // Assume WeatherRuntimeContext is defined as above and accessible here
51
-
52
- // Dummy fetch function
53
- async function fetchWeather(
54
- location: string,
55
- options: { temperatureUnit: "celsius" | "fahrenheit" },
56
- ): Promise<any> {
57
- console.log(`Fetching weather for ${location} in ${options.temperatureUnit}`);
58
- // Replace with actual API call
59
- return { temperature: options.temperatureUnit === "celsius" ? 20 : 68 };
60
- }
61
-
62
- export const weatherTool = createTool({
63
- id: "getWeather",
64
- description: "Get the current weather for a location",
65
- inputSchema: z.object({
66
- location: z.string().describe("The location to get weather for"),
67
- }),
68
- // The tool's execute function receives runtimeContext
69
- execute: async ({ context, runtimeContext }) => {
70
- // Type-safe access to runtimeContext variables
71
- const temperatureUnit = runtimeContext.get("temperature-scale");
72
-
73
- // Use the context value in the tool logic
74
- const weather = await fetchWeather(context.location, {
75
- temperatureUnit,
76
- });
77
-
78
- return {
79
- result: `The temperature is ${weather.temperature}°${temperatureUnit === "celsius" ? "C" : "F"}`,
80
- };
81
- },
82
- });
83
- ```
84
-
85
- When the agent uses `weatherTool`, the `temperature-scale` value set in the `runtimeContext` during the `agent.generate()` call will be available inside the tool's `execute` function.
86
-
87
- ## Using with Server Middleware
88
-
89
- In server environments (like Express or Next.js), you can use middleware to automatically populate `RuntimeContext` based on incoming request data, such as headers or user sessions.
90
-
91
- Here's an example using Mastra's built-in server middleware support (which uses Hono internally) to set the temperature scale based on the Cloudflare `CF-IPCountry` header:
92
-
93
- ```typescript filename="src/mastra/index.ts"
94
- import { Mastra } from "@mastra/core";
95
- import { RuntimeContext } from "@mastra/core/di";
96
- import { weatherAgent } from "./agents/weather"; // Assume agent is defined elsewhere
97
-
98
- // Define RuntimeContext type
99
- type WeatherRuntimeContext = {
100
- "temperature-scale": "celsius" | "fahrenheit";
101
- };
102
-
103
- export const mastra = new Mastra({
104
- agents: {
105
- weather: weatherAgent,
106
- },
107
- server: {
108
- middleware: [
109
- async (c, next) => {
110
- // Get the RuntimeContext instance
111
- const runtimeContext =
112
- c.get<RuntimeContext<WeatherRuntimeContext>>("runtimeContext");
113
-
114
- // Get country code from request header
115
- const country = c.req.header("CF-IPCountry");
116
-
117
- // Set temperature scale based on country
118
- runtimeContext.set(
119
- "temperature-scale",
120
- country === "US" ? "fahrenheit" : "celsius",
121
- );
122
-
123
- // Continue request processing
124
- await next();
125
- },
126
- ],
127
- },
128
- });
129
- ```
130
-
131
- With this middleware in place, any agent call handled by this Mastra server instance will automatically have the `temperature-scale` set in its `RuntimeContext` based on the user's inferred country, and tools like `weatherTool` will use it accordingly.