@mastra/mcp-docs-server 0.13.11-alpha.1 → 0.13.11-alpha.2
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 +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +15 -12
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +15 -15
- package/.docs/organized/changelogs/create-mastra.md +11 -11
- package/.docs/organized/changelogs/mastra.md +24 -24
- package/.docs/organized/code-examples/a2a.md +52 -19
- package/.docs/organized/code-examples/weather-agent.md +14 -0
- package/.docs/raw/auth/jwt.mdx +3 -1
- package/.docs/raw/evals/overview.mdx +8 -0
- package/.docs/raw/getting-started/installation.mdx +45 -7
- package/.docs/raw/getting-started/mcp-docs-server.mdx +3 -3
- package/.docs/raw/memory/overview.mdx +11 -5
- package/.docs/raw/reference/agents/agent.mdx +6 -2
- package/.docs/raw/reference/agents/generate.mdx +48 -40
- package/.docs/raw/reference/agents/getAgent.mdx +10 -5
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDescription.mdx +9 -5
- package/.docs/raw/reference/agents/getInstructions.mdx +22 -17
- package/.docs/raw/reference/agents/getLLM.mdx +23 -18
- package/.docs/raw/reference/agents/getMemory.mdx +22 -17
- package/.docs/raw/reference/agents/getModel.mdx +22 -17
- package/.docs/raw/reference/agents/getScorers.mdx +22 -17
- package/.docs/raw/reference/agents/getTools.mdx +22 -17
- package/.docs/raw/reference/agents/getVoice.mdx +22 -17
- package/.docs/raw/reference/agents/getWorkflows.mdx +22 -17
- package/.docs/raw/reference/agents/stream.mdx +24 -19
- package/.docs/raw/reference/agents/streamVNext.mdx +18 -19
- package/.docs/raw/reference/storage/upstash.mdx +5 -0
- package/.docs/raw/reference/tools/create-tool.mdx +22 -29
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +2 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +3 -3
- package/.docs/raw/reference/workflows/branch.mdx +6 -6
- package/.docs/raw/reference/workflows/commit.mdx +5 -5
- package/.docs/raw/reference/workflows/create-run.mdx +28 -29
- package/.docs/raw/reference/workflows/dountil.mdx +5 -5
- package/.docs/raw/reference/workflows/dowhile.mdx +5 -5
- package/.docs/raw/reference/workflows/execute.mdx +83 -91
- package/.docs/raw/reference/workflows/foreach.mdx +5 -5
- package/.docs/raw/reference/workflows/map.mdx +8 -93
- package/.docs/raw/reference/workflows/parallel.mdx +5 -5
- package/.docs/raw/reference/workflows/resume.mdx +45 -47
- package/.docs/raw/reference/workflows/sendEvent.mdx +5 -5
- package/.docs/raw/reference/workflows/sleep.mdx +5 -5
- package/.docs/raw/reference/workflows/sleepUntil.mdx +16 -8
- package/.docs/raw/reference/workflows/start.mdx +42 -27
- package/.docs/raw/reference/workflows/step.mdx +15 -29
- package/.docs/raw/reference/workflows/stream.mdx +55 -205
- package/.docs/raw/reference/workflows/streamVNext.mdx +55 -174
- package/.docs/raw/reference/workflows/then.mdx +5 -5
- package/.docs/raw/reference/workflows/waitForEvent.mdx +5 -5
- package/.docs/raw/reference/workflows/watch.mdx +31 -13
- package/.docs/raw/reference/workflows/workflow.mdx +27 -100
- package/.docs/raw/scorers/overview.mdx +8 -0
- package/.docs/raw/server-db/local-dev-playground.mdx +16 -1
- package/dist/tools/__tests__/test-setup.d.ts +1 -1
- package/dist/tools/__tests__/test-setup.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.10.21-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 77b6cfe: Use just modelId for gpt-5 check
|
|
8
|
+
- 96169cc: Create handler that returns providers user has keys for in their env
|
|
9
|
+
- 33da97c: Set temperature to 1 for gpt-5 model in playground
|
|
10
|
+
- c6d2603: Properly set baseUrl in playground when user sets the host or port in Mastra instance.
|
|
11
|
+
- ce04175: Add update agent model handler
|
|
12
|
+
- Updated dependencies [d5330bf]
|
|
13
|
+
- Updated dependencies [aaf0224]
|
|
14
|
+
- Updated dependencies [42cb4e9]
|
|
15
|
+
- Updated dependencies [a239d41]
|
|
16
|
+
- Updated dependencies [96169cc]
|
|
17
|
+
- Updated dependencies [b32c50d]
|
|
18
|
+
- Updated dependencies [c6d2603]
|
|
19
|
+
- Updated dependencies [121a3f8]
|
|
20
|
+
- Updated dependencies [ce04175]
|
|
21
|
+
- Updated dependencies [ec510e7]
|
|
22
|
+
- @mastra/core@0.13.2-alpha.2
|
|
23
|
+
- @mastra/deployer@0.13.2-alpha.2
|
|
24
|
+
- @mastra/mcp@0.10.11-alpha.0
|
|
25
|
+
|
|
3
26
|
## 0.10.21-alpha.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -275,28 +298,5 @@
|
|
|
275
298
|
- 89d2f4e: add TTS to the playground
|
|
276
299
|
- Updated dependencies [510e2c8]
|
|
277
300
|
- Updated dependencies [2f72fb2]
|
|
278
|
-
- Updated dependencies [832691b]
|
|
279
|
-
- Updated dependencies [557bb9d]
|
|
280
|
-
- Updated dependencies [3f89307]
|
|
281
|
-
- Updated dependencies [9eda7d4]
|
|
282
|
-
- Updated dependencies [9d49408]
|
|
283
|
-
- Updated dependencies [bc6b44a]
|
|
284
|
-
- Updated dependencies [2ecf658]
|
|
285
|
-
- Updated dependencies [7a7754f]
|
|
286
|
-
- Updated dependencies [fc92d80]
|
|
287
|
-
- Updated dependencies [23a6a7c]
|
|
288
|
-
- Updated dependencies [09bca64]
|
|
289
|
-
- @mastra/core@0.12.0-alpha.0
|
|
290
|
-
- @mastra/deployer@0.12.0-alpha.0
|
|
291
|
-
|
|
292
|
-
## 0.10.15
|
|
293
|
-
|
|
294
|
-
### Patch Changes
|
|
295
|
-
|
|
296
|
-
- 1a45f3a: Fix peerdeps
|
|
297
|
-
|
|
298
|
-
## 0.10.14
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 4850 more lines hidden. See full changelog in package directory.
|
|
@@ -51,47 +51,59 @@ async function main() {
|
|
|
51
51
|
console.log('\n-------------------\n');
|
|
52
52
|
|
|
53
53
|
// Step 2: Send a message to the agent
|
|
54
|
-
const
|
|
55
|
-
console.log(`📤 Sending message to agent (
|
|
54
|
+
const messageId = `message-${Date.now()}`;
|
|
55
|
+
console.log(`📤 Sending message to agent (Message ID: ${messageId})...`);
|
|
56
56
|
|
|
57
57
|
const query = 'What are the latest developments in AI agent networks?';
|
|
58
58
|
console.log(`Query: ${query}`);
|
|
59
59
|
|
|
60
60
|
const response = await a2aClient.sendMessage({
|
|
61
|
-
id: taskId,
|
|
62
61
|
message: {
|
|
63
62
|
role: 'user',
|
|
64
|
-
parts: [{
|
|
63
|
+
parts: [{ kind: 'text', text: query }],
|
|
64
|
+
kind: 'message',
|
|
65
|
+
messageId,
|
|
65
66
|
},
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
console.log(response);
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if ('error' in response) {
|
|
71
|
+
throw new Error(response.error.message);
|
|
72
|
+
} else if ('messageId' in response.result) {
|
|
73
|
+
// Mastra's current A2A implementation will always return a task, rather than a message
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.log(`\nTask Status: ${response.result.status.state}`);
|
|
71
78
|
console.log('\n🤖 Agent Response:');
|
|
72
79
|
console.log(
|
|
73
|
-
response.
|
|
74
|
-
? response.
|
|
80
|
+
response.result.status.message?.parts[0].kind === 'text'
|
|
81
|
+
? response.result.status.message?.parts[0].text
|
|
75
82
|
: 'No response content',
|
|
76
83
|
);
|
|
77
84
|
|
|
78
85
|
console.log('\n-------------------\n');
|
|
79
86
|
|
|
80
87
|
// Step 3: Get task status
|
|
88
|
+
const taskId = response.result.id;
|
|
81
89
|
console.log(`📥 Checking task status (Task ID: ${taskId})...`);
|
|
82
90
|
|
|
83
91
|
const taskStatus = await a2aClient.getTask({
|
|
84
92
|
id: taskId,
|
|
85
93
|
});
|
|
94
|
+
if ('error' in taskStatus) {
|
|
95
|
+
console.log(taskStatus);
|
|
96
|
+
throw new Error(taskStatus.error.message);
|
|
97
|
+
}
|
|
86
98
|
|
|
87
|
-
console.log(`Task Status: ${taskStatus.status}`);
|
|
99
|
+
console.log(`Task Status: ${taskStatus.result.status.state}`);
|
|
88
100
|
console.log('\n-------------------\n');
|
|
89
101
|
|
|
90
102
|
// Step 4: Demonstrate agent-to-agent communication
|
|
91
103
|
console.log('🔄 Demonstrating agent-to-agent communication...');
|
|
92
104
|
|
|
93
105
|
// Get another agent for A2A communication
|
|
94
|
-
const secondAgentId =
|
|
106
|
+
const secondAgentId = 'contentCreatorAgent';
|
|
95
107
|
console.log(`Connecting to second agent: ${secondAgentId}`);
|
|
96
108
|
|
|
97
109
|
const secondA2aClient = client.getA2A(secondAgentId);
|
|
@@ -102,16 +114,23 @@ async function main() {
|
|
|
102
114
|
|
|
103
115
|
const researchQuery = 'Provide a brief summary of agent networks in AI';
|
|
104
116
|
const researchResponse = await a2aClient.sendMessage({
|
|
105
|
-
id: researchTaskId,
|
|
106
117
|
message: {
|
|
107
118
|
role: 'user',
|
|
108
|
-
parts: [{
|
|
119
|
+
parts: [{ kind: 'text', text: researchQuery }],
|
|
120
|
+
kind: 'message',
|
|
121
|
+
messageId: researchTaskId,
|
|
109
122
|
},
|
|
110
123
|
});
|
|
124
|
+
if ('error' in researchResponse) {
|
|
125
|
+
throw new Error(researchResponse.error.message);
|
|
126
|
+
} else if ('messageId' in researchResponse.result) {
|
|
127
|
+
// Mastra's current A2A implementation will always return a task, rather than a message
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
111
130
|
|
|
112
131
|
const researchResult =
|
|
113
|
-
researchResponse.
|
|
114
|
-
? researchResponse.
|
|
132
|
+
researchResponse.result.status.message?.parts?.[0]?.kind === 'text'
|
|
133
|
+
? researchResponse.result.status.message.parts?.[0]?.text
|
|
115
134
|
: '';
|
|
116
135
|
console.log('\nResearch Results:');
|
|
117
136
|
console.log(researchResult.substring(0, 150) + '...');
|
|
@@ -122,17 +141,24 @@ async function main() {
|
|
|
122
141
|
|
|
123
142
|
const contentPrompt = `Transform this research into an engaging blog post introduction:\n\n${researchResult}`;
|
|
124
143
|
const contentResponse = await secondA2aClient.sendMessage({
|
|
125
|
-
id: contentTaskId,
|
|
126
144
|
message: {
|
|
127
145
|
role: 'user',
|
|
128
|
-
parts: [{
|
|
146
|
+
parts: [{ kind: 'text', text: contentPrompt }],
|
|
147
|
+
kind: 'message',
|
|
148
|
+
messageId: contentTaskId,
|
|
129
149
|
},
|
|
130
150
|
});
|
|
151
|
+
if ('error' in contentResponse) {
|
|
152
|
+
throw new Error(contentResponse.error.message);
|
|
153
|
+
} else if ('messageId' in contentResponse.result) {
|
|
154
|
+
// Mastra's current A2A implementation will always return a task, rather than a message
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
131
157
|
|
|
132
158
|
console.log('\nFinal Content:');
|
|
133
159
|
console.log(
|
|
134
|
-
contentResponse.
|
|
135
|
-
? contentResponse.
|
|
160
|
+
contentResponse.result.status.message?.parts[0]?.kind === 'text'
|
|
161
|
+
? contentResponse.result.status.message.parts[0].text
|
|
136
162
|
: 'No content generated',
|
|
137
163
|
);
|
|
138
164
|
|
|
@@ -159,16 +185,23 @@ export const myAgent = new Agent({
|
|
|
159
185
|
model: openai('gpt-4o'),
|
|
160
186
|
});
|
|
161
187
|
|
|
188
|
+
export const contentCreatorAgent = new Agent({
|
|
189
|
+
name: 'contentCreatorAgent',
|
|
190
|
+
instructions: 'Create engaging content',
|
|
191
|
+
model: openai('gpt-4o'),
|
|
192
|
+
});
|
|
193
|
+
|
|
162
194
|
```
|
|
163
195
|
|
|
164
196
|
### mastra/index.ts
|
|
165
197
|
```typescript
|
|
166
198
|
import { Mastra } from '@mastra/core/mastra';
|
|
167
|
-
import { myAgent } from './agents';
|
|
199
|
+
import { myAgent, contentCreatorAgent } from './agents';
|
|
168
200
|
|
|
169
201
|
export const mastra = new Mastra({
|
|
170
202
|
agents: {
|
|
171
203
|
myAgent,
|
|
204
|
+
contentCreatorAgent,
|
|
172
205
|
},
|
|
173
206
|
});
|
|
174
207
|
|
|
@@ -15,9 +15,21 @@
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { openai } from '@ai-sdk/openai';
|
|
17
17
|
import { Agent } from '@mastra/core/agent';
|
|
18
|
+
// import { Memory } from '@mastra/memory';
|
|
19
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
20
|
+
|
|
21
|
+
// import { OpenAIVoice } from '@mastra/voice-openai';
|
|
18
22
|
|
|
19
23
|
import { weatherTool } from '../tools';
|
|
20
24
|
|
|
25
|
+
// const voice = new OpenAIVoice();
|
|
26
|
+
|
|
27
|
+
// const memory = new Memory({
|
|
28
|
+
// storage: new LibSQLStore({
|
|
29
|
+
// url: 'file:../mastra.db', // Or your database URL
|
|
30
|
+
// }),
|
|
31
|
+
// });
|
|
32
|
+
|
|
21
33
|
export const weatherAgent = new Agent({
|
|
22
34
|
name: 'Weather Agent',
|
|
23
35
|
instructions: `You are a helpful weather assistant that provides accurate weather information.
|
|
@@ -32,6 +44,8 @@ Your primary function is to help users get weather details for specific location
|
|
|
32
44
|
Use the weatherTool to fetch current weather data.`,
|
|
33
45
|
model: openai('gpt-4o'),
|
|
34
46
|
tools: { weatherTool },
|
|
47
|
+
// memory,
|
|
48
|
+
// voice,
|
|
35
49
|
});
|
|
36
50
|
|
|
37
51
|
export const weatherReporterAgent = new Agent({
|
package/.docs/raw/auth/jwt.mdx
CHANGED
|
@@ -11,8 +11,10 @@ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Ma
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
+
Before you can use the `MastraJwtAuth` class you have to install the `@mastra/auth` package.
|
|
15
|
+
|
|
14
16
|
```bash copy
|
|
15
|
-
npm install @mastra/auth
|
|
17
|
+
npm install @mastra/auth@latest
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## Usage example
|
|
@@ -23,6 +23,14 @@ There are different kinds of evals, each serving a specific purpose. Here are so
|
|
|
23
23
|
2. **Classification Evals**: Measure accuracy in categorizing data based on predefined categories
|
|
24
24
|
3. **Prompt Engineering Evals**: Explore impact of different instructions and input formats
|
|
25
25
|
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
To access Mastra's evals feature install the `@mastra/evals` package.
|
|
29
|
+
|
|
30
|
+
```bash copy
|
|
31
|
+
npm install @mastra/evals@latest
|
|
32
|
+
```
|
|
33
|
+
|
|
26
34
|
## Getting Started
|
|
27
35
|
|
|
28
36
|
Evals need to be added to an agent. Here's an example using the summarization, content similarity, and tone consistency metrics:
|
|
@@ -18,11 +18,15 @@ Mastra also supports other LLM providers. For a full list of supported models an
|
|
|
18
18
|
- Node.js `v20.0` or higher
|
|
19
19
|
- An API key from a supported [Model Provider](/docs/getting-started/model-providers)
|
|
20
20
|
|
|
21
|
+
## Install using the `create mastra` CLI
|
|
22
|
+
|
|
23
|
+
Our CLI is the fastest way to get started with Mastra. You can run `create mastra` anywhere on your machine.
|
|
24
|
+
|
|
21
25
|
<Steps>
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## Start the CLI wizard
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
Run the following command to start the interactive setup:
|
|
26
30
|
|
|
27
31
|
{/*
|
|
28
32
|
LLM CONTEXT: This Tabs component shows different package manager commands for creating a new Mastra project.
|
|
@@ -76,14 +80,14 @@ Start with a pre-built template that demonstrates specific use cases:
|
|
|
76
80
|
npx create-mastra@latest --template template-name
|
|
77
81
|
```
|
|
78
82
|
|
|
83
|
+
> Browse available templates and learn more in [Templates](/docs/getting-started/templates).
|
|
84
|
+
|
|
79
85
|
For example, to create a text-to-SQL application:
|
|
80
86
|
|
|
81
87
|
```bash copy
|
|
82
88
|
npx create-mastra@latest --template text-to-sql
|
|
83
89
|
```
|
|
84
90
|
|
|
85
|
-
> Browse available templates and learn more in [Templates](/docs/getting-started/templates).
|
|
86
|
-
|
|
87
91
|
> See the [create-mastra](/reference/cli/create-mastra) documentation for a full list of available CLI options.
|
|
88
92
|
|
|
89
93
|
### Add your API key
|
|
@@ -95,8 +99,45 @@ OPENAI_API_KEY=<your-api-key>
|
|
|
95
99
|
```
|
|
96
100
|
> This example uses OpenAI. Each LLM provider uses a unique name. See [Model Capabilities](/docs/getting-started/model-capability) for more information.
|
|
97
101
|
|
|
102
|
+
### Launch the Mastra Development Server
|
|
103
|
+
|
|
98
104
|
You can now launch the [Mastra Development Server](/docs/server-db/local-dev-playground) and test your agent using the Mastra Playground.
|
|
99
105
|
|
|
106
|
+
{/*
|
|
107
|
+
LLM CONTEXT: This Tabs component shows different package manager commands for starting Mastra's development server.
|
|
108
|
+
Each tab displays the equivalent command for that specific package manager (npx, npm, yarn, pnpm, bun).
|
|
109
|
+
This helps users choose their preferred package manager.
|
|
110
|
+
All commands achieve the same result - starting Mastra's development server.
|
|
111
|
+
*/}
|
|
112
|
+
|
|
113
|
+
<Tabs items={["npm", "yarn", "pnpm", "bun", "Mastra CLI"]}>
|
|
114
|
+
<Tab>
|
|
115
|
+
```bash copy
|
|
116
|
+
npm run dev
|
|
117
|
+
```
|
|
118
|
+
</Tab>
|
|
119
|
+
<Tab>
|
|
120
|
+
```bash copy
|
|
121
|
+
yarn run dev
|
|
122
|
+
```
|
|
123
|
+
</Tab>
|
|
124
|
+
<Tab>
|
|
125
|
+
```bash copy
|
|
126
|
+
pnpm run dev
|
|
127
|
+
```
|
|
128
|
+
</Tab>
|
|
129
|
+
<Tab>
|
|
130
|
+
```bash copy
|
|
131
|
+
bun run dev
|
|
132
|
+
```
|
|
133
|
+
</Tab>
|
|
134
|
+
<Tab>
|
|
135
|
+
```bash copy
|
|
136
|
+
mastra dev
|
|
137
|
+
```
|
|
138
|
+
</Tab>
|
|
139
|
+
</Tabs>
|
|
140
|
+
|
|
100
141
|
</Steps>
|
|
101
142
|
|
|
102
143
|
## Install manually
|
|
@@ -335,6 +376,3 @@ To install Mastra in an existing project, use the `mastra init` command.
|
|
|
335
376
|
|
|
336
377
|
- [Local Development](/docs/server-db/local-dev-playground)
|
|
337
378
|
- [Deploy to Mastra Cloud](/docs/deployment/overview)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/docs/server-db/local-dev-playground
|
|
@@ -63,7 +63,7 @@ The tabs help users find the correct configuration format for their IDE (Cursor,
|
|
|
63
63
|
Each tab shows the exact JSON structure and file paths needed for that IDE's MCP configuration.
|
|
64
64
|
*/}
|
|
65
65
|
|
|
66
|
-
<Tabs items={["
|
|
66
|
+
<Tabs items={["Cursor", "Windsurf", "VSCode"]}>
|
|
67
67
|
<Tabs.Tab>
|
|
68
68
|
```json
|
|
69
69
|
{
|
|
@@ -113,7 +113,7 @@ Each tab shows the Windows-specific command structure needed for that IDE's MCP
|
|
|
113
113
|
On latest Windsurf and Cursor the direct npx command works, while it's still unconfirmed if this has been fixed for VSCode.
|
|
114
114
|
*/}
|
|
115
115
|
|
|
116
|
-
<Tabs items={["
|
|
116
|
+
<Tabs items={["Cursor", "Windsurf", "VSCode"]}>
|
|
117
117
|
<Tabs.Tab>
|
|
118
118
|
```json
|
|
119
119
|
{
|
|
@@ -252,7 +252,7 @@ Track updates for Mastra and `@mastra/*` packages:
|
|
|
252
252
|
|
|
253
253
|
1. **Server Not Starting**
|
|
254
254
|
|
|
255
|
-
- Ensure npx is installed and working
|
|
255
|
+
- Ensure [npx](https://docs.npmjs.com/cli/v11/commands/npx) is installed and working
|
|
256
256
|
- Check for conflicting MCP servers
|
|
257
257
|
- Verify your configuration file syntax
|
|
258
258
|
- On Windows, make sure to use the Windows-specific configuration
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Steps } from "nextra/components";
|
|
2
|
+
|
|
1
3
|
# Memory overview
|
|
2
4
|
|
|
3
5
|
Memory is how agents manage the context that's available to them, it's a condensation of all chat messages into their context window.
|
|
@@ -18,13 +20,15 @@ The fastest way to see memory in action is using the built-in development playgr
|
|
|
18
20
|
|
|
19
21
|
If you haven't already, create a new Mastra project following the main [Getting Started guide](/docs/getting-started/installation).
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
<Steps>
|
|
24
|
+
|
|
25
|
+
### Install the memory package
|
|
22
26
|
|
|
23
27
|
```bash npm2yarn copy
|
|
24
28
|
npm install @mastra/memory@latest
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
### Create an agent and attach a `Memory` instance
|
|
28
32
|
|
|
29
33
|
```typescript filename="src/mastra/agents/index.ts" {6-18}
|
|
30
34
|
import { Agent } from "@mastra/core/agent";
|
|
@@ -47,15 +51,15 @@ export const myMemoryAgent = new Agent({
|
|
|
47
51
|
});
|
|
48
52
|
```
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
### Start the Development Server
|
|
51
55
|
|
|
52
56
|
```bash npm2yarn copy
|
|
53
57
|
npm run dev
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
### Open the playground and select your `MemoryAgent`
|
|
57
61
|
|
|
58
|
-
Send a few messages and notice that it remembers information across turns:
|
|
62
|
+
Open the playground at [http://localhost:4111](http://localhost:4111). Send a few messages and notice that it remembers information across turns:
|
|
59
63
|
|
|
60
64
|
```
|
|
61
65
|
➡️ You: My favorite color is blue.
|
|
@@ -64,6 +68,8 @@ Send a few messages and notice that it remembers information across turns:
|
|
|
64
68
|
⬅️ Agent: Your favorite color is blue.
|
|
65
69
|
```
|
|
66
70
|
|
|
71
|
+
</Steps>
|
|
72
|
+
|
|
67
73
|
## Memory Threads
|
|
68
74
|
|
|
69
75
|
Mastra organizes memory into threads, which are records that identify specific conversation histories, using two identifiers:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Agent | Agents | Mastra Docs"
|
|
2
|
+
title: "Reference: Agent Class | Agents | Mastra Docs"
|
|
3
3
|
description: "Documentation for the `Agent` class in Mastra, which provides the foundation for creating AI agents with various capabilities."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Agent
|
|
6
|
+
# Agent Class
|
|
7
7
|
|
|
8
8
|
The `Agent` class is the foundation for creating AI agents in Mastra. It provides methods for generating responses, streaming interactions, and handling voice capabilities.
|
|
9
9
|
|
|
@@ -135,3 +135,7 @@ const agent = new Agent({
|
|
|
135
135
|
]}
|
|
136
136
|
/>
|
|
137
137
|
|
|
138
|
+
## Related
|
|
139
|
+
|
|
140
|
+
- [Agents overview](../../docs/agents/overview.mdx)
|
|
141
|
+
- [Calling Agents](../../examples/agents/calling-agents.mdx)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: generate() | Agents | Mastra Docs"
|
|
3
|
-
description: "Documentation for the
|
|
2
|
+
title: "Reference: Agent.generate() | Agents | Mastra Docs"
|
|
3
|
+
description: "Documentation for the `Agent.generate()` method in Mastra agents, which produces text or structured responses."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# generate()
|
|
6
|
+
# Agent.generate()
|
|
7
7
|
|
|
8
8
|
The `.generate()` method is used to interact with an agent to produce text or structured responses. This method accepts messages and optional generation options.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
|
|
12
|
+
```typescript copy
|
|
13
|
+
await agent.generate("message for agent");
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
@@ -31,41 +31,6 @@ const response = await agent.generate("message for agent");
|
|
|
31
31
|
]}
|
|
32
32
|
/>
|
|
33
33
|
|
|
34
|
-
## Extended usage example
|
|
35
|
-
|
|
36
|
-
```typescript showLineNumbers copy
|
|
37
|
-
const response = await agent.generate([
|
|
38
|
-
{ role: "user", content: "message for agent" },
|
|
39
|
-
{
|
|
40
|
-
role: "user",
|
|
41
|
-
content: [
|
|
42
|
-
{
|
|
43
|
-
type: "text",
|
|
44
|
-
text: "message for agent"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: "image",
|
|
48
|
-
imageUrl: "https://example.com/image.jpg",
|
|
49
|
-
mimeType: "image/jpeg"
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
], {
|
|
54
|
-
temperature: 0.7,
|
|
55
|
-
maxSteps: 3,
|
|
56
|
-
memory: {
|
|
57
|
-
thread: "user-123",
|
|
58
|
-
resource: "test-app"
|
|
59
|
-
},
|
|
60
|
-
toolChoice: "auto",
|
|
61
|
-
providerOptions: {
|
|
62
|
-
openai: {
|
|
63
|
-
reasoningEffort: "high"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
34
|
### Options parameters
|
|
70
35
|
|
|
71
36
|
<PropertiesTable
|
|
@@ -407,3 +372,46 @@ const response = await agent.generate([
|
|
|
407
372
|
},
|
|
408
373
|
]}
|
|
409
374
|
/>
|
|
375
|
+
|
|
376
|
+
## Extended usage example
|
|
377
|
+
|
|
378
|
+
```typescript showLineNumbers copy
|
|
379
|
+
await agent.generate(
|
|
380
|
+
[
|
|
381
|
+
{ role: "user", content: "message for agent" },
|
|
382
|
+
{
|
|
383
|
+
role: "user",
|
|
384
|
+
content: [
|
|
385
|
+
{
|
|
386
|
+
type: "text",
|
|
387
|
+
text: "message for agent"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: "image",
|
|
391
|
+
imageUrl: "https://example.com/image.jpg",
|
|
392
|
+
mimeType: "image/jpeg"
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
{
|
|
398
|
+
temperature: 0.7,
|
|
399
|
+
maxSteps: 3,
|
|
400
|
+
memory: {
|
|
401
|
+
thread: "user-123",
|
|
402
|
+
resource: "test-app"
|
|
403
|
+
},
|
|
404
|
+
toolChoice: "auto",
|
|
405
|
+
providerOptions: {
|
|
406
|
+
openai: {
|
|
407
|
+
reasoningEffort: "high"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Related
|
|
415
|
+
|
|
416
|
+
- [Agent generation](../../docs/agents/overview.mdx#generate)
|
|
417
|
+
- [Streaming responses](../../docs/agents/streaming.mdx)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: getAgent() | Agents | Mastra Docs"
|
|
3
|
-
description: "Documentation for the
|
|
2
|
+
title: "Reference: Agent.getAgent() | Agents | Mastra Docs"
|
|
3
|
+
description: "Documentation for the `Agent.getAgent()` method in Mastra, which retrieves an agent by name."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# getAgent()
|
|
6
|
+
# Agent.getAgent()
|
|
7
7
|
|
|
8
8
|
The `.getAgent()` method is used to retrieve an agent. The method accepts a single `string` parameter for the agent's name.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
|
|
12
|
+
```typescript copy
|
|
13
|
+
mastra.getAgent("testAgent");
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
|
|
@@ -37,3 +37,8 @@ const agent = mastra.getAgent("testAgent");
|
|
|
37
37
|
},
|
|
38
38
|
]}
|
|
39
39
|
/>
|
|
40
|
+
|
|
41
|
+
## Related
|
|
42
|
+
|
|
43
|
+
- [Agents overview](../../docs/agents/overview.mdx)
|
|
44
|
+
- [Dynamic agents](../../docs/agents/dynamic-agents.mdx)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: getDefaultGenerateOptions() | Agents | Mastra Docs"
|
|
3
|
-
description: "Documentation for the
|
|
2
|
+
title: "Reference: Agent.getDefaultGenerateOptions() | Agents | Mastra Docs"
|
|
3
|
+
description: "Documentation for the `Agent.getDefaultGenerateOptions()` method in Mastra agents, which retrieves the default options used for generate calls."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# getDefaultGenerateOptions()
|
|
6
|
+
# Agent.getDefaultGenerateOptions()
|
|
7
7
|
|
|
8
8
|
The `.getDefaultGenerateOptions()` method retrieves the default generation options configured for an agent, resolving them if they're a function. These options are used as the base configuration for all `generate()` calls unless overridden.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
|
|
12
|
+
```typescript copy
|
|
13
|
+
await agent.getDefaultGenerateOptions();
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
@@ -27,10 +27,22 @@ const defaultOptions = await agent.getDefaultGenerateOptions();
|
|
|
27
27
|
]}
|
|
28
28
|
/>
|
|
29
29
|
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
<PropertiesTable
|
|
33
|
+
content={[
|
|
34
|
+
{
|
|
35
|
+
name: "defaultOptions",
|
|
36
|
+
type: "AgentGenerateOptions | Promise<AgentGenerateOptions>",
|
|
37
|
+
description: "The default generation options configured for the agent, either as a direct object or a promise that resolves to the options.",
|
|
38
|
+
},
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
41
|
+
|
|
30
42
|
## Extended usage example
|
|
31
43
|
|
|
32
|
-
```typescript
|
|
33
|
-
|
|
44
|
+
```typescript copy
|
|
45
|
+
await agent.getDefaultGenerateOptions({
|
|
34
46
|
runtimeContext: new RuntimeContext()
|
|
35
47
|
});
|
|
36
48
|
```
|
|
@@ -49,14 +61,7 @@ const defaultOptions = await agent.getDefaultGenerateOptions({
|
|
|
49
61
|
]}
|
|
50
62
|
/>
|
|
51
63
|
|
|
52
|
-
##
|
|
64
|
+
## Related
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
name: "defaultOptions",
|
|
58
|
-
type: "AgentGenerateOptions | Promise<AgentGenerateOptions>",
|
|
59
|
-
description: "The default generation options configured for the agent, either as a direct object or a promise that resolves to the options.",
|
|
60
|
-
},
|
|
61
|
-
]}
|
|
62
|
-
/>
|
|
66
|
+
- [Agent generation](../../docs/agents/overview.mdx#generate)
|
|
67
|
+
- [Runtime variables](../../docs/agents/runtime-variables.mdx)
|