@mastra/mcp-docs-server 1.0.0-beta.4 → 1.0.0-beta.5
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 +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +326 -126
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Freact.md +80 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +36 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
- package/.docs/organized/changelogs/create-mastra.md +201 -1
- package/.docs/organized/changelogs/mastra.md +201 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +7 -10
- package/.docs/raw/agents/guardrails.mdx +19 -20
- package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +6 -5
- package/.docs/raw/agents/networks.mdx +1 -2
- package/.docs/raw/agents/overview.mdx +5 -5
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
- package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
- package/.docs/raw/deployment/building-mastra.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +1 -1
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +19 -17
- package/.docs/raw/deployment/mastra-cloud/setting-up.mdx +1 -1
- package/.docs/raw/deployment/overview.mdx +2 -2
- package/.docs/raw/deployment/web-framework.mdx +5 -5
- package/.docs/raw/evals/custom-scorers.mdx +3 -5
- package/.docs/raw/evals/overview.mdx +2 -3
- package/.docs/raw/getting-started/project-structure.mdx +1 -1
- package/.docs/raw/getting-started/start.mdx +72 -0
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/{frameworks/agentic-uis/ai-sdk.mdx → guides/build-your-ui/ai-sdk-ui.mdx} +105 -11
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +23 -25
- package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +3 -4
- package/.docs/raw/guides/{guide → getting-started}/manual-install.mdx +1 -1
- package/.docs/raw/guides/{quickstarts/nextjs.mdx → getting-started/next-js.mdx} +11 -11
- package/.docs/raw/guides/{quickstarts/standalone-server.mdx → getting-started/quickstart.mdx} +7 -7
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +23 -25
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +7 -7
- package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
- package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +2 -2
- package/.docs/raw/guides/guide/research-assistant.mdx +7 -8
- package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
- package/.docs/raw/guides/guide/web-search.mdx +12 -10
- package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +29 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +5 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +22 -0
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mcp/overview.mdx +3 -5
- package/.docs/raw/memory/memory-processors.mdx +1 -2
- package/.docs/raw/memory/semantic-recall.mdx +7 -7
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-pg.mdx +2 -4
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +2 -4
- package/.docs/raw/memory/threads-and-resources.mdx +3 -3
- package/.docs/raw/memory/working-memory.mdx +4 -5
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +1 -1
- package/.docs/raw/observability/overview.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/otel.mdx +21 -2
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +107 -0
- package/.docs/raw/observability/tracing/overview.mdx +3 -2
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +3 -2
- package/.docs/raw/rag/retrieval.mdx +20 -32
- package/.docs/raw/reference/agents/agent.mdx +7 -10
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +2 -3
- package/.docs/raw/reference/cli/mastra.mdx +2 -1
- package/.docs/raw/reference/client-js/agents.mdx +3 -3
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +5 -19
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/evals/answer-relevancy.mdx +28 -98
- package/.docs/raw/reference/evals/answer-similarity.mdx +12 -258
- package/.docs/raw/reference/evals/bias.mdx +29 -87
- package/.docs/raw/reference/evals/completeness.mdx +31 -90
- package/.docs/raw/reference/evals/content-similarity.mdx +28 -88
- package/.docs/raw/reference/evals/context-precision.mdx +28 -130
- package/.docs/raw/reference/evals/context-relevance.mdx +11 -11
- package/.docs/raw/reference/evals/faithfulness.mdx +28 -101
- package/.docs/raw/reference/evals/hallucination.mdx +28 -103
- package/.docs/raw/reference/evals/keyword-coverage.mdx +28 -107
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +11 -11
- package/.docs/raw/reference/evals/prompt-alignment.mdx +15 -15
- package/.docs/raw/reference/evals/textual-difference.mdx +27 -100
- package/.docs/raw/reference/evals/tone-consistency.mdx +25 -98
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +7 -7
- package/.docs/raw/reference/evals/toxicity.mdx +29 -92
- package/.docs/raw/reference/memory/memory-class.mdx +5 -7
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +2 -2
- package/.docs/raw/reference/processors/pii-detector.mdx +2 -2
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -3
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +2 -2
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- package/.docs/raw/reference/rag/embeddings.mdx +5 -5
- package/.docs/raw/reference/rag/rerank.mdx +1 -2
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +8 -1
- package/.docs/raw/reference/templates/overview.mdx +1 -4
- package/.docs/raw/reference/tools/client.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +132 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +5 -5
- package/.docs/raw/reference/tools/mcp-client.mdx +2 -4
- package/.docs/raw/reference/tools/mcp-server.mdx +1 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +14 -15
- package/.docs/raw/reference/vectors/chroma.mdx +81 -1
- package/.docs/raw/reference/vectors/couchbase.mdx +24 -17
- package/.docs/raw/reference/vectors/lance.mdx +38 -22
- package/.docs/raw/reference/vectors/libsql.mdx +35 -2
- package/.docs/raw/reference/vectors/mongodb.mdx +35 -2
- package/.docs/raw/reference/vectors/opensearch.mdx +37 -16
- package/.docs/raw/reference/vectors/pg.mdx +43 -36
- package/.docs/raw/reference/vectors/pinecone.mdx +48 -1
- package/.docs/raw/reference/vectors/qdrant.mdx +36 -1
- package/.docs/raw/reference/vectors/turbopuffer.mdx +74 -0
- package/.docs/raw/reference/voice/openai-realtime.mdx +2 -2
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +2 -3
- package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
- package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
- package/.docs/raw/reference/voice/voice.close.mdx +1 -1
- package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
- package/.docs/raw/reference/voice/voice.off.mdx +1 -1
- package/.docs/raw/reference/voice/voice.on.mdx +1 -1
- package/.docs/raw/reference/voice/voice.send.mdx +1 -1
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/server-db/mastra-client.mdx +1 -2
- package/.docs/raw/streaming/overview.mdx +20 -9
- package/.docs/raw/streaming/tool-streaming.mdx +47 -4
- package/.docs/raw/tools-mcp/advanced-usage.mdx +1 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +3 -5
- package/.docs/raw/voice/overview.mdx +21 -41
- package/.docs/raw/voice/speech-to-speech.mdx +4 -4
- package/.docs/raw/voice/speech-to-text.mdx +1 -2
- package/.docs/raw/voice/text-to-speech.mdx +1 -2
- package/.docs/raw/workflows/control-flow.mdx +180 -0
- package/CHANGELOG.md +10 -0
- package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
- package/dist/prepare-docs/package-changes.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +7 -7
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -102
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
- package/.docs/raw/getting-started/quickstart.mdx +0 -27
- package/.docs/raw/getting-started/templates.mdx +0 -73
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +0 -0
- /package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/copilotkit.mdx +0 -0
|
@@ -27,27 +27,27 @@ Use this guide to scaffold and integrate Mastra with your SvelteKit project.
|
|
|
27
27
|
|
|
28
28
|
Install Mastra
|
|
29
29
|
|
|
30
|
-
Install the required
|
|
30
|
+
Install the required packages:
|
|
31
31
|
|
|
32
32
|
<Tabs>
|
|
33
33
|
<TabItem value="npm" label="npm">
|
|
34
34
|
```bash copy
|
|
35
|
-
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
35
|
+
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
36
36
|
```
|
|
37
37
|
</TabItem>
|
|
38
38
|
<TabItem value="yarn" label="yarn">
|
|
39
39
|
```bash copy
|
|
40
|
-
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
40
|
+
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
41
41
|
```
|
|
42
42
|
</TabItem>
|
|
43
43
|
<TabItem value="pnpm" label="pnpm">
|
|
44
44
|
```bash copy
|
|
45
|
-
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
45
|
+
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
46
46
|
```
|
|
47
47
|
</TabItem>
|
|
48
48
|
<TabItem value="bun" label="bun">
|
|
49
49
|
```bash copy
|
|
50
|
-
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
50
|
+
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
51
51
|
```
|
|
52
52
|
</TabItem>
|
|
53
53
|
</Tabs>
|
|
@@ -128,14 +128,13 @@ Add `.mastra` to your `.gitignore` file:
|
|
|
128
128
|
|
|
129
129
|
Update the Mastra Agent
|
|
130
130
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
+ import { createOpenAI } from "@ai-sdk/openai";
|
|
131
|
+
```typescript title="src/mastra/agents/weather-agent.ts"
|
|
132
|
+
import { createOpenAI } from "@ai-sdk/openai";
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
const openai = createOpenAI({
|
|
135
|
+
apiKey: import.meta.env?.VITE_OPENAI_API_KEY || process.env.VITE_OPENAI_API_KEY,
|
|
136
|
+
compatibility: "strict"
|
|
137
|
+
});
|
|
139
138
|
```
|
|
140
139
|
|
|
141
140
|
By reading env vars from both `import.meta.env` and `process.env`, we ensure that the API key is available in both the SvelteKit dev server and the Mastra Dev Server.
|
|
@@ -258,27 +257,27 @@ If you need more details or information about a different location, feel free to
|
|
|
258
257
|
|
|
259
258
|
<StepItem>
|
|
260
259
|
|
|
261
|
-
Install the required
|
|
260
|
+
Install the required packages:
|
|
262
261
|
|
|
263
262
|
<Tabs>
|
|
264
263
|
<TabItem value="npm" label="npm">
|
|
265
264
|
```bash copy
|
|
266
|
-
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
265
|
+
npm install mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
267
266
|
```
|
|
268
267
|
</TabItem>
|
|
269
268
|
<TabItem value="yarn" label="yarn">
|
|
270
269
|
```bash copy
|
|
271
|
-
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
270
|
+
yarn add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
272
271
|
```
|
|
273
272
|
</TabItem>
|
|
274
273
|
<TabItem value="pnpm" label="pnpm">
|
|
275
274
|
```bash copy
|
|
276
|
-
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
275
|
+
pnpm add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
277
276
|
```
|
|
278
277
|
</TabItem>
|
|
279
278
|
<TabItem value="bun" label="bun">
|
|
280
279
|
```bash copy
|
|
281
|
-
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta
|
|
280
|
+
bun add mastra@beta @mastra/core@beta @mastra/libsql@beta @ai-sdk/openai
|
|
282
281
|
```
|
|
283
282
|
</TabItem>
|
|
284
283
|
</Tabs>
|
|
@@ -359,14 +358,13 @@ Add `.mastra` to your `.gitignore` file:
|
|
|
359
358
|
|
|
360
359
|
Update the Mastra Agent
|
|
361
360
|
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
+ import { createOpenAI } from "@ai-sdk/openai";
|
|
361
|
+
```typescript title="src/mastra/agents/weather-agent.ts"
|
|
362
|
+
import { createOpenAI } from "@ai-sdk/openai";
|
|
365
363
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
364
|
+
const openai = createOpenAI({
|
|
365
|
+
apiKey: import.meta.env?.VITE_OPENAI_API_KEY || process.env.VITE_OPENAI_API_KEY,
|
|
366
|
+
compatibility: "strict"
|
|
367
|
+
});
|
|
370
368
|
```
|
|
371
369
|
|
|
372
370
|
By reading env vars from both `import.meta.env` and `process.env`, we ensure that the API key is available in both the SvelteKit dev server and the Mastra Dev Server.
|
|
@@ -499,4 +497,4 @@ If you need more details or information about a different location, feel free to
|
|
|
499
497
|
|
|
500
498
|
## Next steps
|
|
501
499
|
|
|
502
|
-
- [Monorepo Deployment](
|
|
500
|
+
- [Monorepo Deployment](/docs/v1/deployment/monorepo)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Integrate Mastra in your
|
|
3
|
-
description: A step-by-step guide to integrating Mastra with
|
|
2
|
+
title: "Integrate Mastra in your React + Vite project | Frameworks"
|
|
3
|
+
description: A step-by-step guide to integrating Mastra with React and Vite.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import Tabs from "@theme/Tabs";
|
|
7
7
|
import TabItem from "@theme/TabItem";
|
|
8
8
|
|
|
9
|
-
# Integrate Mastra in your
|
|
9
|
+
# Integrate Mastra in your React + Vite project
|
|
10
10
|
|
|
11
11
|
Mastra integrates with Vite, making it easy to:
|
|
12
12
|
|
|
@@ -14,11 +14,11 @@ Mastra integrates with Vite, making it easy to:
|
|
|
14
14
|
- Simplify deployment with a unified codebase for frontend and backend
|
|
15
15
|
- Take advantage of Mastra's Client SDK
|
|
16
16
|
|
|
17
|
-
Use this guide to scaffold and integrate Mastra with your
|
|
17
|
+
Use this guide to scaffold and integrate Mastra with your React + Vite project.
|
|
18
18
|
|
|
19
19
|
:::warning
|
|
20
20
|
|
|
21
|
-
This guide assumes you're using
|
|
21
|
+
This guide assumes you're using React + Vite with React Router v7 at the root of your project, e.g., `app`.
|
|
22
22
|
|
|
23
23
|
:::
|
|
24
24
|
|
|
@@ -81,7 +81,7 @@ npx mastra@latest init
|
|
|
81
81
|
|
|
82
82
|
:::warning
|
|
83
83
|
|
|
84
|
-
By default, `mastra init` suggests `src` as the install location. If you're using
|
|
84
|
+
By default, `mastra init` suggests `src` as the install location. If you're using React + Vite at the root of your project (e.g., `app`, not `src/app`), enter `.` when prompted:
|
|
85
85
|
|
|
86
86
|
:::
|
|
87
87
|
|
|
@@ -252,4 +252,4 @@ The current weather in London is partly cloudy with a temperature of 19.3°C, fe
|
|
|
252
252
|
|
|
253
253
|
## Next steps
|
|
254
254
|
|
|
255
|
-
- [Monorepo Deployment](
|
|
255
|
+
- [Monorepo Deployment](/docs/v1/deployment/monorepo)
|
|
@@ -16,7 +16,7 @@ You'll create a workflow that gathers information from a candidate's resume, the
|
|
|
16
16
|
|
|
17
17
|
- Node.js `v22.13.0` or later installed
|
|
18
18
|
- An API key from a supported [Model Provider](/models/v1)
|
|
19
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
19
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
20
20
|
|
|
21
21
|
## Building the Workflow
|
|
22
22
|
|
|
@@ -58,13 +58,12 @@ To the existing `src/mastra/workflows/candidate-workflow.ts` file add the follow
|
|
|
58
58
|
|
|
59
59
|
```ts copy title="src/mastra/workflows/candidate-workflow.ts"
|
|
60
60
|
import { Agent } from "@mastra/core/agent";
|
|
61
|
-
import { openai } from "@ai-sdk/openai";
|
|
62
61
|
|
|
63
62
|
const recruiter = new Agent({
|
|
64
63
|
id: "recruiter-agent",
|
|
65
64
|
name: "Recruiter Agent",
|
|
66
65
|
instructions: `You are a recruiter.`,
|
|
67
|
-
model: openai
|
|
66
|
+
model: "openai/gpt-5.1",
|
|
68
67
|
});
|
|
69
68
|
|
|
70
69
|
const gatherCandidateInfo = createStep({
|
|
@@ -19,7 +19,7 @@ You'll learn how to create the agent and register it with Mastra. Next, you'll i
|
|
|
19
19
|
|
|
20
20
|
- Node.js `v22.13.0` or later installed
|
|
21
21
|
- An API key from a supported [Model Provider](/models/v1)
|
|
22
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
22
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
23
23
|
|
|
24
24
|
## Creating the Agent
|
|
25
25
|
|
|
@@ -32,7 +32,6 @@ To create an agent in Mastra use the `Agent` class to define it and then registe
|
|
|
32
32
|
Create a new file `src/mastra/agents/chefAgent.ts` and define your agent:
|
|
33
33
|
|
|
34
34
|
```ts copy title="src/mastra/agents/chefAgent.ts"
|
|
35
|
-
import { openai } from "@ai-sdk/openai";
|
|
36
35
|
import { Agent } from "@mastra/core/agent";
|
|
37
36
|
|
|
38
37
|
export const chefAgent = new Agent({
|
|
@@ -41,7 +40,7 @@ export const chefAgent = new Agent({
|
|
|
41
40
|
instructions:
|
|
42
41
|
"You are Michel, a practical and experienced home chef" +
|
|
43
42
|
"You help people cook with whatever ingredients they have available.",
|
|
44
|
-
model: openai
|
|
43
|
+
model: "openai/gpt-5.1",
|
|
45
44
|
});
|
|
46
45
|
```
|
|
47
46
|
|
|
@@ -18,7 +18,7 @@ In this guide, you'll learn how to build a complete MCP (Model Context Protocol)
|
|
|
18
18
|
|
|
19
19
|
- Node.js `v22.13.0` or later installed
|
|
20
20
|
- An API key from a supported [Model Provider](/models/v1)
|
|
21
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
21
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
22
22
|
|
|
23
23
|
## Adding necessary dependencies & files
|
|
24
24
|
|
|
@@ -38,7 +38,7 @@ npm install @mastra/mcp@beta
|
|
|
38
38
|
|
|
39
39
|
<StepItem>
|
|
40
40
|
|
|
41
|
-
After following the default [installation guide](/guides/v1/
|
|
41
|
+
After following the default [installation guide](/guides/v1/getting-started/quickstart) your project will include files that are not relevant for this guide. You can safely remove them:
|
|
42
42
|
|
|
43
43
|
```bash copy
|
|
44
44
|
rm -rf src/mastra/agents src/mastra/workflows src/mastra/tools/weather-tool.ts
|
|
@@ -16,7 +16,7 @@ You'll use the foundational Transformer paper ["Attention Is All You Need"](http
|
|
|
16
16
|
|
|
17
17
|
- Node.js `v22.13.0` or later installed
|
|
18
18
|
- An API key from a supported [Model Provider](/models/v1)
|
|
19
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
19
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
20
20
|
|
|
21
21
|
## How RAG works
|
|
22
22
|
|
|
@@ -57,7 +57,7 @@ Let's define the agent's behavior, connect it to your Mastra project, and create
|
|
|
57
57
|
|
|
58
58
|
Install additional dependencies
|
|
59
59
|
|
|
60
|
-
After running the [installation guide](/guides/v1/
|
|
60
|
+
After running the [installation guide](/guides/v1/getting-started/quickstart) you'll need to install additional dependencies:
|
|
61
61
|
|
|
62
62
|
```bash copy
|
|
63
63
|
npm install @mastra/rag@beta ai@^4.0.0
|
|
@@ -76,14 +76,14 @@ Create a new file `src/mastra/agents/researchAgent.ts` and define your agent:
|
|
|
76
76
|
|
|
77
77
|
```ts copy title="src/mastra/agents/researchAgent.ts"
|
|
78
78
|
import { Agent } from "@mastra/core/agent";
|
|
79
|
-
import {
|
|
79
|
+
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
80
80
|
import { createVectorQueryTool } from "@mastra/rag";
|
|
81
81
|
|
|
82
82
|
// Create a tool for semantic search over the paper embeddings
|
|
83
83
|
const vectorQueryTool = createVectorQueryTool({
|
|
84
84
|
vectorStoreName: "libSqlVector",
|
|
85
85
|
indexName: "papers",
|
|
86
|
-
model:
|
|
86
|
+
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
export const researchAgent = new Agent({
|
|
@@ -94,7 +94,7 @@ export const researchAgent = new Agent({
|
|
|
94
94
|
and provide accurate, well-supported answers based on the retrieved content.
|
|
95
95
|
Focus on the specific content available in the tool and acknowledge if you cannot find sufficient information to answer a question.
|
|
96
96
|
Base your responses only on the content provided, not on general knowledge.`,
|
|
97
|
-
model: openai
|
|
97
|
+
model: "openai/gpt-5.1",
|
|
98
98
|
tools: {
|
|
99
99
|
vectorQueryTool,
|
|
100
100
|
},
|
|
@@ -229,9 +229,8 @@ This allows the agent to efficiently search and retrieve relevant information.
|
|
|
229
229
|
|
|
230
230
|
Open the `src/store.ts` file and add the following:
|
|
231
231
|
|
|
232
|
-
```ts copy title="src/store.ts"
|
|
232
|
+
```ts copy title="src/store.ts"
|
|
233
233
|
import { MDocument } from "@mastra/rag";
|
|
234
|
-
import { openai } from "@ai-sdk/openai";
|
|
235
234
|
import { embedMany } from "ai";
|
|
236
235
|
import { mastra } from "./mastra";
|
|
237
236
|
|
|
@@ -251,7 +250,7 @@ const chunks = await doc.chunk({
|
|
|
251
250
|
|
|
252
251
|
// Generate embeddings
|
|
253
252
|
const { embeddings } = await embedMany({
|
|
254
|
-
model:
|
|
253
|
+
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
255
254
|
values: chunks.map((chunk) => chunk.text),
|
|
256
255
|
});
|
|
257
256
|
|
|
@@ -17,7 +17,7 @@ In this guide, you're going to create a simple agent that fetches the last day's
|
|
|
17
17
|
|
|
18
18
|
- Node.js `v22.13.0` or later installed
|
|
19
19
|
- An API key from a supported [Model Provider](/models/v1)
|
|
20
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
20
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
21
21
|
|
|
22
22
|
## Creating the Agent
|
|
23
23
|
|
|
@@ -30,7 +30,6 @@ To create an agent in Mastra use the `Agent` class to define it and then registe
|
|
|
30
30
|
Create a new file `src/mastra/agents/stockAgent.ts` and define your agent:
|
|
31
31
|
|
|
32
32
|
```ts copy title="src/mastra/agents/stockAgent.ts"
|
|
33
|
-
import { openai } from "@ai-sdk/openai";
|
|
34
33
|
import { Agent } from "@mastra/core/agent";
|
|
35
34
|
|
|
36
35
|
export const stockAgent = new Agent({
|
|
@@ -38,7 +37,7 @@ export const stockAgent = new Agent({
|
|
|
38
37
|
name: "Stock Agent",
|
|
39
38
|
instructions:
|
|
40
39
|
"You are a helpful assistant that provides current stock prices. When asked about a stock, use the stock price tool to fetch the stock price.",
|
|
41
|
-
model: openai
|
|
40
|
+
model: "openai/gpt-5.1",
|
|
42
41
|
});
|
|
43
42
|
```
|
|
44
43
|
|
|
@@ -104,8 +103,7 @@ export const stockPrices = createTool({
|
|
|
104
103
|
|
|
105
104
|
Inside `src/mastra/agents/stockAgent.ts` import your newly created `stockPrices` tool and add it to the agent.
|
|
106
105
|
|
|
107
|
-
```ts copy title="src/mastra/agents/stockAgent.ts" {
|
|
108
|
-
import { openai } from "@ai-sdk/openai";
|
|
106
|
+
```ts copy title="src/mastra/agents/stockAgent.ts" {9-11}
|
|
109
107
|
import { Agent } from "@mastra/core/agent";
|
|
110
108
|
import { stockPrices } from "../tools/stockPrices";
|
|
111
109
|
|
|
@@ -114,7 +112,7 @@ export const stockAgent = new Agent({
|
|
|
114
112
|
name: "Stock Agent",
|
|
115
113
|
instructions:
|
|
116
114
|
"You are a helpful assistant that provides current stock prices. When asked about a stock, use the stock price tool to fetch the stock price.",
|
|
117
|
-
model: openai
|
|
115
|
+
model: "openai/gpt-5.1",
|
|
118
116
|
tools: {
|
|
119
117
|
stockPrices,
|
|
120
118
|
},
|
|
@@ -19,7 +19,7 @@ When building a web search agent, you have two main strategies to consider:
|
|
|
19
19
|
|
|
20
20
|
- Node.js `v22.13.0` or later installed
|
|
21
21
|
- An API key from a supported [Model Provider](/models/v1)
|
|
22
|
-
- An existing Mastra project (Follow the [installation guide](/guides/v1/
|
|
22
|
+
- An existing Mastra project (Follow the [installation guide](/guides/v1/getting-started/quickstart) to set up a new project)
|
|
23
23
|
|
|
24
24
|
## Using native search tools
|
|
25
25
|
|
|
@@ -61,7 +61,7 @@ Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
|
61
61
|
name: "Search Agent",
|
|
62
62
|
instructions:
|
|
63
63
|
"You are a search agent that can search the web for information.",
|
|
64
|
-
model:
|
|
64
|
+
model: "openai/gpt-5.1",
|
|
65
65
|
});
|
|
66
66
|
```
|
|
67
67
|
|
|
@@ -76,7 +76,7 @@ Create a new file `src/mastra/agents/searchAgent.ts` and define your agent:
|
|
|
76
76
|
name: "Search Agent",
|
|
77
77
|
instructions:
|
|
78
78
|
"You are a search agent that can search the web for information.",
|
|
79
|
-
model:
|
|
79
|
+
model: "google/gemini-2.5-flash",
|
|
80
80
|
});
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ Setup the tool:
|
|
|
93
93
|
<Tabs>
|
|
94
94
|
<TabItem value="openai" label="Open AI">
|
|
95
95
|
|
|
96
|
-
```ts copy title="src/mastra/agents/searchAgent.ts" {9-
|
|
96
|
+
```ts copy title="src/mastra/agents/searchAgent.ts" {9-12}
|
|
97
97
|
import { openai } from "@ai-sdk/openai";
|
|
98
98
|
import { Agent } from "@mastra/core/agent";
|
|
99
99
|
|
|
@@ -102,7 +102,7 @@ Setup the tool:
|
|
|
102
102
|
name: "Search Agent",
|
|
103
103
|
instructions:
|
|
104
104
|
"You are a search agent that can search the web for information.",
|
|
105
|
-
model:
|
|
105
|
+
model: "openai/gpt-5.1",
|
|
106
106
|
tools: {
|
|
107
107
|
webSearch: openai.tools.webSearch()
|
|
108
108
|
}
|
|
@@ -112,7 +112,7 @@ Setup the tool:
|
|
|
112
112
|
</TabItem>
|
|
113
113
|
<TabItem value="gemini" label="Gemini">
|
|
114
114
|
|
|
115
|
-
```ts copy title="src/mastra/agents/searchAgent.ts" {9-
|
|
115
|
+
```ts copy title="src/mastra/agents/searchAgent.ts" {9-14}
|
|
116
116
|
import { google } from "@ai-sdk/google";
|
|
117
117
|
import { Agent } from "@mastra/core/agent";
|
|
118
118
|
|
|
@@ -121,9 +121,11 @@ Setup the tool:
|
|
|
121
121
|
name: "Search Agent",
|
|
122
122
|
instructions:
|
|
123
123
|
"You are a search agent that can search the web for information.",
|
|
124
|
-
model:
|
|
124
|
+
model: "google/gemini-2.5-flash",
|
|
125
125
|
tools: {
|
|
126
|
-
|
|
126
|
+
webSearch: google.tools.googleSearch({
|
|
127
|
+
mode: "MODE_DYNAMIC"
|
|
128
|
+
})
|
|
127
129
|
}
|
|
128
130
|
});
|
|
129
131
|
```
|
|
@@ -191,7 +193,7 @@ export const searchAgent = new Agent({
|
|
|
191
193
|
name: "Search Agent",
|
|
192
194
|
instructions:
|
|
193
195
|
"You are a search agent that can search the web for information.",
|
|
194
|
-
model: "openai/gpt-
|
|
196
|
+
model: "openai/gpt-5.1",
|
|
195
197
|
});
|
|
196
198
|
```
|
|
197
199
|
|
|
@@ -252,7 +254,7 @@ export const searchAgent = new Agent({
|
|
|
252
254
|
name: "Search Agent",
|
|
253
255
|
instructions:
|
|
254
256
|
"You are a search agent that can search the web for information.",
|
|
255
|
-
model: "openai/gpt-
|
|
257
|
+
model: "openai/gpt-5.1",
|
|
256
258
|
tools: {
|
|
257
259
|
webSearch,
|
|
258
260
|
},
|
|
@@ -40,7 +40,7 @@ const agent = new AgentNetwork({
|
|
|
40
40
|
name: "agent-network",
|
|
41
41
|
agents: [agent1, agent2],
|
|
42
42
|
tools: { tool1, tool2 },
|
|
43
|
-
model: openai
|
|
43
|
+
model: "openai/gpt-5.1",
|
|
44
44
|
instructions:
|
|
45
45
|
"You are a network agent that can help users with a variety of tasks.",
|
|
46
46
|
});
|
|
@@ -61,7 +61,7 @@ const agent = new Agent({
|
|
|
61
61
|
name: "agent-network",
|
|
62
62
|
agents: { agent1, agent2 },
|
|
63
63
|
tools: { tool1, tool2 },
|
|
64
|
-
model: openai
|
|
64
|
+
model: "openai/gpt-5.1",
|
|
65
65
|
instructions:
|
|
66
66
|
"You are a network agent that can help users with a variety of tasks.",
|
|
67
67
|
memory,
|
|
@@ -83,7 +83,7 @@ const agent = new NewAgentNetwork({
|
|
|
83
83
|
agents: { agent1, agent2 },
|
|
84
84
|
workflows: { workflow1 },
|
|
85
85
|
tools: { tool1, tool2 },
|
|
86
|
-
model: openai
|
|
86
|
+
model: "openai/gpt-5.1",
|
|
87
87
|
instructions:
|
|
88
88
|
"You are a network agent that can help users with a variety of tasks.",
|
|
89
89
|
});
|
|
@@ -104,7 +104,7 @@ const agent = new Agent({
|
|
|
104
104
|
agents: { agent1, agent2 },
|
|
105
105
|
workflows: { workflow1 },
|
|
106
106
|
tools: { tool1, tool2 },
|
|
107
|
-
model: openai
|
|
107
|
+
model: "openai/gpt-5.1",
|
|
108
108
|
instructions:
|
|
109
109
|
"You are a network agent that can help users with a variety of tasks.",
|
|
110
110
|
memory,
|
|
@@ -5,7 +5,7 @@ description: "Mastra-specific guidance for upgrading from AI SDK v4 to v5."
|
|
|
5
5
|
|
|
6
6
|
# Migrate from AI SDK v4 to v5
|
|
7
7
|
|
|
8
|
-
Looking for integration docs? See [Using AI SDK](/
|
|
8
|
+
Looking for integration docs? See [Using AI SDK](/guides/v1/build-your-ui/ai-sdk-ui).
|
|
9
9
|
|
|
10
10
|
Follow the official [AI SDK v5 Migration Guide](https://v5.ai-sdk.dev/docs/migration-guides/migration-guide-5-0) for all AI SDK core breaking changes, package updates, and API changes.
|
|
11
11
|
|
|
@@ -202,6 +202,35 @@ To migrate, update from `output` or `experimental_output` to `structuredOutput.s
|
|
|
202
202
|
});
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
+
### Agent `id` field is now required
|
|
206
|
+
|
|
207
|
+
The `id` field is now required when creating an Agent. Previously, agents could be created without an explicit ID, but this is no longer supported.
|
|
208
|
+
|
|
209
|
+
To migrate, add an `id` field to all Agent configurations.
|
|
210
|
+
|
|
211
|
+
```diff
|
|
212
|
+
const agent = new Agent({
|
|
213
|
+
+ id: 'my-agent',
|
|
214
|
+
name: 'My Agent',
|
|
215
|
+
instructions: 'You are a helpful assistant',
|
|
216
|
+
model: openai('gpt-4'),
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The `id` can be the same as the `name`, or you can use a different identifier. The ID will be used when calling `mastra.getAgentById()` and must be unique within your Mastra instance.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// Register agent with Mastra
|
|
224
|
+
const mastra = new Mastra({
|
|
225
|
+
agents: {
|
|
226
|
+
myAgent: agent, // key can differ from id
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Retrieve by ID
|
|
231
|
+
const agent = mastra.getAgentById('my-agent');
|
|
232
|
+
```
|
|
233
|
+
|
|
205
234
|
## Removed
|
|
206
235
|
|
|
207
236
|
### `generateVNext` and `streamVNext` methods
|
|
@@ -83,6 +83,11 @@ For tools that are executed inside a workflow, access workflow-specific properti
|
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
The `suspendPayload` gets validated against the `suspendSchema` when the tool is executed. If the suspendPayload doesn't match the `suspendSchema`, a warning is logged and the error is returned as tool output, but suspension continues.
|
|
87
|
+
Also, when the tool is resumed, the `resumeData` gets validated against the `resumeSchema`. If the resumeData doesn't match the `resumeSchema`, the tool will return a `ValidationError`, preventing the tool resumption.
|
|
88
|
+
|
|
89
|
+
To skip the `suspendSchema` or `resumeSchema` validation, do not define `suspendSchema` or `resumeSchema` in the tool creation.
|
|
90
|
+
|
|
86
91
|
:::note
|
|
87
92
|
For MCP-specific tool context changes, see the [MCP migration guide](/guides/v1/migrations/upgrade-to-v1/mcp).
|
|
88
93
|
:::
|
|
@@ -136,6 +136,28 @@ createWorkflow({
|
|
|
136
136
|
})
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
### Step `suspendPayload` validation
|
|
140
|
+
|
|
141
|
+
Step `suspendPayload` is now validated for steps that have a `suspendSchema` defined. This also uses the `validateInputs` flag to determine whether to validate the `suspendPayload` or not.
|
|
142
|
+
|
|
143
|
+
```diff
|
|
144
|
+
createStep({
|
|
145
|
+
id: "suspend-resume-step",
|
|
146
|
+
// ... other step properties
|
|
147
|
+
suspendSchema: z.object({
|
|
148
|
+
reason: z.string(),
|
|
149
|
+
otherReason: z.string()
|
|
150
|
+
}),
|
|
151
|
+
execute: async ({ suspend, resumeData}) => {
|
|
152
|
+
if (!resumeData) {
|
|
153
|
+
- return suspend({ reason: "Suspension reason" }); // Missing otherReason
|
|
154
|
+
+ return suspend({ reason: "Suspension reason", otherReason: "Other reason" });
|
|
155
|
+
}
|
|
156
|
+
//... continue execution logic
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
139
161
|
## Removed
|
|
140
162
|
|
|
141
163
|
### Legacy workflows export
|
|
@@ -160,7 +160,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
160
160
|
name: z.string(),
|
|
161
161
|
age: z.number(),
|
|
162
162
|
}),
|
|
163
|
-
model: "openai/gpt-
|
|
163
|
+
model: "openai/gpt-5.1", // Optional model override for structuring
|
|
164
164
|
errorStrategy: "fallback",
|
|
165
165
|
fallbackValue: { name: "unknown", age: 0 },
|
|
166
166
|
instructions: "Extract user information", // Override default structuring instructions
|
|
@@ -300,7 +300,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
300
300
|
schema: z.object({
|
|
301
301
|
summary: z.string(),
|
|
302
302
|
}),
|
|
303
|
-
model: "openai/gpt-
|
|
303
|
+
model: "openai/gpt-5.1",
|
|
304
304
|
},
|
|
305
305
|
});
|
|
306
306
|
```
|
package/.docs/raw/index.mdx
CHANGED
|
@@ -51,8 +51,8 @@ Explore real-world examples in our [community showcase](/showcase).
|
|
|
51
51
|
|
|
52
52
|
## Get started
|
|
53
53
|
|
|
54
|
-
Choose a [
|
|
54
|
+
Choose a [getting started guide](/docs/v1/getting-started/start) to get started, or see the [manual installation guide](/guides/v1/getting-started/manual-install) if you need more control over your setup.
|
|
55
55
|
|
|
56
|
-
If you're new to AI agents, check out our [templates](/
|
|
56
|
+
If you're new to AI agents, check out our [templates](https://mastra.ai/templates), [course](https://mastra.ai/course), and [YouTube videos](https://youtube.com/@mastra-ai). You can also join our [Discord](https://discord.gg/BTYqqHKUrf) community to get help and share your projects.
|
|
57
57
|
|
|
58
58
|
We can't wait to see what you build ✌️
|
|
@@ -54,8 +54,7 @@ export const testMcpClient = new MCPClient({
|
|
|
54
54
|
|
|
55
55
|
To use tools from an MCP server in an agent, import your `MCPClient` and call `.getTools()` in the `tools` parameter. This loads from the defined MCP servers, making them available to the agent.
|
|
56
56
|
|
|
57
|
-
```typescript {
|
|
58
|
-
import { openai } from "@ai-sdk/openai";
|
|
57
|
+
```typescript {3,15} title="src/mastra/agents/test-agent.ts" showLineNumbers copy
|
|
59
58
|
import { Agent } from "@mastra/core/agent";
|
|
60
59
|
|
|
61
60
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
@@ -69,7 +68,7 @@ export const testAgent = new Agent({
|
|
|
69
68
|
- US National Weather Service
|
|
70
69
|
|
|
71
70
|
Answer questions using the information you find using the MCP Servers.`,
|
|
72
|
-
model: openai
|
|
71
|
+
model: "openai/gpt-5.1",
|
|
73
72
|
tools: await testMcpClient.getTools(),
|
|
74
73
|
});
|
|
75
74
|
```
|
|
@@ -131,8 +130,7 @@ Use the `.getTools()` method to fetch tools from all configured MCP servers. Thi
|
|
|
131
130
|
|
|
132
131
|
> See [getTools()](/reference/v1/tools/mcp-client#gettools) for more information.
|
|
133
132
|
|
|
134
|
-
```typescript {
|
|
135
|
-
import { openai } from "@ai-sdk/openai";
|
|
133
|
+
```typescript {7} title="src/mastra/agents/test-agent.ts" showLineNumbers copy
|
|
136
134
|
import { Agent } from "@mastra/core/agent";
|
|
137
135
|
|
|
138
136
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
@@ -21,12 +21,11 @@ This processor is used to prevent errors caused by exceeding the LLM's context w
|
|
|
21
21
|
import { Memory } from "@mastra/memory";
|
|
22
22
|
import { TokenLimiter } from "@mastra/memory/processors";
|
|
23
23
|
import { Agent } from "@mastra/core/agent";
|
|
24
|
-
import { openai } from "@ai-sdk/openai";
|
|
25
24
|
|
|
26
25
|
const agent = new Agent({
|
|
27
26
|
id: "test-agent",
|
|
28
27
|
name: "Test Agent",
|
|
29
|
-
model: openai
|
|
28
|
+
model: "openai/gpt-5.1",
|
|
30
29
|
memory: new Memory({
|
|
31
30
|
processors: [
|
|
32
31
|
// Ensure the total tokens from memory don't exceed ~127k
|