@mastra/mcp-docs-server 1.1.17-alpha.7 → 1.1.17

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.
Files changed (39) hide show
  1. package/.docs/docs/evals/built-in-scorers.md +1 -0
  2. package/.docs/docs/memory/observational-memory.md +49 -4
  3. package/.docs/docs/server/mastra-client.md +17 -0
  4. package/.docs/docs/server/server-adapters.md +15 -1
  5. package/.docs/models/gateways/openrouter.md +1 -1
  6. package/.docs/models/index.md +1 -1
  7. package/.docs/models/providers/bailing.md +1 -1
  8. package/.docs/models/providers/cloudflare-workers-ai.md +4 -3
  9. package/.docs/models/providers/firmware.md +2 -2
  10. package/.docs/models/providers/friendli.md +1 -1
  11. package/.docs/models/providers/github-models.md +1 -1
  12. package/.docs/models/providers/google.md +7 -2
  13. package/.docs/models/providers/groq.md +24 -16
  14. package/.docs/models/providers/huggingface.md +1 -1
  15. package/.docs/models/providers/llmgateway.md +269 -0
  16. package/.docs/models/providers/mistral.md +3 -2
  17. package/.docs/models/providers/nano-gpt.md +3 -1
  18. package/.docs/models/providers/openai.md +2 -1
  19. package/.docs/models/providers/poe.md +3 -1
  20. package/.docs/models/providers/zai-coding-plan.md +3 -2
  21. package/.docs/models/providers/zhipuai-coding-plan.md +3 -2
  22. package/.docs/models/providers.md +1 -0
  23. package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
  24. package/.docs/reference/client-js/agents.md +11 -6
  25. package/.docs/reference/client-js/mastra-client.md +1 -1
  26. package/.docs/reference/client-js/memory.md +1 -1
  27. package/.docs/reference/configuration.md +24 -0
  28. package/.docs/reference/core/mastra-model-gateway.md +2 -0
  29. package/.docs/reference/deployer/cloudflare.md +31 -1
  30. package/.docs/reference/evals/run-evals.md +78 -3
  31. package/.docs/reference/evals/scorer-utils.md +188 -0
  32. package/.docs/reference/evals/trajectory-accuracy.md +627 -0
  33. package/.docs/reference/index.md +1 -2
  34. package/.docs/reference/logging/pino-logger.md +58 -0
  35. package/.docs/reference/memory/observational-memory.md +32 -6
  36. package/CHANGELOG.md +44 -0
  37. package/package.json +6 -6
  38. package/.docs/reference/core/getStoredAgentById.md +0 -87
  39. package/.docs/reference/core/listStoredAgents.md +0 -91
@@ -30,6 +30,64 @@ export const mastra = new Mastra({
30
30
 
31
31
  **formatters** (`pino.LoggerOptions['formatters']`): Custom Pino formatters for log serialization.
32
32
 
33
+ **redact** (`pino.LoggerOptions['redact']`): Paths or options for redacting sensitive fields from log output (Pino \`redact\`).
34
+
35
+ **prettyPrint** (`boolean`): When false, disables \`pino-pretty\` and writes raw JSON lines (useful for log aggregators). (Default: `true`)
36
+
37
+ **mixin** (`pino.MixinFn`): Pino mixin function merged into every log object (for example request-scoped \`traceId\` or other shared metadata).
38
+
39
+ **customLevels** (`Record<string, number>`): Custom log levels and numeric values, forwarded to Pino. Standard severity is still logged via \`debug\`, \`info\`, \`warn\`, and \`error\`; extra levels follow Pino’s custom-level behavior.
40
+
41
+ ## Log enrichment with `mixin`
42
+
43
+ Use `mixin` when you want the same structured fields on every line (for correlation with the rest of your services):
44
+
45
+ ```typescript
46
+ import { Mastra } from '@mastra/core'
47
+ import { PinoLogger } from '@mastra/loggers'
48
+
49
+ function getTraceContext() {
50
+ return { traceId: 'abc-123' }
51
+ }
52
+
53
+ export const mastra = new Mastra({
54
+ logger: new PinoLogger({
55
+ name: 'Mastra',
56
+ level: 'info',
57
+ mixin() {
58
+ return getTraceContext()
59
+ },
60
+ }),
61
+ })
62
+ ```
63
+
64
+ ## Custom levels
65
+
66
+ `customLevels` is passed through to Pino. `PinoLogger` only exposes `debug`, `info`, `warn`, and `error`; for any extra level name (for example `audit`), subclass and forward to the underlying Pino instance:
67
+
68
+ ```typescript
69
+ import { Mastra } from '@mastra/core'
70
+ import { PinoLogger } from '@mastra/loggers'
71
+
72
+ type AuditLevel = 'audit'
73
+
74
+ class MastraPinoWithAudit extends PinoLogger<AuditLevel> {
75
+ audit(message: string, meta: Record<string, unknown> = {}) {
76
+ this.logger.audit(meta, message)
77
+ }
78
+ }
79
+
80
+ const logger = new MastraPinoWithAudit({
81
+ name: 'Mastra',
82
+ level: 'info',
83
+ customLevels: { audit: 35 },
84
+ })
85
+
86
+ export const mastra = new Mastra({ logger })
87
+ ```
88
+
89
+ Numeric values follow Pino’s ordering (built-in levels use 10–60). A level of `35` sits between `info` (30) and `warn` (40), so with `level: 'info'` both `info` and `audit` lines are emitted.
90
+
33
91
  ## File transport (structured logs)
34
92
 
35
93
  Writes structured logs to a file using the `FileTransport`. The logger accepts a plain message as the first argument and structured metadata as the second argument. These are internally converted to a `BaseLogMessage` and persisted to the configured file path.
@@ -38,7 +38,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
38
38
 
39
39
  **shareTokenBudget** (`boolean`): Share the token budget between messages and observations. When enabled, the total budget is \`observation.messageTokens + reflection.observationTokens\`. Messages can use more space when observations are small, and vice versa. This maximizes context usage through flexible allocation. \`shareTokenBudget\` is not yet compatible with async buffering. You must set \`observation: { bufferTokens: false }\` when using this option (this is a temporary limitation). (Default: `false`)
40
40
 
41
- **retrieval** (`boolean`): \*\*Experimental.\*\* Enable retrieval-mode observation groups as durable pointers to raw message history. Retrieval mode is only active when \`scope\` is \`'thread'\`. If you set \`retrieval: true\` with \`scope: 'resource'\`, OM keeps resource-scoped memory behavior but skips retrieval-mode context and does not register the \`recall\` tool. (Default: `false`)
41
+ **retrieval** (`boolean | { vector?: boolean; scope?: 'thread' | 'resource' }`): \*\*Experimental.\*\* Enable retrieval-mode observation groups as durable pointers to raw message history. \`true\` enables cross-thread browsing by default. \`{ vector: true }\` also enables semantic search using Memory's vector store and embedder. \`{ scope: 'thread' }\` restricts the recall tool to the current thread only. Default scope is \`'resource'\`. (Default: `false`)
42
42
 
43
43
  **observation** (`ObservationalMemoryObservationConfig`): Configuration for the observation step. Controls when the Observer agent runs and how it behaves.
44
44
 
@@ -578,21 +578,31 @@ The standalone `ObservationalMemory` class accepts all the same options as the `
578
578
 
579
579
  ## Recall tool
580
580
 
581
- When `retrieval: true` is set with `scope: 'thread'`, OM registers a `recall` tool that the agent can call to page through the raw messages behind an observation group's `_range`. The tool is automatically added to the agent's tool list — no manual registration is needed.
581
+ When `retrieval` is set (any truthy value), a `recall` tool is registered so the agent can page through raw messages behind observation group ranges. By default (scope `'resource'`), the tool supports listing threads (`mode: "threads"`), browsing other threads (`threadId`), and cross-thread search. With `retrieval: { vector: true }`, semantic search is available (`mode: "search"`). Set `scope: 'thread'` to restrict the tool to the current thread only. The tool is automatically added to the agent's tool list — no manual registration is needed.
582
582
 
583
583
  ### Parameters
584
584
 
585
- **cursor** (`string`): A message ID to anchor the recall query. Extract the start or end ID from an observation group range (e.g. from \`\_range: \\\`startId:endId\\\`\_\`, use either \`startId\` or \`endId\`). If a range string is passed directly, the tool returns a hint explaining how to extract the correct ID.
585
+ **mode** (`'messages' | 'threads' | 'search'`): What to retrieve. \`"messages"\` (default) pages through message history. \`"threads"\` lists all threads for the current user. \`"search"\` finds messages by semantic similarity across all threads (requires vector store and embedder). (Default: `'messages'`)
586
586
 
587
- **page** (`number`): Pagination offset from the cursor. Positive values page forward (messages after the cursor), negative values page backward (messages before the cursor). \`0\` is treated as \`1\`. (Default: `1`)
587
+ **query** (`string`): Search query for \`mode: "search"\`. Finds messages semantically similar to this text across all threads for the current user.
588
588
 
589
- **limit** (`number`): Maximum number of messages per page. (Default: `20`)
589
+ **cursor** (`string`): A message ID to anchor the recall query. Required for \`mode: "messages"\` when browsing the current thread. Extract the start or end ID from an observation group range (e.g. from \`\_range: \\\`startId:endId\\\`\_\`, use either \`startId\` or \`endId\`). If a range string is passed directly, the tool returns a hint explaining how to extract the correct ID. Can be omitted when \`threadId\` is provided to start reading from the beginning of that thread.
590
+
591
+ **threadId** (`string`): Browse a different thread by its ID. Use \`mode: "threads"\` first to discover thread IDs. When provided without a \`cursor\`, reading starts from the beginning of the thread.
592
+
593
+ **page** (`number`): Pagination offset. For messages: positive values page forward from cursor, negative values page backward. For threads: page number (0-indexed). \`0\` is treated as \`1\` for messages. (Default: `1`)
594
+
595
+ **limit** (`number`): Maximum number of items to return per page. (Default: `20`)
590
596
 
591
597
  **detail** (`'low' | 'high'`): Controls how much content is shown per message part. \`'low'\` shows truncated text and tool names with positional indices (\`\[p0]\`, \`\[p1]\`). \`'high'\` shows full content including tool arguments and results, clamped to one part per call with continuation hints. (Default: `'low'`)
592
598
 
593
599
  **partIndex** (`number`): Fetch a single message part at full detail by its positional index. Use this when a low-detail recall shows an interesting part at \`\[p1]\` — call again with \`partIndex: 1\` to see the full content without loading every part.
594
600
 
595
- ### Returns
601
+ **before** (`string`): For \`mode: "threads"\` only. Filter to threads created before this date. Accepts ISO 8601 format (e.g. \`"2026-03-15"\`, \`"2026-03-10T00:00:00Z"\`).
602
+
603
+ **after** (`string`): For \`mode: "threads"\` only. Filter to threads created after this date. Accepts ISO 8601 format (e.g. \`"2026-03-01"\`, \`"2026-03-10T00:00:00Z"\`).
604
+
605
+ ### Returns (messages mode)
596
606
 
597
607
  **messages** (`string`): Formatted message content. Format depends on the \`detail\` level.
598
608
 
@@ -612,6 +622,22 @@ When `retrieval: true` is set with `scope: 'thread'`, OM registers a `recall` to
612
622
 
613
623
  **tokenOffset** (`number`): Approximate number of tokens that were trimmed when \`truncated\` is true.
614
624
 
625
+ ### Returns (threads mode)
626
+
627
+ **threads** (`string`): Formatted thread listing. Each thread shows its title, ID, and dates. The current thread is marked with \`← current\`.
628
+
629
+ **count** (`number`): Number of threads returned.
630
+
631
+ **page** (`number`): The page number returned.
632
+
633
+ **hasMore** (`boolean`): Whether more threads exist on the next page.
634
+
635
+ ### Returns (search mode)
636
+
637
+ **results** (`string`): Formatted search results grouped by thread. Each result shows the thread title, thread ID, relevance score, message preview, and a cursor ID for browsing into that thread.
638
+
639
+ **count** (`number`): Number of matching messages found.
640
+
615
641
  ### ModelByInputTokens
616
642
 
617
643
  `ModelByInputTokens` selects a model based on the input token count. It chooses the model for the smallest threshold that covers the actual input size.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.1.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067), [`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`dc9fc19`](https://github.com/mastra-ai/mastra/commit/dc9fc19da4437f6b508cc355f346a8856746a76b), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`fbf22a7`](https://github.com/mastra-ai/mastra/commit/fbf22a7ad86bcb50dcf30459f0d075e51ddeb468), [`f16d92c`](https://github.com/mastra-ai/mastra/commit/f16d92c677a119a135cebcf7e2b9f51ada7a9df4), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a), [`04160ee`](https://github.com/mastra-ai/mastra/commit/04160eedf3130003cf842ad08428c8ff69af4cc1), [`2c27503`](https://github.com/mastra-ai/mastra/commit/2c275032510d131d2cde47f99953abf0fe02c081), [`424a1df`](https://github.com/mastra-ai/mastra/commit/424a1df7bee59abb5c83717a54807fdd674a6224), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`260fe12`](https://github.com/mastra-ai/mastra/commit/260fe1295fe7354e39d6def2775e0797a7a277f0), [`12c88a6`](https://github.com/mastra-ai/mastra/commit/12c88a6e32bf982c2fe0c6af62e65a3414519a75), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`78670e9`](https://github.com/mastra-ai/mastra/commit/78670e97e76d7422cf7025faf371b2aeafed860d), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`d400e7c`](https://github.com/mastra-ai/mastra/commit/d400e7c8b8d7afa6ba2c71769eace4048e3cef8e), [`f58d1a7`](https://github.com/mastra-ai/mastra/commit/f58d1a7a457588a996c3ecb53201a68f3d28c432), [`a49a929`](https://github.com/mastra-ai/mastra/commit/a49a92904968b4fc67e01effee8c7c8d0464ba85), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
8
+ - @mastra/core@1.18.0
9
+ - @mastra/mcp@1.3.2
10
+
11
+ ## 1.1.17-alpha.17
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a)]:
16
+ - @mastra/core@1.18.0-alpha.5
17
+
18
+ ## 1.1.17-alpha.15
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`fbf22a7`](https://github.com/mastra-ai/mastra/commit/fbf22a7ad86bcb50dcf30459f0d075e51ddeb468), [`04160ee`](https://github.com/mastra-ai/mastra/commit/04160eedf3130003cf842ad08428c8ff69af4cc1), [`2c27503`](https://github.com/mastra-ai/mastra/commit/2c275032510d131d2cde47f99953abf0fe02c081), [`424a1df`](https://github.com/mastra-ai/mastra/commit/424a1df7bee59abb5c83717a54807fdd674a6224), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`12c88a6`](https://github.com/mastra-ai/mastra/commit/12c88a6e32bf982c2fe0c6af62e65a3414519a75), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`78670e9`](https://github.com/mastra-ai/mastra/commit/78670e97e76d7422cf7025faf371b2aeafed860d), [`d400e7c`](https://github.com/mastra-ai/mastra/commit/d400e7c8b8d7afa6ba2c71769eace4048e3cef8e), [`f58d1a7`](https://github.com/mastra-ai/mastra/commit/f58d1a7a457588a996c3ecb53201a68f3d28c432), [`a49a929`](https://github.com/mastra-ai/mastra/commit/a49a92904968b4fc67e01effee8c7c8d0464ba85)]:
23
+ - @mastra/core@1.18.0-alpha.4
24
+ - @mastra/mcp@1.3.2-alpha.0
25
+
26
+ ## 1.1.17-alpha.12
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [[`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
31
+ - @mastra/core@1.18.0-alpha.3
32
+
33
+ ## 1.1.17-alpha.10
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [[`f16d92c`](https://github.com/mastra-ai/mastra/commit/f16d92c677a119a135cebcf7e2b9f51ada7a9df4)]:
38
+ - @mastra/core@1.18.0-alpha.2
39
+
40
+ ## 1.1.17-alpha.8
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [[`dc9fc19`](https://github.com/mastra-ai/mastra/commit/dc9fc19da4437f6b508cc355f346a8856746a76b), [`260fe12`](https://github.com/mastra-ai/mastra/commit/260fe1295fe7354e39d6def2775e0797a7a277f0)]:
45
+ - @mastra/core@1.18.0-alpha.1
46
+
3
47
  ## 1.1.17-alpha.6
4
48
 
5
49
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.1.17-alpha.7",
3
+ "version": "1.1.17",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "jsdom": "^26.1.0",
30
30
  "local-pkg": "^1.1.2",
31
31
  "zod": "^4.3.6",
32
- "@mastra/core": "1.18.0-alpha.0",
33
- "@mastra/mcp": "^1.3.1"
32
+ "@mastra/core": "1.18.0",
33
+ "@mastra/mcp": "^1.3.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@hono/node-server": "^1.19.11",
@@ -46,9 +46,9 @@
46
46
  "tsx": "^4.21.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "4.0.18",
49
- "@internal/lint": "0.0.74",
50
- "@internal/types-builder": "0.0.49",
51
- "@mastra/core": "1.18.0-alpha.0"
49
+ "@internal/types-builder": "0.0.50",
50
+ "@mastra/core": "1.18.0",
51
+ "@internal/lint": "0.0.75"
52
52
  },
53
53
  "homepage": "https://mastra.ai",
54
54
  "repository": {
@@ -1,87 +0,0 @@
1
- # Mastra.getStoredAgentById()
2
-
3
- The `.getStoredAgentById()` method retrieves an agent configuration from storage by its ID and creates an executable `Agent` instance. Stored agents allow you to persist agent configurations in a database and dynamically load them at runtime.
4
-
5
- ## Usage example
6
-
7
- ```typescript
8
- // Get an Agent instance from storage
9
- const agent = await mastra.getStoredAgentById('my-stored-agent')
10
-
11
- if (agent) {
12
- const response = await agent.generate('Hello')
13
- console.log(response.text)
14
- }
15
- ```
16
-
17
- ```typescript
18
- // Get the raw storage data instead of an Agent instance
19
- const storedConfig = await mastra.getStoredAgentById('my-stored-agent', { raw: true })
20
-
21
- if (storedConfig) {
22
- console.log(storedConfig.instructions)
23
- console.log(storedConfig.createdAt)
24
- }
25
- ```
26
-
27
- ## Parameters
28
-
29
- **id** (`string`): The unique identifier of the stored agent to retrieve.
30
-
31
- **options** (`{ raw?: boolean }`): Optional configuration object.
32
-
33
- **options.raw** (`boolean`): When \`true\`, returns the raw \`StorageAgentType\` object from storage instead of creating an \`Agent\` instance. Useful for inspecting stored configuration or metadata.
34
-
35
- ## Returns
36
-
37
- **result** (`Agent | StorageAgentType | null`): Returns an \`Agent\` instance by default, or \`StorageAgentType\` when \`raw: true\`. Returns \`null\` if no agent with the given ID exists.
38
-
39
- ## Primitive resolution
40
-
41
- When creating an `Agent` instance from stored configuration, the method resolves references to registered primitives:
42
-
43
- - **Tools**: Resolved from `tools` registered in Mastra config
44
- - **Workflows**: Resolved from `workflows` registered in Mastra config
45
- - **Subagents**: Resolved from `agents` registered in Mastra config
46
- - **Memory**: Resolved from `memory` registered in Mastra config
47
- - **Scorers**: Resolved from `scorers` registered in Mastra config, including sampling configuration
48
-
49
- If a referenced primitive isn't found in the registry, a warning is logged but the agent is still created.
50
-
51
- ## `StorageAgentType`
52
-
53
- When using `raw: true`, the returned object has the following structure:
54
-
55
- **id** (`string`): Unique identifier for the agent.
56
-
57
- **name** (`string`): Display name of the agent.
58
-
59
- **description** (`string`): Optional description of the agent.
60
-
61
- **instructions** (`string`): System instructions for the agent.
62
-
63
- **model** (`Record<string, unknown>`): Model configuration with provider and name.
64
-
65
- **tools** (`Record<string, unknown>`): Tool references to resolve from registry.
66
-
67
- **workflows** (`Record<string, unknown>`): Workflow references to resolve from registry.
68
-
69
- **agents** (`Record<string, unknown>`): Subagent references to resolve from registry.
70
-
71
- **memory** (`Record<string, unknown>`): Memory reference to resolve from registry.
72
-
73
- **scorers** (`Record<string, unknown>`): Scorer references with optional sampling config.
74
-
75
- **defaultOptions** (`Record<string, unknown>`): Default options passed to agent execution.
76
-
77
- **metadata** (`Record<string, unknown>`): Custom metadata stored with the agent.
78
-
79
- **createdAt** (`Date`): Timestamp when the agent was created.
80
-
81
- **updatedAt** (`Date`): Timestamp when the agent was last updated.
82
-
83
- ## Related
84
-
85
- - [Mastra.listStoredAgents()](https://mastra.ai/reference/core/listStoredAgents)
86
- - [Storage overview](https://mastra.ai/reference/storage/overview)
87
- - [Agents overview](https://mastra.ai/docs/agents/overview)
@@ -1,91 +0,0 @@
1
- # Mastra.listStoredAgents()
2
-
3
- The `.listStoredAgents()` method retrieves a paginated list of agent configurations from storage. By default, it returns executable `Agent` instances, but can also return raw storage data.
4
-
5
- ## Usage example
6
-
7
- ```typescript
8
- // Get Agent instances from storage
9
- const { agents, total, hasMore } = await mastra.listStoredAgents()
10
-
11
- for (const agent of agents) {
12
- console.log(agent.id, agent.name)
13
- // Each agent is ready to use
14
- // const response = await agent.generate("Hello");
15
- }
16
- ```
17
-
18
- ```typescript
19
- // Get paginated results with raw storage data
20
- const result = await mastra.listStoredAgents({
21
- page: 0,
22
- perPage: 10,
23
- raw: true,
24
- })
25
-
26
- console.log(`Showing ${result.agents.length} of ${result.total} agents`)
27
- console.log(`Has more: ${result.hasMore}`)
28
-
29
- for (const config of result.agents) {
30
- console.log(config.id, config.name, config.createdAt)
31
- }
32
- ```
33
-
34
- ## Parameters
35
-
36
- **args** (`object`): Optional configuration object for pagination and output format.
37
-
38
- **args.page** (`number`): Zero-indexed page number for pagination.
39
-
40
- **args.perPage** (`number | false`): Number of items per page. Set to \`false\` to fetch all records without pagination.
41
-
42
- **args.raw** (`boolean`): When \`true\`, returns raw \`StorageAgentType\` objects instead of \`Agent\` instances.
43
-
44
- ## Returns
45
-
46
- **agents** (`Agent[] | StorageAgentType[]`): Array of \`Agent\` instances by default, or \`StorageAgentType\` objects when \`raw: true\`.
47
-
48
- **total** (`number`): Total number of stored agents across all pages.
49
-
50
- **page** (`number`): Current page number (zero-indexed).
51
-
52
- **perPage** (`number | false`): Number of items per page, or \`false\` if fetching all.
53
-
54
- **hasMore** (`boolean`): Whether there are more pages available.
55
-
56
- ## Primitive resolution
57
-
58
- When creating `Agent` instances (default behavior), each stored agent's configuration is resolved against registered primitives:
59
-
60
- - **Tools**: Resolved from `tools` registered in Mastra config
61
- - **Workflows**: Resolved from `workflows` registered in Mastra config
62
- - **Subagents**: Resolved from `agents` registered in Mastra config
63
- - **Memory**: Resolved from `memory` registered in Mastra config
64
- - **Scorers**: Resolved from `scorers` registered in Mastra config
65
-
66
- If a referenced primitive isn't found, a warning is logged but the agent is still created.
67
-
68
- ## Example: Iterating through all stored agents
69
-
70
- ```typescript
71
- async function getAllStoredAgents(mastra: Mastra) {
72
- const allAgents: Agent[] = []
73
- let page = 0
74
- let hasMore = true
75
-
76
- while (hasMore) {
77
- const result = await mastra.listStoredAgents({ page, perPage: 50 })
78
- allAgents.push(...result.agents)
79
- hasMore = result.hasMore
80
- page++
81
- }
82
-
83
- return allAgents
84
- }
85
- ```
86
-
87
- ## Related
88
-
89
- - [Mastra.getStoredAgentById()](https://mastra.ai/reference/core/getStoredAgentById)
90
- - [Storage overview](https://mastra.ai/reference/storage/overview)
91
- - [Agents overview](https://mastra.ai/docs/agents/overview)