@mastra/mcp-docs-server 0.13.14-alpha.1 → 0.13.14-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%2Fclickhouse.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +7 -7
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +8 -8
- package/.docs/organized/code-examples/heads-up-game.md +276 -0
- package/package.json +4 -4
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/clickhouse
|
|
2
2
|
|
|
3
|
+
## 0.13.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7020](https://github.com/mastra-ai/mastra/pull/7020) [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6) Thanks [@YujohnNattrass](https://github.com/YujohnNattrass)! - Add column to ai spans table to tell if it's an event
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
10
|
+
- @mastra/core@0.14.2-alpha.2
|
|
11
|
+
|
|
3
12
|
## 0.13.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -290,13 +299,4 @@
|
|
|
290
299
|
|
|
291
300
|
- 8a3bfd2: Update peerdeps to latest core
|
|
292
301
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
- Updated dependencies [792c4c0]
|
|
296
|
-
- Updated dependencies [502fe05]
|
|
297
|
-
- Updated dependencies [4efcfa0]
|
|
298
|
-
- @mastra/core@0.10.7-alpha.3
|
|
299
|
-
|
|
300
|
-
## 0.11.1-alpha.2
|
|
301
|
-
|
|
302
|
-
... 834 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 843 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.11.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
8
|
+
- @mastra/core@0.14.2-alpha.2
|
|
9
|
+
|
|
3
10
|
## 0.11.0-alpha.1
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -291,12 +298,5 @@
|
|
|
291
298
|
|
|
292
299
|
## 0.10.18
|
|
293
300
|
|
|
294
|
-
### Patch Changes
|
|
295
|
-
|
|
296
|
-
- 6690a16: dependencies updates:
|
|
297
|
-
- Updated dependency [`@ag-ui/client@^0.0.35` ↗︎](https://www.npmjs.com/package/@ag-ui/client/v/0.0.35) (from `^0.0.27`, in `dependencies`)
|
|
298
|
-
- Updated dependencies [33dcb07]
|
|
299
|
-
- Updated dependencies [d0d9500]
|
|
300
|
-
- Updated dependencies [d30b1a0]
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 2148 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 0.14.2-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7020](https://github.com/mastra-ai/mastra/pull/7020) [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6) Thanks [@YujohnNattrass](https://github.com/YujohnNattrass)! - Add column to ai spans table to tell if it's an event
|
|
8
|
+
|
|
3
9
|
## 0.14.2-alpha.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -292,11 +298,5 @@
|
|
|
292
298
|
|
|
293
299
|
### Minor Changes
|
|
294
300
|
|
|
295
|
-
- ea0c5f2: Update scorer api
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- b0e43c1: Fixed an issue where branching workflow steps maintained "suspended" status even after they've been successfully resumed and executed.
|
|
300
|
-
- 1fb812e: Fixed a bug in parallel workflow execution where resuming only one of multiple suspended parallel steps incorrectly completed the entire parallel block. The fix ensures proper execution and state management when resuming from suspension in parallel workflows.
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 2734 more lines hidden. See full changelog in package directory.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @mastra/deployer-cloud
|
|
2
|
+
|
|
3
|
+
## 0.14.2-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6866](https://github.com/mastra-ai/mastra/pull/6866) [`3562fd1`](https://github.com/mastra-ai/mastra/commit/3562fd14b782dc7ed00f4f03df8fbb5fe6e5ff4b) Thanks [@rphansen91](https://github.com/rphansen91)! - @mastra/deployer-cloud
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2a96802`](https://github.com/mastra-ai/mastra/commit/2a96802f76790ebb86a1bcb254398dccf27e5479), [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
10
|
+
- @mastra/deployer@0.14.2-alpha.2
|
|
11
|
+
- @mastra/core@0.14.2-alpha.2
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @mastra/deployer-cloudflare
|
|
2
2
|
|
|
3
|
+
## 0.12.3-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7017](https://github.com/mastra-ai/mastra/pull/7017) [`2a96802`](https://github.com/mastra-ai/mastra/commit/2a96802f76790ebb86a1bcb254398dccf27e5479) Thanks [@TheIsrael1](https://github.com/TheIsrael1)! - Fix cloudflare deployer - disable esmShim for cloudflare
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2a96802`](https://github.com/mastra-ai/mastra/commit/2a96802f76790ebb86a1bcb254398dccf27e5479), [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
10
|
+
- @mastra/deployer@0.14.2-alpha.2
|
|
11
|
+
- @mastra/core@0.14.2-alpha.2
|
|
12
|
+
|
|
3
13
|
## 0.12.3-alpha.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -288,15 +298,5 @@
|
|
|
288
298
|
- Updated dependencies [510e2c8]
|
|
289
299
|
- Updated dependencies [2f72fb2]
|
|
290
300
|
- Updated dependencies [27cc97a]
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
- Updated dependencies [27cc97a]
|
|
294
|
-
- Updated dependencies [3f89307]
|
|
295
|
-
- Updated dependencies [9eda7d4]
|
|
296
|
-
- Updated dependencies [9d49408]
|
|
297
|
-
- Updated dependencies [bc6b44a]
|
|
298
|
-
- Updated dependencies [41daa63]
|
|
299
|
-
- Updated dependencies [ad0a58b]
|
|
300
|
-
- Updated dependencies [254a36b]
|
|
301
|
-
|
|
302
|
-
... 3288 more lines hidden. See full changelog in package directory.
|
|
301
|
+
|
|
302
|
+
... 3298 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 0.14.2-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7017](https://github.com/mastra-ai/mastra/pull/7017) [`2a96802`](https://github.com/mastra-ai/mastra/commit/2a96802f76790ebb86a1bcb254398dccf27e5479) Thanks [@TheIsrael1](https://github.com/TheIsrael1)! - Fix cloudflare deployer - disable esmShim for cloudflare
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
10
|
+
- @mastra/core@0.14.2-alpha.2
|
|
11
|
+
- @mastra/server@0.14.2-alpha.2
|
|
12
|
+
|
|
3
13
|
## 0.14.2-alpha.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -288,15 +298,5 @@
|
|
|
288
298
|
|
|
289
299
|
## 0.13.1
|
|
290
300
|
|
|
291
|
-
### Patch Changes
|
|
292
|
-
|
|
293
|
-
- Updated dependencies [cd0042e]
|
|
294
|
-
- @mastra/core@0.13.1
|
|
295
|
-
- @mastra/server@0.13.1
|
|
296
|
-
|
|
297
|
-
## 0.13.1-alpha.0
|
|
298
|
-
|
|
299
|
-
### Patch Changes
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 3592 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 0.13.14-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
8
|
+
- @mastra/core@0.14.2-alpha.2
|
|
9
|
+
|
|
3
10
|
## 0.13.14-alpha.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -291,12 +298,5 @@
|
|
|
291
298
|
- Updated dependencies [d30b1a0]
|
|
292
299
|
- Updated dependencies [bff87f7]
|
|
293
300
|
- Updated dependencies [b4a8df0]
|
|
294
|
-
- @mastra/core@0.12.1
|
|
295
|
-
- @mastra/mcp@0.10.9
|
|
296
|
-
|
|
297
|
-
## 0.13.8-alpha.1
|
|
298
|
-
|
|
299
|
-
### Patch Changes
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1415 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 0.14.2-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6)]:
|
|
8
|
+
- @mastra/core@0.14.2-alpha.2
|
|
9
|
+
|
|
3
10
|
## 0.14.2-alpha.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -292,11 +299,4 @@
|
|
|
292
299
|
|
|
293
300
|
### Patch Changes
|
|
294
301
|
|
|
295
|
-
|
|
296
|
-
- Updated dependencies [94f4812]
|
|
297
|
-
- Updated dependencies [e202b82]
|
|
298
|
-
- Updated dependencies [e00f6a0]
|
|
299
|
-
- @mastra/core@0.12.2-alpha.0
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
... 2946 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 2953 more lines hidden. See full changelog in package directory.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
### package.json
|
|
2
|
+
```json
|
|
3
|
+
{
|
|
4
|
+
"name": "example-headsup",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20.9.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@ai-sdk/openai": "^1.3.23",
|
|
10
|
+
"@mastra/core": "^0.14.1",
|
|
11
|
+
"@mastra/libsql": "^0.13.4",
|
|
12
|
+
"@mastra/loggers": "^0.10.7",
|
|
13
|
+
"@mastra/memory": "^0.13.1",
|
|
14
|
+
"zod": "^3.25.76"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^24.3.0",
|
|
18
|
+
"mastra": "^0.10.23",
|
|
19
|
+
"typescript": "^5.9.2"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### mastra/agents/example-famous-person-agent.ts
|
|
25
|
+
```typescript
|
|
26
|
+
import { openai } from '@ai-sdk/openai';
|
|
27
|
+
import { Agent } from '@mastra/core/agent';
|
|
28
|
+
import { Memory } from '@mastra/memory';
|
|
29
|
+
import { LibSQLVector } from '@mastra/libsql';
|
|
30
|
+
|
|
31
|
+
export const famousPersonAgent = new Agent({
|
|
32
|
+
name: 'Famous Person Generator',
|
|
33
|
+
instructions: `You are a famous person generator for a "Heads Up" guessing game.
|
|
34
|
+
|
|
35
|
+
Generate the name of a well-known famous person who:
|
|
36
|
+
- Is recognizable to most people
|
|
37
|
+
- Has distinctive characteristics that can be described with yes/no questions
|
|
38
|
+
- Is appropriate for all audiences
|
|
39
|
+
- Has a clear, unambiguous name
|
|
40
|
+
|
|
41
|
+
IMPORTANT: Use your memory to check what famous people you've already suggested and NEVER repeat a person you've already suggested.
|
|
42
|
+
|
|
43
|
+
Examples: Albert Einstein, Beyoncé, Leonardo da Vinci, Oprah Winfrey, Michael Jordan
|
|
44
|
+
|
|
45
|
+
Return only the person's name, nothing else.`,
|
|
46
|
+
model: openai('gpt-4o'),
|
|
47
|
+
memory: new Memory({
|
|
48
|
+
vector: new LibSQLVector({
|
|
49
|
+
connectionUrl: 'file:../mastra.db',
|
|
50
|
+
}),
|
|
51
|
+
embedder: openai.embedding('text-embedding-3-small'),
|
|
52
|
+
options: {
|
|
53
|
+
lastMessages: 5,
|
|
54
|
+
semanticRecall: {
|
|
55
|
+
topK: 10,
|
|
56
|
+
messageRange: 1,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### mastra/agents/example-game-agent.ts
|
|
65
|
+
```typescript
|
|
66
|
+
import { openai } from '@ai-sdk/openai';
|
|
67
|
+
import { Agent } from '@mastra/core/agent';
|
|
68
|
+
|
|
69
|
+
export const gameAgent = new Agent({
|
|
70
|
+
name: 'Game Agent',
|
|
71
|
+
instructions: `You are a helpful game assistant for a "Heads Up" guessing game.
|
|
72
|
+
|
|
73
|
+
CRITICAL: You know the famous person's name but you must NEVER reveal it in any response.
|
|
74
|
+
|
|
75
|
+
When a user asks a question about the famous person:
|
|
76
|
+
- Answer truthfully based on the famous person provided
|
|
77
|
+
- Keep responses concise and friendly
|
|
78
|
+
- NEVER mention the person's name, even if it seems natural
|
|
79
|
+
- NEVER reveal gender, nationality, or other characteristics unless specifically asked about them
|
|
80
|
+
- Answer yes/no questions with clear "Yes" or "No" responses
|
|
81
|
+
- Be consistent - same question asked differently should get the same answer
|
|
82
|
+
- Ask for clarification if a question is unclear
|
|
83
|
+
- If multiple questions are asked at once, ask them to ask one at a time
|
|
84
|
+
|
|
85
|
+
When they make a guess:
|
|
86
|
+
- If correct: Congratulate them warmly
|
|
87
|
+
- If incorrect: Politely correct them and encourage them to try again
|
|
88
|
+
|
|
89
|
+
Encourage players to make a guess when they seem to have enough information.
|
|
90
|
+
|
|
91
|
+
You must return a JSON object with:
|
|
92
|
+
- response: Your response to the user
|
|
93
|
+
- gameWon: true if they guessed correctly, false otherwise`,
|
|
94
|
+
model: openai('gpt-4o'),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### mastra/index.ts
|
|
100
|
+
```typescript
|
|
101
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
102
|
+
import { PinoLogger } from '@mastra/loggers';
|
|
103
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
104
|
+
import { headsUpWorkflow } from './workflows/example-heads-up-workflow';
|
|
105
|
+
|
|
106
|
+
import { famousPersonAgent } from './agents/example-famous-person-agent';
|
|
107
|
+
import { gameAgent } from './agents/example-game-agent';
|
|
108
|
+
import { guessVerifierAgent } from './agents/example-guess-verifier-agent';
|
|
109
|
+
|
|
110
|
+
export const mastra = new Mastra({
|
|
111
|
+
workflows: { headsUpWorkflow },
|
|
112
|
+
agents: { famousPersonAgent, gameAgent, guessVerifierAgent },
|
|
113
|
+
storage: new LibSQLStore({
|
|
114
|
+
// stores telemetry, evals, ... into file storage for persistence across playground refreshes
|
|
115
|
+
url: 'file:../mastra.db',
|
|
116
|
+
}),
|
|
117
|
+
logger: new PinoLogger({
|
|
118
|
+
name: 'Mastra',
|
|
119
|
+
level: 'info',
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### mastra/workflows/example-heads-up-workflow.ts
|
|
126
|
+
```typescript
|
|
127
|
+
import { createWorkflow, createStep } from '@mastra/core/workflows';
|
|
128
|
+
import { z } from 'zod';
|
|
129
|
+
import { Pool } from 'pg';
|
|
130
|
+
|
|
131
|
+
// PostgreSQL client
|
|
132
|
+
const pool = new Pool({
|
|
133
|
+
connectionString: process.env.DATABASE_URL!,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const startStep = createStep({
|
|
137
|
+
id: 'start-step',
|
|
138
|
+
description: "Generate a famous person's name",
|
|
139
|
+
inputSchema: z.object({
|
|
140
|
+
start: z.boolean(),
|
|
141
|
+
}),
|
|
142
|
+
outputSchema: z.object({
|
|
143
|
+
famousPerson: z.string(),
|
|
144
|
+
guessCount: z.number(),
|
|
145
|
+
}),
|
|
146
|
+
execute: async ({ mastra }) => {
|
|
147
|
+
const agent = mastra.getAgent('famousPersonAgent');
|
|
148
|
+
const response = await agent.generate("Generate a famous person's name", {
|
|
149
|
+
temperature: 1.2,
|
|
150
|
+
topP: 0.9,
|
|
151
|
+
memory: {
|
|
152
|
+
resource: 'heads-up-game',
|
|
153
|
+
thread: 'famous-person-generator',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
const famousPerson = response.text.trim();
|
|
157
|
+
return { famousPerson, guessCount: 0 };
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const gameStep = createStep({
|
|
162
|
+
id: 'game-step',
|
|
163
|
+
description: 'Handles the question-answer-continue loop',
|
|
164
|
+
inputSchema: z.object({
|
|
165
|
+
famousPerson: z.string(),
|
|
166
|
+
guessCount: z.number(),
|
|
167
|
+
}),
|
|
168
|
+
resumeSchema: z.object({
|
|
169
|
+
userMessage: z.string(),
|
|
170
|
+
}),
|
|
171
|
+
suspendSchema: z.object({
|
|
172
|
+
agentResponse: z.string(),
|
|
173
|
+
}),
|
|
174
|
+
outputSchema: z.object({
|
|
175
|
+
famousPerson: z.string(),
|
|
176
|
+
gameWon: z.boolean(),
|
|
177
|
+
agentResponse: z.string(),
|
|
178
|
+
guessCount: z.number(),
|
|
179
|
+
}),
|
|
180
|
+
execute: async ({ inputData, mastra, resumeData, suspend }) => {
|
|
181
|
+
let { famousPerson, guessCount } = inputData;
|
|
182
|
+
const { userMessage } = resumeData ?? {};
|
|
183
|
+
|
|
184
|
+
if (!userMessage) {
|
|
185
|
+
// First time - ask for a question
|
|
186
|
+
const message = "I'm thinking of a famous person. Ask me yes/no questions to figure out who it is!";
|
|
187
|
+
|
|
188
|
+
await suspend({
|
|
189
|
+
agentResponse: message,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
return { famousPerson, gameWon: false, agentResponse: message, guessCount };
|
|
193
|
+
} else {
|
|
194
|
+
// Check if the user's message is a guess by using the guess verifier agent
|
|
195
|
+
const guessVerifier = mastra.getAgent('guessVerifierAgent');
|
|
196
|
+
const verificationResponse = await guessVerifier.generate(
|
|
197
|
+
[
|
|
198
|
+
{
|
|
199
|
+
role: 'user',
|
|
200
|
+
content: `Actual famous person: ${famousPerson}
|
|
201
|
+
User's guess: "${userMessage}"
|
|
202
|
+
Is this correct?`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
{
|
|
206
|
+
output: z.object({
|
|
207
|
+
isCorrect: z.boolean(),
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
const gameWon = verificationResponse.object.isCorrect;
|
|
213
|
+
|
|
214
|
+
// Let the agent handle the user's message (question or guess)
|
|
215
|
+
const agent = mastra.getAgent('gameAgent');
|
|
216
|
+
const response = await agent.generate(`
|
|
217
|
+
The famous person is: ${famousPerson}
|
|
218
|
+
The user asked: "${userMessage}"
|
|
219
|
+
Is this a correct guess: ${gameWon}
|
|
220
|
+
Please respond appropriately.
|
|
221
|
+
`);
|
|
222
|
+
|
|
223
|
+
const agentResponse = response.text;
|
|
224
|
+
|
|
225
|
+
// Increment the guess count
|
|
226
|
+
guessCount++;
|
|
227
|
+
|
|
228
|
+
return { famousPerson, gameWon, agentResponse, guessCount };
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const winStep = createStep({
|
|
234
|
+
id: 'win-step',
|
|
235
|
+
description: 'Handle game win logic',
|
|
236
|
+
inputSchema: z.object({
|
|
237
|
+
famousPerson: z.string(),
|
|
238
|
+
gameWon: z.boolean(),
|
|
239
|
+
agentResponse: z.string(),
|
|
240
|
+
guessCount: z.number(),
|
|
241
|
+
}),
|
|
242
|
+
outputSchema: z.object({
|
|
243
|
+
famousPerson: z.string(),
|
|
244
|
+
gameWon: z.boolean(),
|
|
245
|
+
guessCount: z.number(),
|
|
246
|
+
}),
|
|
247
|
+
execute: async ({ inputData }) => {
|
|
248
|
+
const { famousPerson, gameWon, guessCount } = inputData;
|
|
249
|
+
|
|
250
|
+
await pool.query('INSERT INTO heads_up_games (famous_person, game_won, guess_count) VALUES ($1, $2, $3)', [
|
|
251
|
+
famousPerson,
|
|
252
|
+
gameWon,
|
|
253
|
+
guessCount,
|
|
254
|
+
]);
|
|
255
|
+
|
|
256
|
+
return { famousPerson, gameWon, guessCount };
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
export const headsUpWorkflow = createWorkflow({
|
|
261
|
+
id: 'heads-up-workflow',
|
|
262
|
+
inputSchema: z.object({
|
|
263
|
+
start: z.boolean(),
|
|
264
|
+
}),
|
|
265
|
+
outputSchema: z.object({
|
|
266
|
+
famousPerson: z.string(),
|
|
267
|
+
gameWon: z.boolean(),
|
|
268
|
+
guessCount: z.number(),
|
|
269
|
+
}),
|
|
270
|
+
})
|
|
271
|
+
.then(startStep)
|
|
272
|
+
.dountil(gameStep, async ({ inputData: { gameWon } }) => gameWon)
|
|
273
|
+
.then(winStep)
|
|
274
|
+
.commit();
|
|
275
|
+
|
|
276
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.14-alpha.
|
|
3
|
+
"version": "0.13.14-alpha.2",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"zod": "^3.25.67",
|
|
34
34
|
"zod-to-json-schema": "^3.24.5",
|
|
35
|
-
"@mastra/core": "0.14.2-alpha.
|
|
35
|
+
"@mastra/core": "0.14.2-alpha.2",
|
|
36
36
|
"@mastra/mcp": "^0.10.13-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"tsx": "^4.19.4",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@internal/lint": "0.0.31",
|
|
52
|
+
"@mastra/core": "0.14.2-alpha.2"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",
|