@mastra/mcp-docs-server 0.13.22-alpha.6 → 0.13.22-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +7 -7
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +8 -8
- package/.docs/organized/changelogs/create-mastra.md +3 -3
- package/.docs/organized/changelogs/mastra.md +12 -12
- package/.docs/raw/agents/input-processors.mdx +16 -14
- package/.docs/raw/agents/runtime-context.mdx +47 -12
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.13.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
|
|
3
10
|
## 0.13.0-alpha.6
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -291,12 +298,5 @@
|
|
|
291
298
|
### Patch Changes
|
|
292
299
|
|
|
293
300
|
- Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
|
|
294
|
-
- @mastra/core@0.15.3-alpha.7
|
|
295
|
-
|
|
296
|
-
## 0.11.3-alpha.6
|
|
297
|
-
|
|
298
|
-
### Patch Changes
|
|
299
|
-
|
|
300
|
-
- Updated dependencies [[`c19bcf7`](https://github.com/mastra-ai/mastra/commit/c19bcf7b43542b02157b5e17303e519933a153ab), [`b42a961`](https://github.com/mastra-ai/mastra/commit/b42a961a5aefd19d6e938a7705fc0ecc90e8f756), [`45e4d39`](https://github.com/mastra-ai/mastra/commit/45e4d391a2a09fc70c48e4d60f505586ada1ba0e), [`0302f50`](https://github.com/mastra-ai/mastra/commit/0302f50861a53c66ff28801fc371b37c5f97e41e), [`74db265`](https://github.com/mastra-ai/mastra/commit/74db265b96aa01a72ffd91dcae0bc3b346cca0f2), [`7f3b8da`](https://github.com/mastra-ai/mastra/commit/7f3b8da6dd21c35d3672e44b4f5dd3502b8f8f92), [`905352b`](https://github.com/mastra-ai/mastra/commit/905352bcda134552400eb252bca1cb05a7975c14), [`f2cda47`](https://github.com/mastra-ai/mastra/commit/f2cda47ae911038c5d5489f54c36517d6f15bdcc), [`cfd377a`](https://github.com/mastra-ai/mastra/commit/cfd377a3a33a9c88b644f6540feed9cd9832db47)]:
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 2565 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 0.17.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix error message when fetching observability things ([#7956](https://github.com/mastra-ai/mastra/pull/7956))
|
|
8
|
+
|
|
3
9
|
## 0.17.0-alpha.6
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -292,11 +298,5 @@
|
|
|
292
298
|
|
|
293
299
|
### Patch Changes
|
|
294
300
|
|
|
295
|
-
- Add prepareStep to generate/stream VNext options. ([#7646](https://github.com/mastra-ai/mastra/pull/7646))
|
|
296
|
-
|
|
297
|
-
## 0.16.1-alpha.2
|
|
298
|
-
|
|
299
|
-
### Patch Changes
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 3394 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/deployer-cloud
|
|
2
2
|
|
|
3
|
+
## 0.17.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
- @mastra/deployer@0.17.0-alpha.7
|
|
10
|
+
|
|
3
11
|
## 0.17.0-alpha.6
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -291,12 +299,4 @@
|
|
|
291
299
|
|
|
292
300
|
### Patch Changes
|
|
293
301
|
|
|
294
|
-
|
|
295
|
-
- @mastra/core@0.15.3-alpha.8
|
|
296
|
-
- @mastra/deployer@0.15.3-alpha.8
|
|
297
|
-
|
|
298
|
-
## 0.15.3-alpha.7
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
... 127 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 135 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 0.17.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
- @mastra/server@0.17.0-alpha.7
|
|
10
|
+
|
|
3
11
|
## 0.17.0-alpha.6
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -291,12 +299,4 @@
|
|
|
291
299
|
|
|
292
300
|
### Patch Changes
|
|
293
301
|
|
|
294
|
-
|
|
295
|
-
- Updated dependencies [376913a]
|
|
296
|
-
- @mastra/core@0.16.0-alpha.1
|
|
297
|
-
- @mastra/server@0.16.0-alpha.1
|
|
298
|
-
|
|
299
|
-
## 0.16.0-alpha.0
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
... 4158 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 4166 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.22-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
|
|
3
10
|
## 0.13.22-alpha.6
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -291,12 +298,5 @@
|
|
|
291
298
|
- [#7238](https://github.com/mastra-ai/mastra/pull/7238) [`9a98f3c`](https://github.com/mastra-ai/mastra/commit/9a98f3c524f37fb3ebd94c41cd6efed0698a6a2a) Thanks [@alliehowe29](https://github.com/alliehowe29)! - Validate file path after `path.join()`
|
|
292
299
|
|
|
293
300
|
- Updated dependencies [[`ab48c97`](https://github.com/mastra-ai/mastra/commit/ab48c979098ea571faf998a55d3a00e7acd7a715), [`ff89505`](https://github.com/mastra-ai/mastra/commit/ff895057c8c7e91a5535faef46c5e5391085ddfa), [`183dc95`](https://github.com/mastra-ai/mastra/commit/183dc95596f391b977bd1a2c050b8498dac74891), [`a1111e2`](https://github.com/mastra-ai/mastra/commit/a1111e24e705488adfe5e0a6f20c53bddf26cb22), [`61debef`](https://github.com/mastra-ai/mastra/commit/61debefd80ad3a7ed5737e19df6a23d40091689a), [`9beaeff`](https://github.com/mastra-ai/mastra/commit/9beaeffa4a97b1d5fd01a7f8af8708b16067f67c), [`ad78bfc`](https://github.com/mastra-ai/mastra/commit/ad78bfc4ea6a1fff140432bf4f638e01af7af668), [`9eee594`](https://github.com/mastra-ai/mastra/commit/9eee594e35e0ca2a650fcc33fa82009a142b9ed0), [`979912c`](https://github.com/mastra-ai/mastra/commit/979912cfd180aad53287cda08af771df26454e2c), [`7dcf4c0`](https://github.com/mastra-ai/mastra/commit/7dcf4c04f44d9345b1f8bc5d41eae3f11ac61611), [`ad78bfc`](https://github.com/mastra-ai/mastra/commit/ad78bfc4ea6a1fff140432bf4f638e01af7af668), [`0ce418a`](https://github.com/mastra-ai/mastra/commit/0ce418a1ccaa5e125d4483a9651b635046152569), [`8387952`](https://github.com/mastra-ai/mastra/commit/838795227b4edf758c84a2adf6f7fba206c27719), [`5eca5d2`](https://github.com/mastra-ai/mastra/commit/5eca5d2655788863ea0442a46c9ef5d3c6dbe0a8)]:
|
|
294
|
-
- @mastra/core@0.15.3-alpha.4
|
|
295
|
-
- @mastra/mcp@0.11.3-alpha.1
|
|
296
|
-
|
|
297
|
-
## 0.13.17-alpha.3
|
|
298
|
-
|
|
299
|
-
### Patch Changes
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1789 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @mastra/playground-ui
|
|
2
2
|
|
|
3
|
+
## 6.2.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed createRun change in agent builder that was missed ([#7966](https://github.com/mastra-ai/mastra/pull/7966))
|
|
8
|
+
|
|
9
|
+
- fix error message when fetching observability things ([#7956](https://github.com/mastra-ai/mastra/pull/7956))
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
12
|
+
- @mastra/core@0.17.0-alpha.7
|
|
13
|
+
- @mastra/client-js@0.13.0-alpha.7
|
|
14
|
+
|
|
3
15
|
## 6.2.0-alpha.3
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -286,17 +298,5 @@
|
|
|
286
298
|
- Updated dependencies [4106a58]
|
|
287
299
|
- Updated dependencies [ad78bfc]
|
|
288
300
|
- Updated dependencies [48f0742]
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
- Updated dependencies [74db265]
|
|
292
|
-
- Updated dependencies [0ce418a]
|
|
293
|
-
- Updated dependencies [af90672]
|
|
294
|
-
- Updated dependencies [8387952]
|
|
295
|
-
- Updated dependencies [7f3b8da]
|
|
296
|
-
- Updated dependencies [905352b]
|
|
297
|
-
- Updated dependencies [599d04c]
|
|
298
|
-
- Updated dependencies [56041d0]
|
|
299
|
-
- Updated dependencies [3412597]
|
|
300
|
-
- Updated dependencies [5eca5d2]
|
|
301
|
-
|
|
302
|
-
... 3015 more lines hidden. See full changelog in package directory.
|
|
301
|
+
|
|
302
|
+
... 3027 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 0.17.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
|
|
3
10
|
## 0.17.0-alpha.6
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -292,11 +299,4 @@
|
|
|
292
299
|
|
|
293
300
|
- [#7388](https://github.com/mastra-ai/mastra/pull/7388) [`03d0c39`](https://github.com/mastra-ai/mastra/commit/03d0c3963a748294577dd232a53ee01e1e5bcc12) Thanks [@NikAiyer](https://github.com/NikAiyer)! - temp disable agent-builder workflows import
|
|
294
301
|
|
|
295
|
-
|
|
296
|
-
- @mastra/core@0.15.3-alpha.6
|
|
297
|
-
|
|
298
|
-
## 0.15.3-alpha.5
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
... 3363 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 3370 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 0.13.0-alpha.5
|
|
4
|
+
|
|
3
5
|
## 0.13.0-alpha.4
|
|
4
6
|
|
|
5
7
|
### Patch Changes
|
|
@@ -296,7 +298,5 @@
|
|
|
296
298
|
- d8dec5e: add a cta to invite to deploy to cloud
|
|
297
299
|
- 89d2f4e: add TTS to the playground
|
|
298
300
|
|
|
299
|
-
## 0.10.13
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1414 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.13.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix error message when fetching observability things ([#7956](https://github.com/mastra-ai/mastra/pull/7956))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
10
|
+
- @mastra/core@0.17.0-alpha.7
|
|
11
|
+
- @mastra/deployer@0.17.0-alpha.7
|
|
12
|
+
|
|
3
13
|
## 0.13.0-alpha.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -288,15 +298,5 @@
|
|
|
288
298
|
- 6f715fe: Fix plyground baseUrl, default api baseUrl to playground baseUrl
|
|
289
299
|
- 01264f1: Mastra dev- load env vars before watch
|
|
290
300
|
- 3308c9f: fix dev:playground command
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
- Updated dependencies [ab48c97]
|
|
294
|
-
- Updated dependencies [3e0bd2a]
|
|
295
|
-
- Updated dependencies [2b64943]
|
|
296
|
-
- Updated dependencies [85ef90b]
|
|
297
|
-
- Updated dependencies [aedbbfa]
|
|
298
|
-
- Updated dependencies [ff89505]
|
|
299
|
-
- Updated dependencies [637f323]
|
|
300
|
-
- Updated dependencies [de3cbc6]
|
|
301
|
-
|
|
302
|
-
... 5569 more lines hidden. See full changelog in package directory.
|
|
301
|
+
|
|
302
|
+
... 5579 more lines hidden. See full changelog in package directory.
|
|
@@ -37,7 +37,7 @@ const agent = new Agent({
|
|
|
37
37
|
|
|
38
38
|
Available options:
|
|
39
39
|
- `stripControlChars`: Remove control characters (default: false)
|
|
40
|
-
- `preserveEmojis`: Keep emojis intact (default: true)
|
|
40
|
+
- `preserveEmojis`: Keep emojis intact (default: true)
|
|
41
41
|
- `collapseWhitespace`: Collapse multiple spaces/newlines (default: true)
|
|
42
42
|
- `trim`: Remove leading/trailing whitespace (default: true)
|
|
43
43
|
|
|
@@ -184,11 +184,11 @@ You can chain multiple processors. They execute sequentially in the order they a
|
|
|
184
184
|
|
|
185
185
|
```typescript copy showLineNumbers {9-18}
|
|
186
186
|
import { Agent } from "@mastra/core/agent";
|
|
187
|
-
import {
|
|
188
|
-
UnicodeNormalizer,
|
|
189
|
-
ModerationProcessor,
|
|
187
|
+
import {
|
|
188
|
+
UnicodeNormalizer,
|
|
189
|
+
ModerationProcessor,
|
|
190
190
|
PromptInjectionDetector,
|
|
191
|
-
PIIDetector
|
|
191
|
+
PIIDetector
|
|
192
192
|
} from "@mastra/core/processors";
|
|
193
193
|
|
|
194
194
|
const secureAgent = new Agent({
|
|
@@ -209,17 +209,19 @@ const secureAgent = new Agent({
|
|
|
209
209
|
|
|
210
210
|
You can create custom processors by implementing the `Processor` interface. A Processor can be used for input processing when it implements the `processInput` method.
|
|
211
211
|
|
|
212
|
-
```typescript copy showLineNumbers {
|
|
213
|
-
import type { Processor
|
|
212
|
+
```typescript copy showLineNumbers {5,10-33,39}
|
|
213
|
+
import type { Processor } from "@mastra/core/processors";
|
|
214
|
+
import type { MastraMessageV2 } from "@mastra/core/agent/message-list";
|
|
215
|
+
import { TripWire } from "@mastra/core/agent";
|
|
214
216
|
|
|
215
217
|
class MessageLengthLimiter implements Processor {
|
|
216
218
|
readonly name = 'message-length-limiter';
|
|
217
|
-
|
|
219
|
+
|
|
218
220
|
constructor(private maxLength: number = 1000) {}
|
|
219
221
|
|
|
220
|
-
processInput({ messages, abort }: {
|
|
221
|
-
messages: MastraMessageV2[];
|
|
222
|
-
abort: (reason?: string) => never
|
|
222
|
+
processInput({ messages, abort }: {
|
|
223
|
+
messages: MastraMessageV2[];
|
|
224
|
+
abort: (reason?: string) => never
|
|
223
225
|
}): MastraMessageV2[] {
|
|
224
226
|
// Check total message length
|
|
225
227
|
try {
|
|
@@ -228,7 +230,7 @@ class MessageLengthLimiter implements Processor {
|
|
|
228
230
|
.filter(part => part.type === 'text')
|
|
229
231
|
.reduce((partSum, part) => partSum + (part as any).text.length, 0);
|
|
230
232
|
}, 0);
|
|
231
|
-
|
|
233
|
+
|
|
232
234
|
if (totalLength > this.maxLength) {
|
|
233
235
|
abort(`Message too long: ${totalLength} characters (max: ${this.maxLength})`); // throws a TripWire error
|
|
234
236
|
}
|
|
@@ -238,7 +240,7 @@ class MessageLengthLimiter implements Processor {
|
|
|
238
240
|
}
|
|
239
241
|
throw new Error(`Length validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`); // application level throw a standard error
|
|
240
242
|
}
|
|
241
|
-
|
|
243
|
+
|
|
242
244
|
return messages;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
@@ -279,4 +281,4 @@ If any processor calls `abort()`, the request terminates immediately and subsequ
|
|
|
279
281
|
|
|
280
282
|
While input processors handle user messages before they reach the language model, **output processors** handle the LLM's responses after generation but before they're returned to the user. This is useful for response validation, content filtering, and safety controls on LLM-generated content.
|
|
281
283
|
|
|
282
|
-
See the [Output Processors documentation](/docs/agents/output-processors) for details on processing LLM responses.
|
|
284
|
+
See the [Output Processors documentation](/docs/agents/output-processors) for details on processing LLM responses.
|
|
@@ -20,9 +20,10 @@ The dependency injection system allows you to:
|
|
|
20
20
|
|
|
21
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
22
|
|
|
23
|
-
```typescript {
|
|
23
|
+
```typescript {7-8,15} filename="src/mastra/agents/test-weather-agent.ts" showLineNumbers copy
|
|
24
24
|
import { openai } from "@ai-sdk/openai";
|
|
25
25
|
import { Agent } from "@mastra/core/agent";
|
|
26
|
+
import { testWeatherTool } from "../tools/test-weather-tool";
|
|
26
27
|
|
|
27
28
|
export const testWeatherAgent = new Agent({
|
|
28
29
|
name: "test-weather-agent",
|
|
@@ -38,7 +39,47 @@ export const testWeatherAgent = new Agent({
|
|
|
38
39
|
- If no city is mentioned, ask for a city name
|
|
39
40
|
`;
|
|
40
41
|
},
|
|
41
|
-
model: openai("gpt-4o-mini")
|
|
42
|
+
model: openai("gpt-4o-mini"),
|
|
43
|
+
tools: { testWeatherTool }
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Example tool
|
|
48
|
+
|
|
49
|
+
This tool exports a `WeatherRuntimeContext` type, which can be used anywhere `RuntimeContext` is used to enable type-safe access to runtime configuration.
|
|
50
|
+
|
|
51
|
+
```typescript {4-6} filename="src/mastra/tools/test-weather-tool.ts" showLineNumbers copy
|
|
52
|
+
import { createTool } from "@mastra/core/tools";
|
|
53
|
+
import { z } from "zod";
|
|
54
|
+
|
|
55
|
+
export type WeatherRuntimeContext = {
|
|
56
|
+
"temperature-unit": "celsius" | "fahrenheit";
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const testWeatherTool = createTool({
|
|
60
|
+
id: "test-weather-tool",
|
|
61
|
+
description: "Get weather for a location",
|
|
62
|
+
inputSchema: z.object({
|
|
63
|
+
location: z.string()
|
|
64
|
+
}),
|
|
65
|
+
outputSchema: z.object({
|
|
66
|
+
metric: z.string(),
|
|
67
|
+
temperature: z.number(),
|
|
68
|
+
weather: z.string()
|
|
69
|
+
}),
|
|
70
|
+
execute: async ({ context, runtimeContext }) => {
|
|
71
|
+
const { location } = context;
|
|
72
|
+
const unit = runtimeContext.get("temperature-unit") as WeatherRuntimeContext["temperature-unit"];
|
|
73
|
+
|
|
74
|
+
const temperature = 30;
|
|
75
|
+
const weather = "Sunny";
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
metric: unit === "celsius" ? "°C" : "°F",
|
|
79
|
+
temperature,
|
|
80
|
+
weather
|
|
81
|
+
};
|
|
82
|
+
}
|
|
42
83
|
});
|
|
43
84
|
```
|
|
44
85
|
|
|
@@ -46,16 +87,13 @@ export const testWeatherAgent = new Agent({
|
|
|
46
87
|
|
|
47
88
|
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
89
|
|
|
49
|
-
```typescript {12} filename="src/test-weather-agent.ts" showLineNumbers copy
|
|
90
|
+
```typescript {9, 12} filename="src/test-weather-agent.ts" showLineNumbers copy
|
|
50
91
|
import { mastra } from "./mastra";
|
|
51
92
|
import { RuntimeContext } from "@mastra/core/runtime-context";
|
|
93
|
+
import { WeatherRuntimeContext } from "./mastra/tools/test-weather-tool";
|
|
52
94
|
|
|
53
95
|
const agent = mastra.getAgent("testWeatherAgent");
|
|
54
96
|
|
|
55
|
-
export type WeatherRuntimeContext = {
|
|
56
|
-
"temperature-unit": "celsius" | "fahrenheit";
|
|
57
|
-
};
|
|
58
|
-
|
|
59
97
|
const runtimeContext = new RuntimeContext<WeatherRuntimeContext>();
|
|
60
98
|
|
|
61
99
|
runtimeContext.set("temperature-unit", "fahrenheit");
|
|
@@ -71,14 +109,11 @@ console.log(response.text);
|
|
|
71
109
|
|
|
72
110
|
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
111
|
|
|
74
|
-
```typescript {2,
|
|
112
|
+
```typescript {2,4,9-18} filename="src/mastra/index.ts" showLineNumbers copy
|
|
75
113
|
import { Mastra } from "@mastra/core/mastra";
|
|
76
114
|
import { RuntimeContext } from "@mastra/core/runtime-context";
|
|
77
115
|
import { testWeatherAgent } from "./agents/test-weather-agent";
|
|
78
|
-
|
|
79
|
-
type WeatherRuntimeContext = {
|
|
80
|
-
"temperature-unit": "celsius" | "fahrenheit";
|
|
81
|
-
};
|
|
116
|
+
import { WeatherRuntimeContext } from "./mastra/tools/test-weather-tool";
|
|
82
117
|
|
|
83
118
|
export const mastra = new Mastra({
|
|
84
119
|
agents: { testWeatherAgent },
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.22-alpha.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689)]:
|
|
8
|
+
- @mastra/core@0.17.0-alpha.7
|
|
9
|
+
|
|
3
10
|
## 0.13.22-alpha.6
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.22-alpha.
|
|
3
|
+
"version": "0.13.22-alpha.7",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"uuid": "^11.1.0",
|
|
34
34
|
"zod": "^3.25.76",
|
|
35
35
|
"zod-to-json-schema": "^3.24.6",
|
|
36
|
-
"@mastra/
|
|
37
|
-
"@mastra/
|
|
36
|
+
"@mastra/mcp": "^0.13.0-alpha.2",
|
|
37
|
+
"@mastra/core": "0.17.0-alpha.7"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@hono/node-server": "^1.19.3",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4",
|
|
52
52
|
"@internal/lint": "0.0.39",
|
|
53
|
-
"@mastra/core": "0.17.0-alpha.
|
|
53
|
+
"@mastra/core": "0.17.0-alpha.7"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://mastra.ai",
|
|
56
56
|
"repository": {
|