@mastra/mcp-docs-server 0.13.7-alpha.1 → 0.13.7-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 +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +17 -0
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +18 -18
- package/.docs/organized/changelogs/mastra.md +21 -21
- package/.docs/organized/code-examples/agent.md +93 -3
- package/.docs/organized/code-examples/ai-sdk-v5.md +4 -4
- package/.docs/raw/agents/input-processors.mdx +268 -0
- package/.docs/raw/agents/using-tools-and-mcp.mdx +39 -0
- package/.docs/raw/community/contributing-templates.mdx +2 -2
- package/.docs/raw/observability/tracing.mdx +44 -0
- package/.docs/raw/reference/agents/agent.mdx +7 -0
- package/.docs/raw/reference/cli/dev.mdx +6 -0
- package/.docs/raw/reference/client-js/memory.mdx +18 -0
- package/.docs/raw/reference/memory/Memory.mdx +1 -0
- package/.docs/raw/reference/memory/deleteMessages.mdx +95 -0
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +33 -1
- package/.docs/raw/reference/rag/upstash.mdx +112 -5
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -1
- package/.docs/raw/reference/scorers/faithfulness.mdx +0 -1
- package/.docs/raw/reference/scorers/hallucination.mdx +0 -2
- package/.docs/raw/reference/scorers/llm-scorer.mdx +45 -1
- package/.docs/raw/reference/storage/libsql.mdx +7 -4
- package/.docs/raw/reference/storage/mssql.mdx +7 -3
- package/.docs/raw/reference/storage/postgresql.mdx +7 -3
- package/.docs/raw/reference/templates.mdx +11 -5
- package/.docs/raw/scorers/custom-scorers.mdx +319 -0
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +30 -0
- package/.docs/raw/scorers/overview.mdx +124 -0
- package/package.json +6 -6
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 0.12.6-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ff9c125: enhance thread retrieval with sorting options in libsql and pg
|
|
8
|
+
- b8efbb9: feat: add flexible deleteMessages method to memory API
|
|
9
|
+
- Added `memory.deleteMessages(input)` method that accepts multiple input types:
|
|
10
|
+
- Single message ID as string: `deleteMessages('msg-123')`
|
|
11
|
+
- Array of message IDs: `deleteMessages(['msg-1', 'msg-2'])`
|
|
12
|
+
- Message object with id property: `deleteMessages({ id: 'msg-123' })`
|
|
13
|
+
- Array of message objects: `deleteMessages([{ id: 'msg-1' }, { id: 'msg-2' }])`
|
|
14
|
+
- Implemented in all storage adapters (LibSQL, PostgreSQL, Upstash, InMemory)
|
|
15
|
+
- Added REST API endpoint: `POST /api/memory/messages/delete`
|
|
16
|
+
- Updated client SDK: `thread.deleteMessages()` accepts all input types
|
|
17
|
+
- Updates thread timestamps when messages are deleted
|
|
18
|
+
- Added comprehensive test coverage and documentation
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [27cc97a]
|
|
21
|
+
- Updated dependencies [41daa63]
|
|
22
|
+
- Updated dependencies [254a36b]
|
|
23
|
+
- Updated dependencies [0b89602]
|
|
24
|
+
- Updated dependencies [4d37822]
|
|
25
|
+
- Updated dependencies [ff9c125]
|
|
26
|
+
- Updated dependencies [b8efbb9]
|
|
27
|
+
- Updated dependencies [71466e7]
|
|
28
|
+
- Updated dependencies [0c99fbe]
|
|
29
|
+
- @mastra/core@0.12.0-alpha.2
|
|
30
|
+
|
|
3
31
|
## 0.12.5
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -271,32 +299,4 @@
|
|
|
271
299
|
|
|
272
300
|
### Minor Changes
|
|
273
301
|
|
|
274
|
-
|
|
275
|
-
Added automatic thread updatedAt timestamp updates when messages are saved across all storage providers
|
|
276
|
-
Enhanced user experience: Threads now accurately reflect their latest activity with automatic timestamp updates when new messages are added
|
|
277
|
-
Universal implementation: Consistent behavior across all 7 storage backends (ClickHouse, Cloudflare D1, DynamoDB, MongoDB, PostgreSQL, Upstash, LibSQL)
|
|
278
|
-
Performance optimized: Updates execute in parallel with message saving operations for minimal performance impact
|
|
279
|
-
Backwards compatible: No breaking changes - existing code continues to work unchanged
|
|
280
|
-
Improved conversation ordering: Chat interfaces can now properly sort threads by actual last activity
|
|
281
|
-
This enhancement resolves the issue where active conversations appeared stale due to outdated thread timestamps, providing better conversation management and user experience in chat applications.
|
|
282
|
-
|
|
283
|
-
### Patch Changes
|
|
284
|
-
|
|
285
|
-
- 63f6b7d: dependencies updates:
|
|
286
|
-
- Updated dependency [`pg-promise@^11.14.0` ↗︎](https://www.npmjs.com/package/pg-promise/v/11.14.0) (from `^11.13.0`, in `dependencies`)
|
|
287
|
-
- eed55d7: quotes table and schema names for vector and storage to allow for camelcase
|
|
288
|
-
- 6c23252: [MASTRA-3982] Fix Memory Retrieval for PG when scope is resource
|
|
289
|
-
- Updated dependencies [63f6b7d]
|
|
290
|
-
- Updated dependencies [12a95fc]
|
|
291
|
-
- Updated dependencies [4b0f8a6]
|
|
292
|
-
- Updated dependencies [51264a5]
|
|
293
|
-
- Updated dependencies [8e6f677]
|
|
294
|
-
- Updated dependencies [d70c420]
|
|
295
|
-
- Updated dependencies [ee9af57]
|
|
296
|
-
- Updated dependencies [36f1c36]
|
|
297
|
-
- Updated dependencies [2a16996]
|
|
298
|
-
- Updated dependencies [10d352e]
|
|
299
|
-
- Updated dependencies [9589624]
|
|
300
|
-
- Updated dependencies [53d3c37]
|
|
301
|
-
|
|
302
|
-
... 1833 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 1861 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/deployer
|
|
2
2
|
|
|
3
|
+
## 0.12.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ff9c125: enhance thread retrieval with sorting options in libsql and pg
|
|
8
|
+
- b8efbb9: feat: add flexible deleteMessages method to memory API
|
|
9
|
+
- Added `memory.deleteMessages(input)` method that accepts multiple input types:
|
|
10
|
+
- Single message ID as string: `deleteMessages('msg-123')`
|
|
11
|
+
- Array of message IDs: `deleteMessages(['msg-1', 'msg-2'])`
|
|
12
|
+
- Message object with id property: `deleteMessages({ id: 'msg-123' })`
|
|
13
|
+
- Array of message objects: `deleteMessages([{ id: 'msg-1' }, { id: 'msg-2' }])`
|
|
14
|
+
- Implemented in all storage adapters (LibSQL, PostgreSQL, Upstash, InMemory)
|
|
15
|
+
- Added REST API endpoint: `POST /api/memory/messages/delete`
|
|
16
|
+
- Updated client SDK: `thread.deleteMessages()` accepts all input types
|
|
17
|
+
- Updates thread timestamps when messages are deleted
|
|
18
|
+
- Added comprehensive test coverage and documentation
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [27cc97a]
|
|
21
|
+
- Updated dependencies [41daa63]
|
|
22
|
+
- Updated dependencies [254a36b]
|
|
23
|
+
- Updated dependencies [0b89602]
|
|
24
|
+
- Updated dependencies [4d37822]
|
|
25
|
+
- Updated dependencies [ff9c125]
|
|
26
|
+
- Updated dependencies [b8efbb9]
|
|
27
|
+
- Updated dependencies [71466e7]
|
|
28
|
+
- Updated dependencies [0c99fbe]
|
|
29
|
+
- @mastra/core@0.12.0-alpha.2
|
|
30
|
+
|
|
3
31
|
## 0.12.0-alpha.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -271,32 +299,4 @@
|
|
|
271
299
|
- Updated dependencies [f36e4f1]
|
|
272
300
|
- @mastra/core@0.10.11-alpha.0
|
|
273
301
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
### Patch Changes
|
|
277
|
-
|
|
278
|
-
- 6e13b80: Add error cause and stack trace to mastra server error handler
|
|
279
|
-
- 6997af1: add send event to server, deployer, client-js and playground-ui
|
|
280
|
-
- Updated dependencies [4d3fbdf]
|
|
281
|
-
- @mastra/core@0.10.10
|
|
282
|
-
|
|
283
|
-
## 0.10.10-alpha.1
|
|
284
|
-
|
|
285
|
-
### Patch Changes
|
|
286
|
-
|
|
287
|
-
- 6997af1: add send event to server, deployer, client-js and playground-ui
|
|
288
|
-
- @mastra/core@0.10.10-alpha.1
|
|
289
|
-
|
|
290
|
-
## 0.10.10-alpha.0
|
|
291
|
-
|
|
292
|
-
### Patch Changes
|
|
293
|
-
|
|
294
|
-
- 6e13b80: Add error cause and stack trace to mastra server error handler
|
|
295
|
-
- Updated dependencies [4d3fbdf]
|
|
296
|
-
- @mastra/core@0.10.10-alpha.0
|
|
297
|
-
|
|
298
|
-
## 0.10.9
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
... 2521 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 2549 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/upstash
|
|
2
2
|
|
|
3
|
+
## 0.12.4-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b92bc89: Added hybrid search support to @mastra/upstash vector store. Supports sparse vectors, fusion algorithm, and query mode.
|
|
8
|
+
- b8efbb9: feat: add flexible deleteMessages method to memory API
|
|
9
|
+
- Added `memory.deleteMessages(input)` method that accepts multiple input types:
|
|
10
|
+
- Single message ID as string: `deleteMessages('msg-123')`
|
|
11
|
+
- Array of message IDs: `deleteMessages(['msg-1', 'msg-2'])`
|
|
12
|
+
- Message object with id property: `deleteMessages({ id: 'msg-123' })`
|
|
13
|
+
- Array of message objects: `deleteMessages([{ id: 'msg-1' }, { id: 'msg-2' }])`
|
|
14
|
+
- Implemented in all storage adapters (LibSQL, PostgreSQL, Upstash, InMemory)
|
|
15
|
+
- Added REST API endpoint: `POST /api/memory/messages/delete`
|
|
16
|
+
- Updated client SDK: `thread.deleteMessages()` accepts all input types
|
|
17
|
+
- Updates thread timestamps when messages are deleted
|
|
18
|
+
- Added comprehensive test coverage and documentation
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [27cc97a]
|
|
21
|
+
- Updated dependencies [41daa63]
|
|
22
|
+
- Updated dependencies [254a36b]
|
|
23
|
+
- Updated dependencies [0b89602]
|
|
24
|
+
- Updated dependencies [4d37822]
|
|
25
|
+
- Updated dependencies [ff9c125]
|
|
26
|
+
- Updated dependencies [b8efbb9]
|
|
27
|
+
- Updated dependencies [71466e7]
|
|
28
|
+
- Updated dependencies [0c99fbe]
|
|
29
|
+
- @mastra/core@0.12.0-alpha.2
|
|
30
|
+
|
|
3
31
|
## 0.12.4-alpha.0
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -270,33 +298,5 @@
|
|
|
270
298
|
|
|
271
299
|
### Patch Changes
|
|
272
300
|
|
|
273
|
-
- 1a35518: dependencies updates:
|
|
274
|
-
- Updated dependency [`@upstash/redis@^1.35.0` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.35.0) (from `^1.34.5`, in `dependencies`)
|
|
275
|
-
- dffb67b: updated stores to add alter table and change tests
|
|
276
|
-
- 925ab94: added paginated functions to base class and added boilerplate and updated imports
|
|
277
|
-
- 48eddb9: update filter logic in Memory class to support semantic recall search scope
|
|
278
|
-
- 66f4424: Update peerdeps
|
|
279
|
-
- a914da2: Fix upstash paginated APIs
|
|
280
|
-
- Updated dependencies [d1ed912]
|
|
281
|
-
- Updated dependencies [f6fd25f]
|
|
282
|
-
- Updated dependencies [dffb67b]
|
|
283
|
-
- Updated dependencies [f1f1f1b]
|
|
284
|
-
- Updated dependencies [925ab94]
|
|
285
|
-
- Updated dependencies [f9816ae]
|
|
286
|
-
- Updated dependencies [82090c1]
|
|
287
|
-
- Updated dependencies [1b443fd]
|
|
288
|
-
- Updated dependencies [ce97900]
|
|
289
|
-
- Updated dependencies [f1309d3]
|
|
290
|
-
- Updated dependencies [14a2566]
|
|
291
|
-
- Updated dependencies [f7f8293]
|
|
292
|
-
- Updated dependencies [48eddb9]
|
|
293
|
-
- @mastra/core@0.10.4
|
|
294
|
-
|
|
295
|
-
## 0.10.3-alpha.4
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- 66f4424: Update peerdeps
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1729 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/vectorize
|
|
2
2
|
|
|
3
|
+
## 0.11.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9881232: dependencies updates:
|
|
8
|
+
- Updated dependency [`cloudflare@^4.5.0` ↗︎](https://www.npmjs.com/package/cloudflare/v/4.5.0) (from `^4.4.1`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [27cc97a]
|
|
10
|
+
- Updated dependencies [41daa63]
|
|
11
|
+
- Updated dependencies [254a36b]
|
|
12
|
+
- Updated dependencies [0b89602]
|
|
13
|
+
- Updated dependencies [4d37822]
|
|
14
|
+
- Updated dependencies [ff9c125]
|
|
15
|
+
- Updated dependencies [b8efbb9]
|
|
16
|
+
- Updated dependencies [71466e7]
|
|
17
|
+
- Updated dependencies [0c99fbe]
|
|
18
|
+
- @mastra/core@0.12.0-alpha.2
|
|
19
|
+
|
|
3
20
|
## 0.11.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -281,22 +298,5 @@
|
|
|
281
298
|
|
|
282
299
|
- 9cd1a46: [MASTRA-3338] update naming scheme for embedding index based on vector store rules and added duplicate index checks
|
|
283
300
|
- Updated dependencies [e450778]
|
|
284
|
-
- Updated dependencies [8902157]
|
|
285
|
-
- Updated dependencies [ca0dc88]
|
|
286
|
-
- Updated dependencies [526c570]
|
|
287
|
-
- Updated dependencies [d7a6a33]
|
|
288
|
-
- Updated dependencies [9cd1a46]
|
|
289
|
-
- Updated dependencies [b5d2de0]
|
|
290
|
-
- Updated dependencies [644f8ad]
|
|
291
|
-
- Updated dependencies [70dbf51]
|
|
292
|
-
- @mastra/core@0.9.3
|
|
293
|
-
|
|
294
|
-
## 0.2.9-alpha.1
|
|
295
|
-
|
|
296
|
-
### Patch Changes
|
|
297
|
-
|
|
298
|
-
- 9cd1a46: [MASTRA-3338] update naming scheme for embedding index based on vector store rules and added duplicate index checks
|
|
299
|
-
- Updated dependencies [e450778]
|
|
300
|
-
- Updated dependencies [8902157]
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 1658 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/voice-cloudflare
|
|
2
2
|
|
|
3
|
+
## 0.10.6-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9881232: dependencies updates:
|
|
8
|
+
- Updated dependency [`cloudflare@^4.5.0` ↗︎](https://www.npmjs.com/package/cloudflare/v/4.5.0) (from `^4.4.1`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [27cc97a]
|
|
10
|
+
- Updated dependencies [41daa63]
|
|
11
|
+
- Updated dependencies [254a36b]
|
|
12
|
+
- Updated dependencies [0b89602]
|
|
13
|
+
- Updated dependencies [4d37822]
|
|
14
|
+
- Updated dependencies [ff9c125]
|
|
15
|
+
- Updated dependencies [b8efbb9]
|
|
16
|
+
- Updated dependencies [71466e7]
|
|
17
|
+
- Updated dependencies [0c99fbe]
|
|
18
|
+
- @mastra/core@0.12.0-alpha.2
|
|
19
|
+
|
|
3
20
|
## 0.10.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -281,22 +298,5 @@
|
|
|
281
298
|
|
|
282
299
|
### Patch Changes
|
|
283
300
|
|
|
284
|
-
- Updated dependencies [daf942f]
|
|
285
|
-
- Updated dependencies [0b8b868]
|
|
286
|
-
- @mastra/core@0.9.4-alpha.0
|
|
287
|
-
|
|
288
|
-
## 0.1.10
|
|
289
|
-
|
|
290
|
-
### Patch Changes
|
|
291
301
|
|
|
292
|
-
|
|
293
|
-
- Updated dependencies [8902157]
|
|
294
|
-
- Updated dependencies [ca0dc88]
|
|
295
|
-
- Updated dependencies [526c570]
|
|
296
|
-
- Updated dependencies [d7a6a33]
|
|
297
|
-
- Updated dependencies [9cd1a46]
|
|
298
|
-
- Updated dependencies [b5d2de0]
|
|
299
|
-
- Updated dependencies [644f8ad]
|
|
300
|
-
- Updated dependencies [70dbf51]
|
|
301
|
-
|
|
302
|
-
... 571 more lines hidden. See full changelog in package directory.
|
|
302
|
+
... 588 more lines hidden. See full changelog in package directory.
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# mastra
|
|
2
2
|
|
|
3
|
+
## 0.10.16-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d5cc460: This change implements a fix to sourcemap mappings being off due to `removeDeployer` Babel plugin missing source map config.
|
|
8
|
+
- a5681f2: fix: pagination breaks trace grouping
|
|
9
|
+
- Updated dependencies [27cc97a]
|
|
10
|
+
- Updated dependencies [27cc97a]
|
|
11
|
+
- Updated dependencies [41daa63]
|
|
12
|
+
- Updated dependencies [254a36b]
|
|
13
|
+
- Updated dependencies [0b89602]
|
|
14
|
+
- Updated dependencies [4d37822]
|
|
15
|
+
- Updated dependencies [ff9c125]
|
|
16
|
+
- Updated dependencies [d5cc460]
|
|
17
|
+
- Updated dependencies [b8efbb9]
|
|
18
|
+
- Updated dependencies [71466e7]
|
|
19
|
+
- Updated dependencies [0c99fbe]
|
|
20
|
+
- @mastra/core@0.12.0-alpha.2
|
|
21
|
+
- @mastra/deployer@0.12.0-alpha.2
|
|
22
|
+
|
|
3
23
|
## 0.10.16-alpha.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -278,25 +298,5 @@
|
|
|
278
298
|
- 640f47e: move agent model settings into agent settings
|
|
279
299
|
- 5d0c163: Scaffold create-mastra projects with zod@^3 to prevent package version conflicts during install
|
|
280
300
|
- 53e3f58: Add support for custom instrumentation files
|
|
281
|
-
- Updated dependencies [b4a9811]
|
|
282
|
-
- Updated dependencies [4d5583d]
|
|
283
|
-
- Updated dependencies [53e3f58]
|
|
284
|
-
- @mastra/core@0.10.12
|
|
285
|
-
- @mastra/deployer@0.10.12
|
|
286
|
-
|
|
287
|
-
## 0.10.12-alpha.0
|
|
288
|
-
|
|
289
|
-
### Patch Changes
|
|
290
|
-
|
|
291
|
-
- 640f47e: move agent model settings into agent settings
|
|
292
|
-
- 5d0c163: Scaffold create-mastra projects with zod@^3 to prevent package version conflicts during install
|
|
293
|
-
- 53e3f58: Add support for custom instrumentation files
|
|
294
|
-
- Updated dependencies [b4a9811]
|
|
295
|
-
- Updated dependencies [53e3f58]
|
|
296
|
-
- @mastra/core@0.10.12-alpha.0
|
|
297
|
-
- @mastra/deployer@0.10.12-alpha.0
|
|
298
|
-
|
|
299
|
-
## 0.10.11
|
|
300
|
-
|
|
301
301
|
|
|
302
|
-
...
|
|
302
|
+
... 4594 more lines hidden. See full changelog in package directory.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"name": "examples-agent",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@ai-sdk/openai": "latest",
|
|
7
|
+
"@ai-sdk/google": "latest",
|
|
7
8
|
"@mastra/client-js": "latest",
|
|
8
9
|
"@mastra/core": "latest",
|
|
9
10
|
"@mastra/loggers": "latest",
|
|
@@ -454,12 +455,15 @@ main();
|
|
|
454
455
|
### mastra/agents/index.ts
|
|
455
456
|
```typescript
|
|
456
457
|
import { openai } from '@ai-sdk/openai';
|
|
458
|
+
import { google } from '@ai-sdk/google';
|
|
457
459
|
import { jsonSchema, tool } from 'ai';
|
|
458
460
|
import { OpenAIVoice } from '@mastra/voice-openai';
|
|
459
461
|
import { Memory } from '@mastra/memory';
|
|
460
|
-
import { Agent } from '@mastra/core/agent';
|
|
462
|
+
import { Agent, InputProcessor } from '@mastra/core/agent';
|
|
461
463
|
import { cookingTool } from '../tools/index.js';
|
|
462
464
|
import { myWorkflow } from '../workflows/index.js';
|
|
465
|
+
import { PIIDetector, LanguageDetector, PromptInjectionDetector } from '@mastra/core/agent/input-processor/processors';
|
|
466
|
+
import { MCPClient } from '@mastra/mcp';
|
|
463
467
|
|
|
464
468
|
const memory = new Memory();
|
|
465
469
|
|
|
@@ -538,6 +542,50 @@ export const dynamicAgent = new Agent({
|
|
|
538
542
|
},
|
|
539
543
|
});
|
|
540
544
|
|
|
545
|
+
const vegetarianProcessor: InputProcessor = {
|
|
546
|
+
name: 'eat-more-tofu',
|
|
547
|
+
process: async ({ messages }) => {
|
|
548
|
+
messages.push({
|
|
549
|
+
id: crypto.randomUUID(),
|
|
550
|
+
createdAt: new Date(),
|
|
551
|
+
role: 'user',
|
|
552
|
+
content: {
|
|
553
|
+
format: 2,
|
|
554
|
+
parts: [{ type: 'text', text: 'Make the suggested recipe, but remove any meat and add tofu instead' }],
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
return messages;
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
const piiDetector = new PIIDetector({
|
|
563
|
+
model: google('gemini-2.0-flash-001'),
|
|
564
|
+
redactionMethod: 'mask',
|
|
565
|
+
preserveFormat: true,
|
|
566
|
+
includeDetections: true,
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
const languageDetector = new LanguageDetector({
|
|
570
|
+
model: google('gemini-2.0-flash-001'),
|
|
571
|
+
targetLanguages: ['en'],
|
|
572
|
+
strategy: 'translate',
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
const promptInjectionDetector = new PromptInjectionDetector({
|
|
576
|
+
model: google('gemini-2.0-flash-001'),
|
|
577
|
+
strategy: 'block',
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
const mcpInstance = new MCPClient({
|
|
581
|
+
id: 'myMcpServerTwo',
|
|
582
|
+
servers: {
|
|
583
|
+
myMcpServerTwo: {
|
|
584
|
+
url: new URL(`http://localhost:4111/api/mcp/myMcpServerTwo/mcp`),
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
});
|
|
588
|
+
|
|
541
589
|
export const chefAgentResponses = new Agent({
|
|
542
590
|
name: 'Chef Agent Responses',
|
|
543
591
|
instructions: `
|
|
@@ -546,12 +594,54 @@ export const chefAgentResponses = new Agent({
|
|
|
546
594
|
You explain cooking steps clearly and offer substitutions when needed, maintaining a friendly and encouraging tone throughout.
|
|
547
595
|
`,
|
|
548
596
|
model: openai.responses('gpt-4o'),
|
|
549
|
-
tools: {
|
|
550
|
-
|
|
597
|
+
tools: async () => {
|
|
598
|
+
return {
|
|
599
|
+
...(await mcpInstance.getTools()),
|
|
600
|
+
web_search_preview: openai.tools.webSearchPreview(),
|
|
601
|
+
};
|
|
551
602
|
},
|
|
552
603
|
workflows: {
|
|
553
604
|
myWorkflow,
|
|
554
605
|
},
|
|
606
|
+
inputProcessors: [
|
|
607
|
+
piiDetector,
|
|
608
|
+
vegetarianProcessor,
|
|
609
|
+
languageDetector,
|
|
610
|
+
promptInjectionDetector,
|
|
611
|
+
{
|
|
612
|
+
name: 'no-soup-for-you',
|
|
613
|
+
process: async ({ messages, abort }) => {
|
|
614
|
+
const hasSoup = messages.some(msg => {
|
|
615
|
+
for (const part of msg.content.parts) {
|
|
616
|
+
if (part.type === 'text' && part.text.includes('soup')) {
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return false;
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
if (hasSoup) {
|
|
624
|
+
abort('No soup for you!');
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return messages;
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: 'remove-spinach',
|
|
632
|
+
process: async ({ messages }) => {
|
|
633
|
+
for (const message of messages) {
|
|
634
|
+
for (const part of message.content.parts) {
|
|
635
|
+
if (part.type === 'text' && part.text.includes('spinach')) {
|
|
636
|
+
part.text = part.text.replaceAll('spinach', '');
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return messages;
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
],
|
|
555
645
|
});
|
|
556
646
|
|
|
557
647
|
```
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"@mastra/rag": "0.0.0-ai-v5-20250625173645",
|
|
14
14
|
"@mastra/server": "0.0.0-ai-v5-20250625173645",
|
|
15
15
|
"next": "15.2.4",
|
|
16
|
-
"react": "^19.
|
|
17
|
-
"react-dom": "^19.
|
|
16
|
+
"react": "^19.1.0",
|
|
17
|
+
"react-dom": "^19.1.0",
|
|
18
18
|
"swr": "^2.3.3",
|
|
19
19
|
"zod": "^3.25.67"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@eslint/eslintrc": "^3",
|
|
23
23
|
"@types/node": "^20",
|
|
24
|
-
"@types/react": "^19",
|
|
25
|
-
"@types/react-dom": "^19",
|
|
24
|
+
"@types/react": "^19.1.8",
|
|
25
|
+
"@types/react-dom": "^19.1.6",
|
|
26
26
|
"eslint": "^9",
|
|
27
27
|
"eslint-config-next": "15.1.7",
|
|
28
28
|
"mastra": "0.0.0-ai-v5-20250625173645",
|