@mastra/mcp-docs-server 0.13.26 → 0.13.27
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/%40internal%2Fstorage-test-utils.md +9 -9
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +61 -61
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flance.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Frag.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Freact.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +47 -47
- package/.docs/organized/changelogs/mastra.md +63 -63
- package/.docs/organized/code-examples/agent.md +19 -14
- package/.docs/organized/code-examples/heads-up-game.md +5 -5
- package/.docs/raw/agents/agent-memory.mdx +86 -125
- package/.docs/raw/agents/input-processors.mdx +3 -3
- package/.docs/raw/agents/output-processors.mdx +4 -4
- package/.docs/raw/agents/overview.mdx +11 -52
- package/.docs/raw/agents/using-tools-and-mcp.mdx +34 -29
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +18 -0
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +4 -8
- package/.docs/raw/getting-started/installation.mdx +2 -3
- package/.docs/raw/getting-started/model-providers.mdx +28 -123
- package/.docs/raw/memory/semantic-recall.mdx +1 -1
- package/.docs/raw/reference/agents/agent.mdx +1 -1
- package/.docs/raw/reference/agents/generate.mdx +255 -218
- package/.docs/raw/reference/agents/generateLegacy.mdx +528 -0
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +3 -4
- package/.docs/raw/reference/agents/migration-guide.mdx +291 -0
- package/.docs/raw/reference/client-js/agents.mdx +14 -8
- package/.docs/raw/reference/deployer/vercel.mdx +26 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +4 -4
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +13 -13
- package/.docs/raw/reference/streaming/agents/stream.mdx +351 -178
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +515 -0
- package/.docs/raw/reference/{rag → vectors}/astra.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/chroma.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/couchbase.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/lance.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/libsql.mdx +2 -4
- package/.docs/raw/reference/{rag → vectors}/mongodb.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/opensearch.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/pg.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/pinecone.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/qdrant.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/s3vectors.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/turbopuffer.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/upstash.mdx +2 -2
- package/.docs/raw/reference/{rag → vectors}/vectorize.mdx +2 -2
- package/.docs/raw/streaming/events.mdx +4 -4
- package/.docs/raw/streaming/overview.mdx +9 -11
- package/.docs/raw/streaming/tool-streaming.mdx +3 -3
- package/.docs/raw/streaming/workflow-streaming.mdx +3 -3
- package/CHANGELOG.md +16 -0
- package/package.json +5 -5
- package/.docs/organized/code-examples/agent-network.md +0 -322
- package/.docs/raw/getting-started/model-capability.mdx +0 -11
- package/.docs/raw/reference/agents/generateVNext.mdx +0 -557
- package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +0 -67
- package/.docs/raw/reference/streaming/agents/streamVNext.mdx +0 -673
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Upstash Vector Store | Vector Databases |
|
|
2
|
+
title: "Reference: Upstash Vector Store | Vector Databases | Mastra Docs"
|
|
3
3
|
description: Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -351,4 +351,4 @@ Required environment variables:
|
|
|
351
351
|
|
|
352
352
|
## Related
|
|
353
353
|
|
|
354
|
-
- [Metadata Filters](
|
|
354
|
+
- [Metadata Filters](../rag/metadata-filters)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Cloudflare Vector Store | Vector Databases |
|
|
2
|
+
title: "Reference: Cloudflare Vector Store | Vector Databases | Mastra Docs"
|
|
3
3
|
description: Documentation for the CloudflareVector class in Mastra, which provides vector search using Cloudflare Vectorize.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -295,4 +295,4 @@ Required environment variables:
|
|
|
295
295
|
|
|
296
296
|
## Related
|
|
297
297
|
|
|
298
|
-
- [Metadata Filters](
|
|
298
|
+
- [Metadata Filters](../rag/metadata-filters)
|
|
@@ -11,7 +11,7 @@ Events emitted from agents or workflows represent different stages of generation
|
|
|
11
11
|
|
|
12
12
|
## Event types
|
|
13
13
|
|
|
14
|
-
Below is a complete list of events emitted from `.
|
|
14
|
+
Below is a complete list of events emitted from `.stream()`.
|
|
15
15
|
Depending on whether you’re streaming from an **agent** or a **workflow**, only a subset of these events will occur:
|
|
16
16
|
|
|
17
17
|
- **start**: Marks the beginning of an agent or workflow run.
|
|
@@ -29,7 +29,7 @@ Iterate over the `stream` with a `for await` loop to inspect all emitted event c
|
|
|
29
29
|
```typescript {3,7} showLineNumbers copy
|
|
30
30
|
const testAgent = mastra.getAgent("testAgent");
|
|
31
31
|
|
|
32
|
-
const stream = await testAgent.
|
|
32
|
+
const stream = await testAgent.stream([
|
|
33
33
|
{ role: "user", content: "Help me organize my day" },
|
|
34
34
|
]);
|
|
35
35
|
|
|
@@ -38,7 +38,7 @@ for await (const chunk of stream) {
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
> See [Agent.
|
|
41
|
+
> See [Agent.stream()](../../reference/agents/stream.mdx) for more information.
|
|
42
42
|
|
|
43
43
|
### Example agent output
|
|
44
44
|
|
|
@@ -78,7 +78,7 @@ const testWorkflow = mastra.getWorkflow("testWorkflow");
|
|
|
78
78
|
|
|
79
79
|
const run = await testWorkflow.createRunAsync();
|
|
80
80
|
|
|
81
|
-
const stream = await run.
|
|
81
|
+
const stream = await run.stream({
|
|
82
82
|
inputData: {
|
|
83
83
|
value: "initial data"
|
|
84
84
|
}
|
|
@@ -3,33 +3,31 @@ title: "Streaming Overview | Streaming | Mastra"
|
|
|
3
3
|
description: "Streaming in Mastra enables real-time, incremental responses from both agents and workflows, providing immediate feedback as AI-generated content is produced."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { StreamVNextCallout } from "@/components/streamVNext-callout.tsx"
|
|
7
6
|
|
|
8
7
|
# Streaming Overview
|
|
9
8
|
|
|
10
|
-
<StreamVNextCallout />
|
|
11
9
|
|
|
12
10
|
Mastra supports real-time, incremental responses from agents and workflows, allowing users to see output as it’s generated instead of waiting for completion. This is useful for chat, long-form content, multi-step workflows, or any scenario where immediate feedback matters.
|
|
13
11
|
|
|
14
12
|
## Getting started
|
|
15
13
|
|
|
16
|
-
Mastra
|
|
14
|
+
Mastra's streaming API adapts based on your model version:
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
- **`.stream()`**: For V2 models, supports **AI SDK v5** (`LanguageModelV2`).
|
|
17
|
+
- **`.streamLegacy()`**: For V1 models, supports **AI SDK v4** (`LanguageModelV1`).
|
|
20
18
|
|
|
21
19
|
## Streaming with agents
|
|
22
20
|
|
|
23
21
|
You can pass a single string for simple prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
|
|
24
22
|
|
|
25
|
-
### Using `Agent.
|
|
23
|
+
### Using `Agent.stream()`
|
|
26
24
|
|
|
27
25
|
A `textStream` breaks the response into chunks as it's generated, allowing output to stream progressively instead of arriving all at once. Iterate over the `textStream` using a `for await` loop to inspect each stream chunk.
|
|
28
26
|
|
|
29
27
|
```typescript {3,7} showLineNumbers copy
|
|
30
28
|
const testAgent = mastra.getAgent("testAgent");
|
|
31
29
|
|
|
32
|
-
const stream = await testAgent.
|
|
30
|
+
const stream = await testAgent.stream([
|
|
33
31
|
{ role: "user", content: "Help me organize my day" },
|
|
34
32
|
]);
|
|
35
33
|
|
|
@@ -38,9 +36,9 @@ for await (const chunk of stream.textStream) {
|
|
|
38
36
|
}
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
> See [Agent.
|
|
39
|
+
> See [Agent.stream()](../../reference/agents/stream.mdx) for more information.
|
|
42
40
|
|
|
43
|
-
### Output from `Agent.
|
|
41
|
+
### Output from `Agent.stream()`
|
|
44
42
|
|
|
45
43
|
The output streams the generated response from the agent.
|
|
46
44
|
|
|
@@ -70,7 +68,7 @@ For integration with AI SDK v5, use `format` 'aisdk' to get an `AISDKV5OutputStr
|
|
|
70
68
|
```typescript {5} showLineNumbers copy
|
|
71
69
|
const testAgent = mastra.getAgent("testAgent");
|
|
72
70
|
|
|
73
|
-
const stream = await testAgent.
|
|
71
|
+
const stream = await testAgent.stream(
|
|
74
72
|
[{ role: "user", content: "Help me organize my day" }],
|
|
75
73
|
{ format: "aisdk" }
|
|
76
74
|
);
|
|
@@ -104,7 +102,7 @@ for await (const chunk of stream) {
|
|
|
104
102
|
|
|
105
103
|
> See [Run.streamVNext()](../../reference/workflows/run-methods/streamVNext.mdx) for more information.
|
|
106
104
|
|
|
107
|
-
### Output from `Run.
|
|
105
|
+
### Output from `Run.stream()`
|
|
108
106
|
|
|
109
107
|
The experimental API event structure includes `runId` and `from` at the top level, making it easier to identify and track workflow runs without digging into the payload.
|
|
110
108
|
|
|
@@ -12,7 +12,7 @@ Tool streaming in Mastra enables tools to send incremental results while they ru
|
|
|
12
12
|
Streams can be written to in two main ways:
|
|
13
13
|
|
|
14
14
|
- **From within a tool**: every tool receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
|
|
15
|
-
- **From an agent stream**: you can also pipe an agent’s `
|
|
15
|
+
- **From an agent stream**: you can also pipe an agent’s `stream` output directly into a tool’s writer, making it easy to chain agent responses into tool results without extra glue code.
|
|
16
16
|
|
|
17
17
|
By combining writable tool streams with agent streaming, you gain fine grained control over how intermediate results flow through your system and into the user experience.
|
|
18
18
|
|
|
@@ -74,7 +74,7 @@ export const testTool = createTool({
|
|
|
74
74
|
Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or tool-specific data.
|
|
75
75
|
|
|
76
76
|
```typescript showLineNumbers copy
|
|
77
|
-
const stream = await testAgent.
|
|
77
|
+
const stream = await testAgent.stream([
|
|
78
78
|
"What is the weather in London?",
|
|
79
79
|
"Use the testTool"
|
|
80
80
|
]);
|
|
@@ -100,7 +100,7 @@ export const testTool = createTool({
|
|
|
100
100
|
const { city } = context;
|
|
101
101
|
|
|
102
102
|
const testAgent = mastra?.getAgent("testAgent");
|
|
103
|
-
const stream = await testAgent?.
|
|
103
|
+
const stream = await testAgent?.stream(`What is the weather in ${city}?`);
|
|
104
104
|
|
|
105
105
|
await stream!.textStream.pipeTo(writer!);
|
|
106
106
|
|
|
@@ -12,7 +12,7 @@ Workflow streaming in Mastra enables workflows to send incremental results while
|
|
|
12
12
|
Streams can be written to in two main ways:
|
|
13
13
|
|
|
14
14
|
- **From within a workflow step**: every workflow step receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
|
|
15
|
-
- **From an agent stream**: you can also pipe an agent's `
|
|
15
|
+
- **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it easy to chain agent responses into workflow results without extra glue code.
|
|
16
16
|
|
|
17
17
|
By combining writable workflow streams with agent streaming, you gain fine-grained control over how intermediate results flow through your system and into the user experience.
|
|
18
18
|
|
|
@@ -60,7 +60,7 @@ const testWorkflow = mastra.getWorkflow("testWorkflow");
|
|
|
60
60
|
|
|
61
61
|
const run = await testWorkflow.createRunAsync();
|
|
62
62
|
|
|
63
|
-
const stream = await run.
|
|
63
|
+
const stream = await run.stream({
|
|
64
64
|
inputData: {
|
|
65
65
|
value: "initial data"
|
|
66
66
|
}
|
|
@@ -85,7 +85,7 @@ export const testStep = createStep({
|
|
|
85
85
|
const { city } = inputData
|
|
86
86
|
|
|
87
87
|
const testAgent = mastra?.getAgent("testAgent");
|
|
88
|
-
const stream = await testAgent?.
|
|
88
|
+
const stream = await testAgent?.stream(`What is the weather in ${city}$?`);
|
|
89
89
|
|
|
90
90
|
await stream!.textStream.pipeTo(writer!);
|
|
91
91
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`03622f8`](https://github.com/mastra-ai/mastra/commit/03622f86e9d7342197f80f95333ea3ff65c783ae), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
8
|
+
- @mastra/core@0.20.0
|
|
9
|
+
- @mastra/mcp@0.13.3
|
|
10
|
+
|
|
11
|
+
## 0.13.27-alpha.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`03622f8`](https://github.com/mastra-ai/mastra/commit/03622f86e9d7342197f80f95333ea3ff65c783ae), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
16
|
+
- @mastra/core@0.20.0-alpha.0
|
|
17
|
+
- @mastra/mcp@0.13.3-alpha.0
|
|
18
|
+
|
|
3
19
|
## 0.13.26
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.27",
|
|
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/core": "0.20.0",
|
|
37
|
+
"@mastra/mcp": "^0.13.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@hono/node-server": "^1.19.5",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"tsx": "^4.19.4",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4",
|
|
52
|
-
"@internal/lint": "0.0.
|
|
53
|
-
"@mastra/core": "0.
|
|
52
|
+
"@internal/lint": "0.0.45",
|
|
53
|
+
"@mastra/core": "0.20.0"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://mastra.ai",
|
|
56
56
|
"repository": {
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
### package.json
|
|
2
|
-
```json
|
|
3
|
-
{
|
|
4
|
-
"name": "examples-agent-network",
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"@ai-sdk/anthropic": "^1.2.12",
|
|
7
|
-
"@ai-sdk/openai": "^1.3.24",
|
|
8
|
-
"@mastra/client-js": "latest",
|
|
9
|
-
"@mastra/core": "latest",
|
|
10
|
-
"@mastra/libsql": "latest",
|
|
11
|
-
"@mastra/loggers": "latest",
|
|
12
|
-
"@mastra/memory": "latest",
|
|
13
|
-
"mastra": "latest",
|
|
14
|
-
"zod": "^3.25.76"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### agent-workflow.ts
|
|
20
|
-
```typescript
|
|
21
|
-
import { mastra } from './mastra';
|
|
22
|
-
|
|
23
|
-
async function main() {
|
|
24
|
-
const wflow = mastra.getWorkflow('agentWorkflow');
|
|
25
|
-
|
|
26
|
-
const run = await wflow.createRunAsync();
|
|
27
|
-
const { runId, start } = run;
|
|
28
|
-
|
|
29
|
-
const result = await start({
|
|
30
|
-
triggerData: {
|
|
31
|
-
prompt: 'What is the capital of France?',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
console.log(JSON.stringify(result, null, 2));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
main().catch(console.error);
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### index.ts
|
|
43
|
-
```typescript
|
|
44
|
-
import { mastra } from './mastra';
|
|
45
|
-
|
|
46
|
-
async function main() {
|
|
47
|
-
const researchNetwork = mastra.getNetwork('Research_Network');
|
|
48
|
-
|
|
49
|
-
if (!researchNetwork) {
|
|
50
|
-
throw new Error('Research network not found');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.log('🔍 Starting research on Napoleon Bonaparte...\n');
|
|
54
|
-
|
|
55
|
-
// Generate a report using the research network
|
|
56
|
-
// Using the generate() method as per the API update (MEMORY[8bf54da9-89a8-4e5b-b875-234a1aa8a53b])
|
|
57
|
-
const result = await researchNetwork.stream('Give me a report on Napoleon Bonaparte', {
|
|
58
|
-
maxSteps: 20, // Allow enough steps for the LLM router to determine the best agents to use
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
for await (const part of result.fullStream) {
|
|
62
|
-
switch (part.type) {
|
|
63
|
-
case 'error':
|
|
64
|
-
console.error(part.error);
|
|
65
|
-
break;
|
|
66
|
-
case 'text-delta':
|
|
67
|
-
process.stdout.write(part.textDelta);
|
|
68
|
-
break;
|
|
69
|
-
case 'tool-call':
|
|
70
|
-
console.log(`calling tool ${part.toolName} with args ${JSON.stringify(part.args, null, 2)}`);
|
|
71
|
-
break;
|
|
72
|
-
case 'tool-result':
|
|
73
|
-
console.log(`tool result ${JSON.stringify(part.result, null, 2)}`);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Display the final result
|
|
79
|
-
console.log('\n\n📝 Final Research Report:\n');
|
|
80
|
-
|
|
81
|
-
console.log('\n\n📊 Agent Interaction Summary:');
|
|
82
|
-
console.log(researchNetwork.getAgentInteractionSummary());
|
|
83
|
-
|
|
84
|
-
console.log('\n🏁 Research complete!');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Run the main function with error handling
|
|
88
|
-
main().catch(error => {
|
|
89
|
-
console.error('❌ Error:', error);
|
|
90
|
-
process.exit(1);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### mastra/index.ts
|
|
96
|
-
```typescript
|
|
97
|
-
import { Mastra } from '@mastra/core';
|
|
98
|
-
import { PinoLogger } from '@mastra/loggers';
|
|
99
|
-
// import { researchNetwork } from './network';
|
|
100
|
-
import { webSearchAgent, synthesizeAgent } from './agents';
|
|
101
|
-
import { planningAgent } from './agents/planning';
|
|
102
|
-
import { travelAgent, summaryAgent } from './agents/travelAgent';
|
|
103
|
-
// import { agentWorkflow } from './workflows';
|
|
104
|
-
import { v_nextNetwork } from './network/v-next';
|
|
105
|
-
import { LibSQLStore } from '@mastra/libsql';
|
|
106
|
-
import { workflow1 } from './network/v-next';
|
|
107
|
-
import { travelAgentWorkflow } from './workflows/step4';
|
|
108
|
-
import { incrementWorkflow } from './workflows/step5';
|
|
109
|
-
import { weatherWorkflow } from './workflows/step3';
|
|
110
|
-
|
|
111
|
-
export const mastra = new Mastra({
|
|
112
|
-
agents: {
|
|
113
|
-
webSearchAgent,
|
|
114
|
-
planningAgent,
|
|
115
|
-
travelAgent,
|
|
116
|
-
summaryTravelAgent: summaryAgent,
|
|
117
|
-
synthesizeAgent,
|
|
118
|
-
},
|
|
119
|
-
// networks: {
|
|
120
|
-
// researchNetwork,
|
|
121
|
-
// },
|
|
122
|
-
vnext_networks: {
|
|
123
|
-
v_nextNetwork,
|
|
124
|
-
},
|
|
125
|
-
storage: new LibSQLStore({
|
|
126
|
-
url: 'file:../mastra.db', // Or your database URL
|
|
127
|
-
}),
|
|
128
|
-
workflows: {
|
|
129
|
-
workflow1,
|
|
130
|
-
travelAgentWorkflow,
|
|
131
|
-
incrementWorkflow,
|
|
132
|
-
weatherWorkflow,
|
|
133
|
-
},
|
|
134
|
-
logger: new PinoLogger({ name: 'Chef', level: 'info' }),
|
|
135
|
-
serverMiddleware: [
|
|
136
|
-
{
|
|
137
|
-
handler: (c, next) => {
|
|
138
|
-
console.log('Middleware called');
|
|
139
|
-
return next();
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### mastra/network/index.ts
|
|
148
|
-
```typescript
|
|
149
|
-
import { openai } from '@ai-sdk/openai';
|
|
150
|
-
import { AgentNetwork } from '@mastra/core/network';
|
|
151
|
-
import {
|
|
152
|
-
primaryResearchAgent,
|
|
153
|
-
webSearchAgent,
|
|
154
|
-
academicResearchAgent,
|
|
155
|
-
factCheckingAgent,
|
|
156
|
-
dataAnalysisAgent,
|
|
157
|
-
} from '../agents';
|
|
158
|
-
|
|
159
|
-
export const researchNetwork = new AgentNetwork({
|
|
160
|
-
name: 'Research Network',
|
|
161
|
-
agents: [primaryResearchAgent, webSearchAgent, academicResearchAgent, factCheckingAgent, dataAnalysisAgent],
|
|
162
|
-
model: openai('gpt-4o'), // Add the model property which is required
|
|
163
|
-
instructions: `
|
|
164
|
-
You are a research coordination system that routes queries to the appropriate specialized agents.
|
|
165
|
-
|
|
166
|
-
Your available agents are:
|
|
167
|
-
1. Primary Research Agent: Coordinates research efforts, breaks down complex questions, and synthesizes information
|
|
168
|
-
2. Web Search Agent: Finds up-to-date information online with proper citations
|
|
169
|
-
3. Academic Research Agent: Provides academic perspectives, theories, and scholarly context
|
|
170
|
-
4. Fact Checking Agent: Verifies claims and identifies potential misinformation
|
|
171
|
-
5. Data Analysis Agent: Interprets numerical data, statistics, and identifies patterns
|
|
172
|
-
|
|
173
|
-
For each user query:
|
|
174
|
-
1. Start with the Primary Research Agent to analyze the query and break it down
|
|
175
|
-
2. Route sub-questions to the appropriate specialized agents based on their expertise
|
|
176
|
-
3. Use the Fact Checking Agent to verify important claims when necessary
|
|
177
|
-
4. Return to the Primary Research Agent to synthesize all findings into a comprehensive response
|
|
178
|
-
|
|
179
|
-
Always maintain a chain of evidence and proper attribution between agents.
|
|
180
|
-
`,
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### mastra/network/v-next.ts
|
|
186
|
-
```typescript
|
|
187
|
-
import { openai } from '@ai-sdk/openai';
|
|
188
|
-
import { anthropic } from '@ai-sdk/anthropic';
|
|
189
|
-
import { NewAgentNetwork } from '@mastra/core/network/vNext';
|
|
190
|
-
import { Agent } from '@mastra/core/agent';
|
|
191
|
-
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
|
192
|
-
import { LibSQLStore } from '@mastra/libsql';
|
|
193
|
-
import { Memory } from '@mastra/memory';
|
|
194
|
-
import { z } from 'zod';
|
|
195
|
-
import { weatherAgent } from '../agents';
|
|
196
|
-
import { weatherTool } from '../tools';
|
|
197
|
-
|
|
198
|
-
const memory = new Memory({
|
|
199
|
-
storage: new LibSQLStore({
|
|
200
|
-
url: 'file:../mastra.db', // Or your database URL
|
|
201
|
-
}),
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
const agent1 = new Agent({
|
|
205
|
-
name: 'agent1',
|
|
206
|
-
instructions:
|
|
207
|
-
'This agent is used to do research, but not create full responses. Answer in bullet points only and be concise.',
|
|
208
|
-
description:
|
|
209
|
-
'This agent is used to do research, but not create full responses. Answer in bullet points only and be concise.',
|
|
210
|
-
model: openai('gpt-4o'),
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
const agent2 = new Agent({
|
|
214
|
-
name: 'agent2',
|
|
215
|
-
description: 'This agent is used to do text synthesis on researched material. It writes articles in full paragraphs.',
|
|
216
|
-
instructions:
|
|
217
|
-
'This agent is used to do text synthesis on researched material. Write a full report based on the researched material. Do not use bullet points. Write full paragraphs. There should not be a single bullet point in the final report. You write articles.',
|
|
218
|
-
model: openai('gpt-4o'),
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
const agentStep1 = createStep({
|
|
222
|
-
id: 'agent-workflow-step-1',
|
|
223
|
-
description: 'This step is used to do research and text synthesis.',
|
|
224
|
-
inputSchema: z.object({
|
|
225
|
-
city: z.string().describe('The city to research'),
|
|
226
|
-
}),
|
|
227
|
-
outputSchema: z.object({
|
|
228
|
-
text: z.string(),
|
|
229
|
-
}),
|
|
230
|
-
execute: async ({ inputData }) => {
|
|
231
|
-
const resp = await agent1.generate(inputData.city, {
|
|
232
|
-
output: z.object({
|
|
233
|
-
text: z.string(),
|
|
234
|
-
}),
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
return { text: resp.object.text };
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const agentStep2 = createStep({
|
|
242
|
-
id: 'agent-workflow-step-2',
|
|
243
|
-
description: 'This step is used to do research and text synthesis.',
|
|
244
|
-
inputSchema: z.object({
|
|
245
|
-
text: z.string().describe('The city to research'),
|
|
246
|
-
}),
|
|
247
|
-
outputSchema: z.object({
|
|
248
|
-
text: z.string(),
|
|
249
|
-
}),
|
|
250
|
-
execute: async ({ inputData }) => {
|
|
251
|
-
const resp = await agent2.generate(inputData.text, {
|
|
252
|
-
output: z.object({
|
|
253
|
-
text: z.string(),
|
|
254
|
-
}),
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
return { text: resp.object.text };
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
export const workflow1 = createWorkflow({
|
|
262
|
-
id: 'workflow1',
|
|
263
|
-
description: 'This workflow is perfect for researching a specific city.',
|
|
264
|
-
inputSchema: z.object({
|
|
265
|
-
city: z.string(),
|
|
266
|
-
}),
|
|
267
|
-
outputSchema: z.object({
|
|
268
|
-
text: z.string(),
|
|
269
|
-
}),
|
|
270
|
-
})
|
|
271
|
-
.then(agentStep1)
|
|
272
|
-
.then(agentStep2)
|
|
273
|
-
.commit();
|
|
274
|
-
|
|
275
|
-
export const v_nextNetwork = new NewAgentNetwork({
|
|
276
|
-
id: 'test-network',
|
|
277
|
-
name: 'Test Network',
|
|
278
|
-
instructions:
|
|
279
|
-
'You can research cities. You can also synthesize research material. You can also write a full report based on the researched material. You can also get weather information. workflow1 is the best primitive for researching an *individual* city and it should always be used when running multiple primitives to accomplish a task.',
|
|
280
|
-
model: openai('gpt-4o'),
|
|
281
|
-
agents: {
|
|
282
|
-
agent1,
|
|
283
|
-
agent2,
|
|
284
|
-
// weatherAgent,
|
|
285
|
-
},
|
|
286
|
-
tools: {
|
|
287
|
-
weatherTool,
|
|
288
|
-
},
|
|
289
|
-
workflows: {
|
|
290
|
-
workflow1,
|
|
291
|
-
},
|
|
292
|
-
memory: memory,
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### mastra/workflows/index.ts
|
|
298
|
-
```typescript
|
|
299
|
-
import { Workflow } from '@mastra/core/workflows';
|
|
300
|
-
import { z } from 'zod';
|
|
301
|
-
import { webSearchAgent } from '../agents';
|
|
302
|
-
|
|
303
|
-
export const agentWorkflow = new Workflow({
|
|
304
|
-
name: 'Agent Workflow',
|
|
305
|
-
steps: [webSearchAgent.toStep()],
|
|
306
|
-
triggerSchema: z.object({
|
|
307
|
-
prompt: z.string(),
|
|
308
|
-
}),
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
agentWorkflow
|
|
312
|
-
.step(webSearchAgent, {
|
|
313
|
-
variables: {
|
|
314
|
-
prompt: {
|
|
315
|
-
step: 'trigger',
|
|
316
|
-
path: 'prompt',
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
})
|
|
320
|
-
.commit();
|
|
321
|
-
|
|
322
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Model Capabilities
|
|
2
|
-
|
|
3
|
-
import { ProviderTable } from "@/components/provider-table";
|
|
4
|
-
|
|
5
|
-
The AI providers support different language models with various capabilities. Not all models support structured output, image input, object generation, tool usage, or tool streaming.
|
|
6
|
-
|
|
7
|
-
Here are the capabilities of popular models:
|
|
8
|
-
|
|
9
|
-
<ProviderTable />
|
|
10
|
-
|
|
11
|
-
Source: [AI SDK | Model Capabilities](https://sdk.vercel.ai/docs/foundations/providers-and-models#model-capabilities)
|