@mastra/mcp-docs-server 1.2.7-alpha.1 → 1.2.7-alpha.12

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 (206) hide show
  1. package/.docs/docs/agent-builder/integrations.md +45 -3
  2. package/.docs/docs/agent-builder/overview.md +4 -3
  3. package/.docs/docs/agent-builder/skill-registries.md +1 -3
  4. package/.docs/docs/agent-controller/modes.md +1 -1
  5. package/.docs/docs/agent-controller/overview.md +4 -3
  6. package/.docs/docs/agent-controller/session.md +3 -5
  7. package/.docs/docs/agents/a2a.md +2 -1
  8. package/.docs/docs/agents/agent-approval.md +2 -2
  9. package/.docs/docs/agents/code-mode.md +1 -1
  10. package/.docs/docs/agents/guardrails.md +10 -9
  11. package/.docs/docs/agents/networks.md +1 -1
  12. package/.docs/docs/agents/overview.md +5 -5
  13. package/.docs/docs/agents/skills.md +3 -5
  14. package/.docs/docs/agents/structured-output.md +1 -1
  15. package/.docs/docs/agents/supervisor-agents.md +3 -4
  16. package/.docs/docs/agents/using-tools.md +2 -4
  17. package/.docs/docs/browser/agent-browser.md +1 -3
  18. package/.docs/docs/browser/browser-viewer.md +1 -3
  19. package/.docs/docs/browser/overview.md +2 -1
  20. package/.docs/docs/browser/recording.md +1 -1
  21. package/.docs/docs/browser/stagehand.md +1 -1
  22. package/.docs/docs/capabilities/channels/discord.md +98 -0
  23. package/.docs/docs/capabilities/channels/other-adapters.md +68 -0
  24. package/.docs/docs/capabilities/channels/overview.md +255 -0
  25. package/.docs/docs/capabilities/channels/slack.md +225 -0
  26. package/.docs/docs/capabilities/channels/teams.md +100 -0
  27. package/.docs/docs/capabilities/channels/telegram.md +98 -0
  28. package/.docs/docs/capabilities/channels/whatsapp.md +99 -0
  29. package/.docs/docs/deployment/mastra-server.md +2 -4
  30. package/.docs/docs/editor/overview.md +2 -6
  31. package/.docs/docs/editor/prompts.md +1 -1
  32. package/.docs/docs/editor/tools.md +3 -5
  33. package/.docs/docs/evals/built-in-scorers.md +2 -2
  34. package/.docs/docs/evals/custom-scorers.md +1 -3
  35. package/.docs/docs/evals/datasets/overview.md +4 -5
  36. package/.docs/docs/evals/datasets/running-experiments.md +10 -8
  37. package/.docs/docs/evals/evals-with-memory.md +1 -3
  38. package/.docs/docs/evals/gates-and-verdicts.md +2 -4
  39. package/.docs/docs/evals/overview.md +4 -1
  40. package/.docs/docs/evals/quick-checks.md +3 -5
  41. package/.docs/docs/getting-started/file-based-agents.md +116 -0
  42. package/.docs/docs/getting-started/manual-install.md +17 -4
  43. package/.docs/docs/index.md +1 -1
  44. package/.docs/docs/long-running-agents/background-tasks.md +3 -3
  45. package/.docs/docs/long-running-agents/durable-agents.md +5 -7
  46. package/.docs/docs/long-running-agents/goals.md +5 -7
  47. package/.docs/docs/long-running-agents/schedules.md +1 -1
  48. package/.docs/docs/long-running-agents/signal-providers.md +1 -3
  49. package/.docs/docs/long-running-agents/signals.md +12 -23
  50. package/.docs/docs/mastra-platform/database.md +2 -2
  51. package/.docs/docs/mastra-platform/github.md +1 -1
  52. package/.docs/docs/mastra-platform/observability.md +5 -1
  53. package/.docs/docs/mcp/mcp-apps.md +3 -3
  54. package/.docs/docs/mcp/overview.md +6 -10
  55. package/.docs/docs/memory/memory-processors.md +67 -0
  56. package/.docs/docs/memory/message-history.md +56 -2
  57. package/.docs/docs/memory/observational-memory.md +5 -4
  58. package/.docs/docs/memory/overview.md +8 -6
  59. package/.docs/docs/memory/semantic-recall.md +36 -2
  60. package/.docs/docs/memory/working-memory.md +3 -3
  61. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +1 -3
  62. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
  63. package/.docs/docs/observability/logging.md +1 -1
  64. package/.docs/docs/observability/tracing/overview.md +1 -1
  65. package/.docs/docs/rag/vector-databases.md +7 -2
  66. package/.docs/docs/server/auth/auth0.md +1 -1
  67. package/.docs/docs/server/auth/better-auth.md +2 -2
  68. package/.docs/docs/server/auth/clerk.md +1 -1
  69. package/.docs/docs/server/auth/firebase.md +1 -1
  70. package/.docs/docs/server/auth/google.md +3 -3
  71. package/.docs/docs/server/auth/jwt.md +2 -2
  72. package/.docs/docs/server/auth/okta.md +2 -2
  73. package/.docs/docs/server/auth/workos.md +1 -1
  74. package/.docs/docs/server/mastra-client.md +1 -1
  75. package/.docs/docs/server/mastra-server.md +1 -1
  76. package/.docs/docs/server/pubsub.md +1 -1
  77. package/.docs/docs/server/request-context.md +4 -4
  78. package/.docs/docs/server/server-adapters.md +8 -8
  79. package/.docs/docs/storage/overview.md +214 -0
  80. package/.docs/docs/studio/auth.md +1 -3
  81. package/.docs/docs/studio/overview.md +1 -1
  82. package/.docs/docs/voice/livekit.md +101 -4
  83. package/.docs/docs/workflows/agents-and-tools.md +3 -5
  84. package/.docs/docs/workflows/control-flow.md +1 -3
  85. package/.docs/docs/workflows/overview.md +6 -7
  86. package/.docs/docs/workflows/snapshots.md +1 -1
  87. package/.docs/docs/workspace/overview.md +2 -1
  88. package/.docs/docs/workspace/sandbox.md +2 -0
  89. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  90. package/.docs/guides/build-your-ui/copilotkit/channels.md +1 -1
  91. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +2 -2
  92. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  93. package/.docs/guides/concepts/streaming.md +3 -3
  94. package/.docs/guides/getting-started/quickstart.md +4 -2
  95. package/.docs/guides/guide/chef-michel.md +0 -2
  96. package/.docs/guides/guide/slack-assistant.md +2 -2
  97. package/.docs/guides/guide/stock-agent.md +0 -2
  98. package/.docs/models/embeddings.md +119 -0
  99. package/.docs/models/environment-variables.md +7 -0
  100. package/.docs/models/gateways/netlify.md +4 -1
  101. package/.docs/models/gateways/openrouter.md +10 -7
  102. package/.docs/models/gateways/vercel.md +8 -1
  103. package/.docs/models/index.md +1 -1
  104. package/.docs/models/providers/abacus.md +44 -14
  105. package/.docs/models/providers/crossmodel.md +109 -0
  106. package/.docs/models/providers/empiriolabs.md +106 -0
  107. package/.docs/models/providers/google.md +2 -1
  108. package/.docs/models/providers/llmgateway.md +185 -181
  109. package/.docs/models/providers/meta.md +101 -0
  110. package/.docs/models/providers/model-oracle-ai.md +87 -0
  111. package/.docs/models/providers/nano-gpt.md +2 -2
  112. package/.docs/models/providers/neon.md +40 -29
  113. package/.docs/models/providers/nvidia.md +1 -3
  114. package/.docs/models/providers/openai.md +6 -1
  115. package/.docs/models/providers/opencode.md +6 -2
  116. package/.docs/models/providers/pioneer.md +148 -0
  117. package/.docs/models/providers/poolside.md +6 -5
  118. package/.docs/models/providers/routing-run.md +23 -34
  119. package/.docs/models/providers/the-grid-ai.md +3 -3
  120. package/.docs/models/providers/unorouter.md +95 -0
  121. package/.docs/models/providers/wandb.md +21 -14
  122. package/.docs/models/providers/xai.md +2 -1
  123. package/.docs/models/providers/zenifra.md +73 -0
  124. package/.docs/models/providers.md +7 -0
  125. package/.docs/reference/agent-controller/agent-controller-class.md +3 -3
  126. package/.docs/reference/agent-controller/session.md +4 -4
  127. package/.docs/reference/agents/agent.md +1 -1
  128. package/.docs/reference/agents/channels.md +2 -2
  129. package/.docs/reference/agents/inngest-agent.md +1 -1
  130. package/.docs/reference/agents/listSkills.md +1 -1
  131. package/.docs/reference/agents/listSuspendedRuns.md +3 -3
  132. package/.docs/reference/auth/google.md +5 -5
  133. package/.docs/reference/channels/channel-provider.md +1 -1
  134. package/.docs/reference/channels/slack-provider.md +3 -3
  135. package/.docs/reference/cli/mastra.md +119 -12
  136. package/.docs/reference/code-sdk/mount-agent-controller.md +76 -0
  137. package/.docs/reference/coding-agent/create-coding-agent.md +1 -1
  138. package/.docs/reference/configuration.md +1 -1
  139. package/.docs/reference/evals/checks.md +4 -4
  140. package/.docs/reference/evals/create-scorer.md +8 -0
  141. package/.docs/reference/file-based-agents/config.md +97 -0
  142. package/.docs/reference/file-based-agents/instructions.md +54 -0
  143. package/.docs/reference/file-based-agents/logger.md +26 -0
  144. package/.docs/reference/file-based-agents/memory.md +58 -0
  145. package/.docs/reference/file-based-agents/observability.md +32 -0
  146. package/.docs/reference/file-based-agents/processors.md +56 -0
  147. package/.docs/reference/file-based-agents/scorers.md +54 -0
  148. package/.docs/reference/file-based-agents/server.md +37 -0
  149. package/.docs/reference/file-based-agents/skills.md +56 -0
  150. package/.docs/reference/file-based-agents/storage.md +30 -0
  151. package/.docs/reference/file-based-agents/studio.md +56 -0
  152. package/.docs/reference/file-based-agents/subagents.md +123 -0
  153. package/.docs/reference/file-based-agents/tools.md +63 -0
  154. package/.docs/reference/file-based-agents/workflows.md +52 -0
  155. package/.docs/reference/file-based-agents/workspace.md +74 -0
  156. package/.docs/reference/index.md +18 -0
  157. package/.docs/reference/memory/memory-class.md +1 -1
  158. package/.docs/reference/memory/observational-memory.md +1 -1
  159. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  160. package/.docs/reference/memory/summarizeConversation.md +99 -0
  161. package/.docs/reference/memory/summarizeThread.md +93 -0
  162. package/.docs/{docs/getting-started → reference}/project-structure.md +3 -10
  163. package/.docs/reference/pubsub/lease-provider.md +5 -5
  164. package/.docs/reference/server/express-adapter.md +1 -3
  165. package/.docs/reference/server/fastify-adapter.md +1 -3
  166. package/.docs/reference/server/hono-adapter.md +1 -3
  167. package/.docs/reference/server/koa-adapter.md +1 -3
  168. package/.docs/reference/server/nestjs-adapter.md +1 -3
  169. package/.docs/reference/signals/task-signal-provider.md +1 -1
  170. package/.docs/reference/storage/clickhouse.md +34 -2
  171. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  172. package/.docs/reference/storage/composite.md +64 -6
  173. package/.docs/reference/storage/convex.md +1 -1
  174. package/.docs/reference/storage/dynamodb.md +1 -1
  175. package/.docs/reference/storage/mongodb.md +46 -46
  176. package/.docs/reference/storage/retention.md +74 -6
  177. package/.docs/reference/tools/create-tool.md +2 -2
  178. package/.docs/reference/tools/mcp-client.md +22 -0
  179. package/.docs/reference/tools/mcp-server.md +161 -4
  180. package/.docs/reference/vectors/mongodb.md +93 -4
  181. package/.docs/reference/voice/livekit.md +272 -8
  182. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +1 -3
  183. package/.docs/reference/workspace/agentfs-filesystem.md +1 -3
  184. package/.docs/reference/workspace/apple-container-sandbox.md +6 -8
  185. package/.docs/reference/workspace/archil-filesystem.md +1 -3
  186. package/.docs/reference/workspace/azure-blob-filesystem.md +1 -3
  187. package/.docs/reference/workspace/blaxel-sandbox.md +1 -3
  188. package/.docs/reference/workspace/daytona-sandbox.md +1 -3
  189. package/.docs/reference/workspace/docker-sandbox.md +1 -3
  190. package/.docs/reference/workspace/e2b-sandbox.md +1 -3
  191. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -3
  192. package/.docs/reference/workspace/gcs-filesystem.md +1 -3
  193. package/.docs/reference/workspace/google-drive-filesystem.md +1 -3
  194. package/.docs/reference/workspace/local-filesystem.md +1 -3
  195. package/.docs/reference/workspace/local-sandbox.md +1 -3
  196. package/.docs/reference/workspace/mesa-filesystem.md +4 -4
  197. package/.docs/reference/workspace/modal-sandbox.md +1 -3
  198. package/.docs/reference/workspace/railway-sandbox.md +2 -4
  199. package/.docs/reference/workspace/s3-filesystem.md +1 -3
  200. package/.docs/reference/workspace/vercel-sandbox.md +5 -7
  201. package/.docs/reference/workspace/vercel-serverless.md +2 -4
  202. package/CHANGELOG.md +36 -0
  203. package/package.json +5 -5
  204. package/.docs/docs/agents/channels.md +0 -225
  205. package/.docs/docs/agents/file-based-agents.md +0 -297
  206. package/.docs/docs/memory/storage.md +0 -267
@@ -0,0 +1,56 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Processors
4
+
5
+ A file-based agent discovers [processors](https://mastra.ai/docs/agents/processors) from its `processors/` directory. Use this page for the file-based convention; use the processors guide for built-in processors, custom processors, streaming behavior, and advanced patterns.
6
+
7
+ Files under `processors/input/` run before messages reach the model. Files under `processors/output/` run after the model responds. Each file default-exports one [`Processor`](https://mastra.ai/reference/processors/processor-interface), and the filename becomes its discovery key.
8
+
9
+ ## Quickstart
10
+
11
+ Add an input processor by placing a processor file under `processors/input/`:
12
+
13
+ ```typescript
14
+ import { PIIDetector } from '@mastra/core/processors'
15
+
16
+ export default new PIIDetector({
17
+ strategy: 'block',
18
+ })
19
+ ```
20
+
21
+ This processor runs before user messages reach the model.
22
+
23
+ ## Add an output processor
24
+
25
+ Output processors are good for filtering or transforming model responses before they're returned. This example redacts PII from the final response.
26
+
27
+ ```typescript
28
+ import { PIIDetector } from '@mastra/core/processors'
29
+
30
+ export default new PIIDetector({
31
+ strategy: 'redact',
32
+ })
33
+ ```
34
+
35
+ ## Ordering
36
+
37
+ Discovered processors are added after any processors defined in [`config.ts`](https://mastra.ai/reference/file-based-agents/config). That means config processors run first.
38
+
39
+ ```text
40
+ config.inputProcessors → processors/input/* → model
41
+ model → config.outputProcessors → processors/output/* → response
42
+ ```
43
+
44
+ If `config.inputProcessors` or `config.outputProcessors` is a function, discovered processors of that type are ignored with a warning because function-valued processors can't be statically merged.
45
+
46
+ ## Precedence with config
47
+
48
+ Use `config.ts` for processors that need to be created dynamically or shared across agents. Use file-based processors for static, per-agent processors that should be reviewed alongside the agent.
49
+
50
+ Precedence is:
51
+
52
+ 1. Function-valued `config.inputProcessors` or `config.outputProcessors`
53
+ 2. Array-valued `config.inputProcessors` or `config.outputProcessors`
54
+ 3. Discovered files under `processors/input/` or `processors/output/`
55
+
56
+ Visit the [`Processor` reference](https://mastra.ai/reference/processors/processor-interface) for the full interface.
@@ -0,0 +1,54 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Scorers
4
+
5
+ A file-based agent discovers [scorers](https://mastra.ai/docs/evals/overview) from its `scorers/` directory. Use this page for the file-based convention; use the scorers guide for built-in scorers, custom scorers, and sampling.
6
+
7
+ Each file under `scorers/` default-exports one scorer, and the filename becomes its key. The default export is either a [`MastraScorer`](https://mastra.ai/reference/evals/create-scorer) or a `{ scorer, sampling }` entry.
8
+
9
+ ## Quickstart
10
+
11
+ Add a scorer by placing a file under the agent's `scorers/` directory. This example uses a [custom scorer](https://mastra.ai/docs/evals/custom-scorers):
12
+
13
+ ```typescript
14
+ import { createScorer } from '@mastra/core/evals'
15
+
16
+ export default createScorer({
17
+ id: 'relevance',
18
+ description: 'Scores how relevant the response is',
19
+ }).generateScore(() => 1)
20
+ ```
21
+
22
+ The scorer is registered on the `weather` agent under the key `relevance`, the same as adding it to `config.scorers`.
23
+
24
+ ## Sampling
25
+
26
+ To control how often a scorer runs, default-export a `{ scorer, sampling }` entry instead of a bare scorer:
27
+
28
+ ```typescript
29
+ import { createScorer } from '@mastra/core/evals'
30
+
31
+ const relevance = createScorer({
32
+ id: 'relevance',
33
+ description: 'Scores how relevant the response is',
34
+ }).generateScore(() => 1)
35
+
36
+ export default {
37
+ scorer: relevance,
38
+ sampling: { type: 'ratio', rate: 0.5 },
39
+ }
40
+ ```
41
+
42
+ ## Precedence with config
43
+
44
+ Discovered scorers are merged with the scorers defined in [`config.ts`](https://mastra.ai/reference/file-based-agents/config). On a key collision, `config.scorers` wins with a warning. If `config.scorers` is a function, discovered scorers are ignored with a warning because function-valued scorers can't be statically merged.
45
+
46
+ When keys collide, precedence is:
47
+
48
+ 1. Function-valued `config.scorers`
49
+ 2. Record-valued `config.scorers`
50
+ 3. Discovered files under `scorers/`
51
+
52
+ Non-colliding discovered scorers are preserved.
53
+
54
+ Visit [`createScorer()`](https://mastra.ai/reference/evals/create-scorer) for the full scorer interface.
@@ -0,0 +1,37 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Server
4
+
5
+ Mastra configures its HTTP [server](https://mastra.ai/docs/server/mastra-server) from a `server.ts` file directly under `src/mastra/`. The server exposes agents, workflows, and other registered primitives as REST endpoints, and the file default-exports the same `ServerConfig` shape you'd pass to [`new Mastra()`](https://mastra.ai/reference/core/mastra-class).
6
+
7
+ Use this page for the file-based convention. For server features, middleware, custom routes, generated API docs, and deployment behavior, see [Server overview](https://mastra.ai/docs/server/mastra-server).
8
+
9
+ ## Quickstart
10
+
11
+ Create `src/mastra/server.ts` and default-export a `ServerConfig` object:
12
+
13
+ ```typescript
14
+ import type { ServerConfig } from '@mastra/core/server'
15
+
16
+ export default {
17
+ port: 4111,
18
+ host: '0.0.0.0',
19
+ } satisfies ServerConfig
20
+ ```
21
+
22
+ ## Common configurations
23
+
24
+ `server.ts` can configure the same server options as code registration:
25
+
26
+ | Need | Use |
27
+ | ------------------------------------- | ----------------------------------------- |
28
+ | Bind to a deployment platform address | `host` and `port` |
29
+ | Restrict browser access | `cors` |
30
+ | Add webhooks or health checks | `apiRoutes` |
31
+ | Enable generated API docs | `build.openAPIDocs` and `build.swaggerUI` |
32
+
33
+ See [Mastra server](https://mastra.ai/docs/server/mastra-server), [middleware](https://mastra.ai/docs/server/middleware), and [custom API routes](https://mastra.ai/docs/server/custom-api-routes) for examples.
34
+
35
+ ## Precedence with code
36
+
37
+ Code-registered server config wins over `server.ts`. Routes added during startup, such as channel webhooks, are preserved when file-based server config is applied.
@@ -0,0 +1,56 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Skills
4
+
5
+ A file-based agent discovers skills from its `skills/` directory and bundles them at build time. Skills are reusable procedures or reference material that the agent can load when relevant, instead of putting every detail into the always-on prompt.
6
+
7
+ Use this page for the file-based convention. For code-defined skills, see [Agent skills](https://mastra.ai/docs/agents/skills). For the `SKILL.md` package format, see [Workspace skills](https://mastra.ai/docs/workspace/skills).
8
+
9
+ ## Quickstart
10
+
11
+ The simplest skill is one markdown file under `skills/`. The filename becomes the skill name, and `description` tells the agent when to load it.
12
+
13
+ ```markdown
14
+ ---
15
+ description: Use when reporting temperatures or comparing forecast units.
16
+ ---
17
+
18
+ Always report temperatures in Celsius and Fahrenheit. Include the user's preferred unit first when known.
19
+ ```
20
+
21
+ ## Skills vs tools vs instructions
22
+
23
+ | Need | Use | Why |
24
+ | ---------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
25
+ | Always-on identity, tone, or rules | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The model should see the guidance every turn. |
26
+ | Callable action with inputs and outputs | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | The model needs to execute code, call APIs, or perform side effects. |
27
+ | Detailed reference or procedure loaded when relevant | `skills/` | The model only needs the full guidance for specific tasks. |
28
+
29
+ ## Skill formats
30
+
31
+ Mastra supports three file-based skill formats:
32
+
33
+ | Format | Use it when |
34
+ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------- |
35
+ | TypeScript/JavaScript module | You want to default-export a [`createSkill()`](https://mastra.ai/reference/agents/createSkill) result from code. |
36
+ | Packaged `SKILL.md` directory | The skill has instructions plus supporting files under `references/`. |
37
+ | Flat markdown file | The skill is one markdown file with frontmatter and instructions. |
38
+
39
+ For packaged skills, `description` is required in `SKILL.md` frontmatter. Flat markdown skills also require `description` in frontmatter. Write when to use the skill, not only what the skill contains.
40
+
41
+ ## What gets loaded
42
+
43
+ File-based Agents skills are read at build time and added to the generated bundle. The deployed agent doesn't need to read those skill files from disk at runtime.
44
+
45
+ For packaged skills, Mastra reads:
46
+
47
+ - `SKILL.md` for metadata and instructions.
48
+ - Files directly under `references/` as supporting reference content.
49
+
50
+ Reference files are keyed by filename. Symlinked files and directories under `references/` are skipped during discovery.
51
+
52
+ ## Precedence with config
53
+
54
+ Discovered skills merge with any `skills` in [`config.ts`](https://mastra.ai/reference/file-based-agents/config). On a name collision, `config.skills` wins and a warning is logged.
55
+
56
+ If `config.skills` is a function, discovered skills are ignored with a warning because function-valued skills can't be statically merged.
@@ -0,0 +1,30 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Storage
4
+
5
+ Mastra sets the project's default [storage](https://mastra.ai/docs/storage/overview) from a `storage.ts` file directly under `src/mastra/`. The file default-exports a store, which replaces the built-in in-memory store used for memory, workflows, observability, and other storage domains.
6
+
7
+ Use this page for the file-based convention. For backend choice, storage domains, retention, and provider details, see [storage overview](https://mastra.ai/docs/storage/overview).
8
+
9
+ ## Quickstart
10
+
11
+ Use [`LibSQLStore`](https://mastra.ai/reference/storage/libsql) for a local file-backed store:
12
+
13
+ ```typescript
14
+ import { LibSQLStore } from '@mastra/libsql'
15
+
16
+ export default new LibSQLStore({
17
+ id: 'mastra-storage',
18
+ url: 'file:./mastra.db',
19
+ })
20
+ ```
21
+
22
+ Mastra registers the store before file-based agents and workflows, so storage-dependent primitives bind to this store instead of the default in-memory store.
23
+
24
+ ## Production backends
25
+
26
+ `storage.ts` can export any Mastra storage adapter, such as LibSQL, PostgreSQL, or MongoDB. For setup patterns, provider support, and schema details, see [storage overview](https://mastra.ai/docs/storage/overview), [observability storage](https://mastra.ai/docs/observability/storage), and the [storage reference](https://mastra.ai/reference/storage/overview).
27
+
28
+ ## Precedence with code
29
+
30
+ Code-registered storage wins over `storage.ts`. Use `storage.ts` when one project-wide store is enough; use code registration when setup depends on runtime wiring in `src/mastra/index.ts`.
@@ -0,0 +1,56 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Studio
4
+
5
+ Mastra configures [Studio](https://mastra.ai/docs/studio/overview) from a `studio.ts` file directly under `src/mastra/`. The file default-exports a `StudioConfig` object for Studio authentication and authorization: who can access Studio, and what authenticated users can do.
6
+
7
+ Use this page for the file-based convention. For auth providers, role-based access control (RBAC), and fine-grained authorization (FGA), see [Studio auth](https://mastra.ai/docs/studio/auth).
8
+
9
+ ## Quickstart
10
+
11
+ For local development, you don't need `studio.ts`. Start the dev server and open Studio:
12
+
13
+ **npm**:
14
+
15
+ ```bash
16
+ npm run dev
17
+ ```
18
+
19
+ **pnpm**:
20
+
21
+ ```bash
22
+ pnpm run dev
23
+ ```
24
+
25
+ **Yarn**:
26
+
27
+ ```bash
28
+ yarn dev
29
+ ```
30
+
31
+ **Bun**:
32
+
33
+ ```bash
34
+ bun run dev
35
+ ```
36
+
37
+ Studio opens without authentication in local development. Add `studio.ts` when you're ready to secure a shared or production deployment.
38
+
39
+ ## Add authentication
40
+
41
+ Use an auth provider to require sign-in before users can access Studio. This example uses [WorkOS](https://mastra.ai/docs/server/auth/workos):
42
+
43
+ ```typescript
44
+ import { MastraAuthWorkos } from '@mastra/auth-workos'
45
+ import type { StudioConfig } from '@mastra/core/server'
46
+
47
+ export default {
48
+ auth: new MastraAuthWorkos(),
49
+ } satisfies StudioConfig
50
+ ```
51
+
52
+ The auth provider handles who the user is. For what the user can do after sign-in, add RBAC or FGA in the same config. See [Studio auth](https://mastra.ai/docs/studio/auth) for full examples.
53
+
54
+ ## Precedence with code
55
+
56
+ Code-registered Studio config wins over `studio.ts`. Use `studio.ts` when one project-wide Studio config is enough; use code registration when auth depends on runtime wiring in `src/mastra/index.ts`.
@@ -0,0 +1,123 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Subagents
4
+
5
+ A file-based agent can declare **subagents**, specialist child agents it delegates to. The parent model sees each subagent as a delegation tool named after the subagent directory, calls that tool to hand off a task, and receives the subagent's result back in the parent conversation.
6
+
7
+ Use this page for the file-based convention. For broader delegation patterns, hooks, memory isolation, tool approval propagation, and scoring, see [Supervisor agents](https://mastra.ai/docs/agents/supervisor-agents).
8
+
9
+ ## Quickstart
10
+
11
+ Declare one directory per subagent under `subagents/`:
12
+
13
+ ```text
14
+ src/mastra/agents/
15
+ └── supervisor/
16
+ ├── config.ts
17
+ ├── instructions.md
18
+ └── subagents/
19
+ └── researcher/
20
+ ├── config.ts
21
+ ├── instructions.md
22
+ └── tools/
23
+ └── search.ts
24
+ ```
25
+
26
+ Mastra assembles `researcher` as its own agent and wires it into the supervisor's `agents` map. The parent model can delegate to it by using the generated `researcher` delegation tool.
27
+
28
+ A subagent's `config.ts` must set a non-empty `description`. The parent model reads this when deciding whether to delegate.
29
+
30
+ ```typescript
31
+ import { agentConfig } from '@mastra/core/agent'
32
+
33
+ export default agentConfig({
34
+ model: 'openai/gpt-5.5',
35
+ description: 'Researches a topic and returns cited findings.',
36
+ })
37
+ ```
38
+
39
+ ## How the model delegates
40
+
41
+ A subagent's `description` is routing text for the parent model. Write it like a [tool description](https://mastra.ai/reference/file-based-agents/tools): explain what the subagent does and when to delegate to it.
42
+
43
+ The build fails when a discovered subagent doesn't provide a non-empty description.
44
+
45
+ ## Isolation
46
+
47
+ Subagents are isolated. A subagent doesn't inherit its parent's tools, skills, workspace, memory, processors, or subagents. Each child is a self-contained agent with its own directory.
48
+
49
+ If multiple agents should share the same dependency, define it in code and assign it through each agent's config.
50
+
51
+ ## Nesting
52
+
53
+ Subagents can declare their own `subagents/` directories, nesting up to three levels below the top-level agent. A `subagents/` directory nested deeper is ignored with a warning.
54
+
55
+ ```text
56
+ src/mastra/agents/
57
+ └── supervisor/ # depth 0
58
+ └── subagents/
59
+ └── researcher/ # depth 1
60
+ └── subagents/
61
+ └── summarizer/ # depth 2
62
+ ```
63
+
64
+ ## Naming rules
65
+
66
+ - A subagent id that collides with one of the parent's tool keys is a build error.
67
+ - A duplicate subagent id under the same parent is a build error.
68
+ - If a subagent id also exists in the parent's `config.agents`, the `config.agents` entry wins and logs a warning.
69
+ - If `config.agents` is a function, discovered subagents are ignored with a warning because they can't be statically merged.
70
+
71
+ ## Example
72
+
73
+ This supervisor coordinates a research-and-writing flow. The `researcher` subagent owns search tools, while the `writer` subagent owns a workspace for drafting files.
74
+
75
+ ```text
76
+ src/mastra/agents/
77
+ └── research-supervisor/
78
+ ├── config.ts
79
+ ├── instructions.md
80
+ └── subagents/
81
+ ├── researcher/
82
+ │ ├── config.ts
83
+ │ ├── instructions.md
84
+ │ └── tools/
85
+ │ └── search_web.ts
86
+ └── writer/
87
+ ├── config.ts
88
+ ├── instructions.md
89
+ └── workspace/
90
+ └── draft-template.md
91
+ ```
92
+
93
+ ```typescript
94
+ import { agentConfig } from '@mastra/core/agent'
95
+
96
+ export default agentConfig({
97
+ model: 'openai/gpt-5.5',
98
+ })
99
+ ```
100
+
101
+ ```markdown
102
+ You coordinate research and writing.
103
+
104
+ Delegate fact gathering to `researcher`. Delegate final drafting to `writer`.
105
+ ```
106
+
107
+ ```typescript
108
+ import { agentConfig } from '@mastra/core/agent'
109
+
110
+ export default agentConfig({
111
+ model: 'openai/gpt-5-mini',
112
+ description: 'Use to gather facts, sources, and concise research notes for a topic.',
113
+ })
114
+ ```
115
+
116
+ ```typescript
117
+ import { agentConfig } from '@mastra/core/agent'
118
+
119
+ export default agentConfig({
120
+ model: 'openai/gpt-5.5',
121
+ description: 'Use to turn research notes into a structured draft.',
122
+ })
123
+ ```
@@ -0,0 +1,63 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Tools
4
+
5
+ A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time, the file must default-export a [`createTool()`](https://mastra.ai/reference/tools/create-tool) result, and the filename without its extension becomes the tool key the model can call.
6
+
7
+ Use this page for the file-based convention. For tool schemas, execution options, output shaping, and approval options, see the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool).
8
+
9
+ ## Quickstart
10
+
11
+ Place one tool per file under `tools/`. This file is exposed to the agent as `get_weather`.
12
+
13
+ ```typescript
14
+ import { createTool } from '@mastra/core/tools'
15
+ import { z } from 'zod'
16
+
17
+ export default createTool({
18
+ id: 'get_weather',
19
+ description: 'Get the current weather for a city.',
20
+ inputSchema: z.object({
21
+ city: z.string(),
22
+ }),
23
+ outputSchema: z.object({
24
+ city: z.string(),
25
+ tempC: z.number(),
26
+ }),
27
+ execute: async ({ context }) => {
28
+ return { city: context.city, tempC: 21 }
29
+ },
30
+ })
31
+ ```
32
+
33
+ ## Organizing tools
34
+
35
+ Use one file per tool. Name the file after the action the model should take:
36
+
37
+ - Use `get_weather.ts`, `search_docs.ts`, or `create_ticket.ts`.
38
+ - Avoid vague names like `helper.ts`, `api.ts`, or `utils.ts`.
39
+ - Co-locate tests next to the tool as `*.test.ts` or `*.spec.ts`; discovery ignores those files.
40
+ - Keep shared helper code outside `tools/` or in files that don't match the discovered extensions under `tools/`.
41
+
42
+ Because nested directories aren't discovered as tools, group related tools with clear filename prefixes instead of subfolders, such as `calendar_create_event.ts` and `calendar_list_events.ts`.
43
+
44
+ ## Tool options
45
+
46
+ The file-based convention only controls where the tool lives and how it's registered. The tool API still comes from `createTool()`:
47
+
48
+ - Use `description` to tell the model when to call the tool.
49
+ - Use `inputSchema` and `outputSchema` for structured inputs and outputs.
50
+ - Use `toModelOutput` when the model should see a different shape than the raw value returned from `execute`.
51
+ - Use `requireApproval` when a tool needs human confirmation before execution.
52
+
53
+ See the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool) for all options and [tool approval](https://mastra.ai/docs/agent-controller/tool-approvals) for the approval flow.
54
+
55
+ ## Runtime boundary
56
+
57
+ Tool code runs in your app/server runtime when the agent calls the tool. If a tool needs filesystem or shell isolation, call [workspace](https://mastra.ai/reference/file-based-agents/workspace) or sandbox APIs explicitly.
58
+
59
+ ## Precedence with config
60
+
61
+ Discovered tools merge with any `tools` in [`config.ts`](https://mastra.ai/reference/file-based-agents/config). On a key collision, `config.tools` wins and a warning is logged.
62
+
63
+ If `config.tools` is a function, discovered tools are ignored with a warning because function-valued tools can't be statically merged.
@@ -0,0 +1,52 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Workflows
4
+
5
+ Mastra discovers project-level workflows from `.ts` and `.js` files under `src/mastra/workflows/`. This convention isn't scoped to one agent: every file with a default export becomes a registered workflow, and the filename becomes the workflow key.
6
+
7
+ Use this page for the file-based convention. For steps, schemas, control flow, streaming, state, and workflow execution, see [Workflows overview](https://mastra.ai/docs/workflows/overview).
8
+
9
+ ## Quickstart
10
+
11
+ Create a file under `src/mastra/workflows/`, build the workflow with [`createWorkflow()`](https://mastra.ai/reference/workflows/workflow), and default-export it.
12
+
13
+ ```typescript
14
+ import { createStep, createWorkflow } from '@mastra/core/workflows'
15
+ import { z } from 'zod'
16
+
17
+ const collectInputs = createStep({
18
+ id: 'collect-inputs',
19
+ inputSchema: z.object({ topic: z.string() }),
20
+ outputSchema: z.object({ topic: z.string(), audience: z.string() }),
21
+ execute: async ({ inputData }) => ({
22
+ topic: inputData.topic,
23
+ audience: 'engineering',
24
+ }),
25
+ })
26
+
27
+ const writeSummary = createStep({
28
+ id: 'write-summary',
29
+ inputSchema: z.object({ topic: z.string(), audience: z.string() }),
30
+ outputSchema: z.object({ report: z.string() }),
31
+ execute: async ({ inputData }) => ({
32
+ report: `Daily report about ${inputData.topic} for ${inputData.audience}.`,
33
+ }),
34
+ })
35
+
36
+ const dailyReport = createWorkflow({
37
+ id: 'daily-report',
38
+ inputSchema: z.object({ topic: z.string() }),
39
+ outputSchema: z.object({ report: z.string() }),
40
+ })
41
+ .then(collectInputs)
42
+ .then(writeSummary)
43
+ .commit()
44
+
45
+ export default dailyReport
46
+ ```
47
+
48
+ Mastra registers this workflow under the `daily-report` key.
49
+
50
+ ## Precedence with code
51
+
52
+ File-based workflows merge with workflows registered in [`new Mastra()`](https://mastra.ai/reference/core/mastra-class). On a key collision, the code-registered workflow wins.
@@ -0,0 +1,74 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Workspace
4
+
5
+ A [workspace](https://mastra.ai/docs/workspace/overview) gives an agent filesystem access and command execution. File-based agents get a default workspace automatically when discovered through `mastra dev` or `mastra build`, so they can read and write files and run shell commands without extra configuration.
6
+
7
+ Use this page for the file-based convention. For workspace providers, tools, search, lifecycle, and sandbox details, see [Workspaces](https://mastra.ai/docs/workspace/overview).
8
+
9
+ ## Default workspace
10
+
11
+ Without `workspace.ts`, a file-based agent gets a default [`Workspace`](https://mastra.ai/reference/workspace/workspace-class) when the build provides a per-agent workspace path. The default workspace uses:
12
+
13
+ - [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) rooted at the agent's bundled workspace directory.
14
+ - [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) with the same working directory.
15
+
16
+ This gives the agent file tools and shell tools automatically. The default workspace is per agent; subagents get nested workspace directories under their parent agent's workspace path.
17
+
18
+ ## Quickstart
19
+
20
+ For the default workspace, don't add a file. Start with an agent directory like this:
21
+
22
+ ```text
23
+ src/mastra/agents/weather/
24
+ ├── config.ts
25
+ └── instructions.md
26
+ ```
27
+
28
+ Add `workspace.ts` only when you need to customize the workspace:
29
+
30
+ ```typescript
31
+ import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace'
32
+
33
+ export default new Workspace({
34
+ name: 'weather-workspace',
35
+ filesystem: new LocalFilesystem({ basePath: './data/weather' }),
36
+ sandbox: new LocalSandbox({ workingDirectory: './data/weather' }),
37
+ })
38
+ ```
39
+
40
+ Visit the [`Workspace` reference](https://mastra.ai/reference/workspace/workspace-class) for the full config.
41
+
42
+ ## When to customize the workspace
43
+
44
+ Customize the workspace when the default local directory isn't enough. Common reasons include:
45
+
46
+ - Point file tools at a different filesystem root.
47
+ - Run shell commands in a different sandbox provider.
48
+ - Add workspace search with BM25 or vector search.
49
+ - Share one workspace across multiple agents.
50
+
51
+ For provider patterns and runtime behavior, see the [workspace overview](https://mastra.ai/docs/workspace/overview), [sandbox guide](https://mastra.ai/docs/workspace/sandbox), and [workspace search](https://mastra.ai/docs/workspace/search).
52
+
53
+ ## Runtime boundary
54
+
55
+ The workspace filesystem controls what file tools can read and write. The sandbox controls where shell commands run. Application runtime code, including code in [`tools/`](https://mastra.ai/reference/file-based-agents/tools), still runs in your app/server process unless it explicitly calls workspace or sandbox APIs.
56
+
57
+ ## Seed files
58
+
59
+ Add a `workspace/` directory to ship starting files with the agent. Mastra mirrors files under `workspace/` into the agent's default runtime workspace at build time, so the agent starts with those files on disk.
60
+
61
+ ```text
62
+ src/mastra/agents/weather/
63
+ ├── config.ts
64
+ └── workspace/
65
+ ├── README.md
66
+ └── data/
67
+ └── cities.json
68
+ ```
69
+
70
+ The files are copied into the bundled workspace path, where workspace file tools and sandbox commands can read them. Symlinked seed files are skipped during mirroring.
71
+
72
+ ## Precedence with config
73
+
74
+ `config.workspace` wins over `workspace.ts`; otherwise the default file-based workspace is used. See [`config.ts` precedence](https://mastra.ai/reference/file-based-agents/config) for the full merge table.
@@ -76,6 +76,7 @@ The Reference section provides documentation of Mastra's API, including paramete
76
76
  - [Tools API](https://mastra.ai/reference/client-js/tools)
77
77
  - [Vectors API](https://mastra.ai/reference/client-js/vectors)
78
78
  - [Workflows API](https://mastra.ai/reference/client-js/workflows)
79
+ - [mountAgentControllerOnMastra()](https://mastra.ai/reference/code-sdk/mount-agent-controller)
79
80
  - [buildBasePrompt()](https://mastra.ai/reference/coding-agent/build-base-prompt)
80
81
  - [createCodingAgent()](https://mastra.ai/reference/coding-agent/create-coding-agent)
81
82
  - [Mastra Class](https://mastra.ai/reference/core/mastra-class)
@@ -174,17 +175,34 @@ The Reference section provides documentation of Mastra's API, including paramete
174
175
  - [.startExperimentAsync()](https://mastra.ai/reference/datasets/startExperimentAsync)
175
176
  - [.update()](https://mastra.ai/reference/datasets/update)
176
177
  - [.updateItem()](https://mastra.ai/reference/datasets/updateItem)
178
+ - [config.ts](https://mastra.ai/reference/file-based-agents/config)
179
+ - [Instructions](https://mastra.ai/reference/file-based-agents/instructions)
180
+ - [Logger](https://mastra.ai/reference/file-based-agents/logger)
181
+ - [Memory](https://mastra.ai/reference/file-based-agents/memory)
182
+ - [Observability](https://mastra.ai/reference/file-based-agents/observability)
183
+ - [Processors](https://mastra.ai/reference/file-based-agents/processors)
184
+ - [Scorers](https://mastra.ai/reference/file-based-agents/scorers)
185
+ - [Server](https://mastra.ai/reference/file-based-agents/server)
186
+ - [Skills](https://mastra.ai/reference/file-based-agents/skills)
187
+ - [Storage](https://mastra.ai/reference/file-based-agents/storage)
188
+ - [Studio](https://mastra.ai/reference/file-based-agents/studio)
189
+ - [Subagents](https://mastra.ai/reference/file-based-agents/subagents)
190
+ - [Tools](https://mastra.ai/reference/file-based-agents/tools)
191
+ - [Workflows](https://mastra.ai/reference/file-based-agents/workflows)
192
+ - [Workspace](https://mastra.ai/reference/file-based-agents/workspace)
177
193
  - [API Reference](https://mastra.ai/reference/mastra-platform/api)
178
194
  - [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
179
195
  - [Memory Class](https://mastra.ai/reference/memory/memory-class)
180
196
  - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
181
197
  - [SerializedMemoryConfig](https://mastra.ai/reference/memory/serialized-memory-config)
198
+ - [summarizeConversation()](https://mastra.ai/reference/memory/summarizeConversation)
182
199
  - [.cloneThread()](https://mastra.ai/reference/memory/cloneThread)
183
200
  - [.createThread()](https://mastra.ai/reference/memory/createThread)
184
201
  - [.deleteMessages()](https://mastra.ai/reference/memory/deleteMessages)
185
202
  - [.getThreadById()](https://mastra.ai/reference/memory/getThreadById)
186
203
  - [.listThreads()](https://mastra.ai/reference/memory/listThreads)
187
204
  - [.recall()](https://mastra.ai/reference/memory/recall)
205
+ - [.summarizeThread()](https://mastra.ai/reference/memory/summarizeThread)
188
206
  - [Feedback](https://mastra.ai/reference/observability/feedback)
189
207
  - [PinoLogger](https://mastra.ai/reference/logging/pino-logger)
190
208
  - [Automatic Metrics](https://mastra.ai/reference/observability/metrics/automatic-metrics)
@@ -37,7 +37,7 @@ export const agent = new Agent({
37
37
 
38
38
  **options** (`MemoryConfig`): Memory configuration options.
39
39
 
40
- **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable loading conversation history into context. Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To prevent saving new messages, use the readOnly option instead.
40
+ **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable the message history feature entirely (messages are not loaded into context or saved). Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To load messages without saving new ones, use the readOnly option.
41
41
 
42
42
  **options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
43
43