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

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 (166) hide show
  1. package/.docs/docs/agent-builder/integrations.md +2 -44
  2. package/.docs/docs/agent-builder/overview.md +3 -4
  3. package/.docs/docs/agent-builder/skill-registries.md +3 -1
  4. package/.docs/docs/agent-controller/overview.md +2 -3
  5. package/.docs/docs/agent-controller/session.md +3 -1
  6. package/.docs/docs/agents/a2a.md +1 -2
  7. package/.docs/docs/agents/channels.md +225 -0
  8. package/.docs/docs/agents/code-mode.md +1 -1
  9. package/.docs/docs/agents/file-based-agents.md +297 -0
  10. package/.docs/docs/agents/guardrails.md +9 -10
  11. package/.docs/docs/agents/overview.md +4 -4
  12. package/.docs/docs/agents/skills.md +5 -3
  13. package/.docs/docs/agents/structured-output.md +1 -1
  14. package/.docs/docs/agents/supervisor-agents.md +4 -3
  15. package/.docs/docs/agents/using-tools.md +4 -2
  16. package/.docs/docs/browser/agent-browser.md +3 -1
  17. package/.docs/docs/browser/browser-viewer.md +3 -1
  18. package/.docs/docs/browser/overview.md +1 -2
  19. package/.docs/docs/browser/stagehand.md +1 -1
  20. package/.docs/docs/deployment/mastra-server.md +4 -2
  21. package/.docs/docs/editor/overview.md +6 -2
  22. package/.docs/docs/editor/prompts.md +1 -1
  23. package/.docs/docs/editor/tools.md +5 -3
  24. package/.docs/docs/evals/custom-scorers.md +3 -1
  25. package/.docs/docs/evals/datasets/overview.md +5 -4
  26. package/.docs/docs/evals/datasets/running-experiments.md +2 -4
  27. package/.docs/docs/evals/evals-with-memory.md +3 -1
  28. package/.docs/docs/evals/gates-and-verdicts.md +3 -1
  29. package/.docs/docs/evals/overview.md +1 -4
  30. package/.docs/docs/evals/quick-checks.md +3 -1
  31. package/.docs/docs/long-running-agents/background-tasks.md +1 -1
  32. package/.docs/docs/long-running-agents/durable-agents.md +5 -3
  33. package/.docs/docs/long-running-agents/goals.md +3 -1
  34. package/.docs/docs/long-running-agents/signal-providers.md +3 -1
  35. package/.docs/docs/long-running-agents/signals.md +22 -11
  36. package/.docs/docs/mastra-platform/observability.md +1 -5
  37. package/.docs/docs/mcp/mcp-apps.md +3 -3
  38. package/.docs/docs/mcp/overview.md +10 -6
  39. package/.docs/docs/memory/observational-memory.md +1 -2
  40. package/.docs/docs/memory/overview.md +4 -6
  41. package/.docs/docs/memory/semantic-recall.md +1 -1
  42. package/.docs/docs/memory/working-memory.md +3 -3
  43. package/.docs/docs/observability/integrations/exporters/mastra-platform.md +3 -1
  44. package/.docs/docs/observability/logging.md +1 -1
  45. package/.docs/docs/observability/tracing/overview.md +1 -1
  46. package/.docs/docs/server/auth/auth0.md +1 -1
  47. package/.docs/docs/server/auth/better-auth.md +2 -2
  48. package/.docs/docs/server/auth/clerk.md +1 -1
  49. package/.docs/docs/server/auth/firebase.md +1 -1
  50. package/.docs/docs/server/auth/google.md +2 -2
  51. package/.docs/docs/server/auth/jwt.md +2 -2
  52. package/.docs/docs/server/auth/okta.md +2 -2
  53. package/.docs/docs/server/auth/workos.md +1 -1
  54. package/.docs/docs/server/mastra-client.md +1 -1
  55. package/.docs/docs/server/mastra-server.md +1 -1
  56. package/.docs/docs/server/pubsub.md +1 -1
  57. package/.docs/docs/server/request-context.md +4 -4
  58. package/.docs/docs/server/server-adapters.md +8 -8
  59. package/.docs/docs/studio/auth.md +3 -1
  60. package/.docs/docs/studio/overview.md +1 -1
  61. package/.docs/docs/voice/livekit.md +3 -100
  62. package/.docs/docs/workflows/agents-and-tools.md +5 -3
  63. package/.docs/docs/workflows/control-flow.md +3 -1
  64. package/.docs/docs/workflows/overview.md +7 -6
  65. package/.docs/docs/workspace/overview.md +1 -2
  66. package/.docs/docs/workspace/sandbox.md +0 -2
  67. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  68. package/.docs/guides/build-your-ui/copilotkit/overview.md +1 -1
  69. package/.docs/guides/concepts/streaming.md +3 -3
  70. package/.docs/guides/getting-started/quickstart.md +1 -3
  71. package/.docs/guides/guide/chef-michel.md +2 -0
  72. package/.docs/guides/guide/slack-assistant.md +2 -2
  73. package/.docs/guides/guide/stock-agent.md +2 -0
  74. package/.docs/models/environment-variables.md +0 -7
  75. package/.docs/models/gateways/netlify.md +1 -4
  76. package/.docs/models/gateways/openrouter.md +7 -10
  77. package/.docs/models/gateways/vercel.md +1 -8
  78. package/.docs/models/index.md +1 -1
  79. package/.docs/models/providers/abacus.md +14 -44
  80. package/.docs/models/providers/google.md +1 -2
  81. package/.docs/models/providers/llmgateway.md +181 -185
  82. package/.docs/models/providers/nano-gpt.md +2 -2
  83. package/.docs/models/providers/neon.md +29 -40
  84. package/.docs/models/providers/nvidia.md +3 -1
  85. package/.docs/models/providers/openai.md +1 -6
  86. package/.docs/models/providers/opencode.md +2 -6
  87. package/.docs/models/providers/poolside.md +5 -6
  88. package/.docs/models/providers/routing-run.md +34 -23
  89. package/.docs/models/providers/the-grid-ai.md +3 -3
  90. package/.docs/models/providers/wandb.md +14 -21
  91. package/.docs/models/providers/xai.md +1 -2
  92. package/.docs/models/providers.md +0 -7
  93. package/.docs/reference/agents/channels.md +2 -2
  94. package/.docs/reference/channels/channel-provider.md +1 -1
  95. package/.docs/reference/channels/slack-provider.md +2 -2
  96. package/.docs/reference/cli/mastra.md +10 -117
  97. package/.docs/reference/evals/create-scorer.md +0 -8
  98. package/.docs/reference/index.md +0 -17
  99. package/.docs/reference/memory/memory-class.md +1 -1
  100. package/.docs/reference/memory/serialized-memory-config.md +1 -1
  101. package/.docs/reference/project-structure.md +1 -1
  102. package/.docs/reference/pubsub/lease-provider.md +1 -1
  103. package/.docs/reference/server/express-adapter.md +3 -1
  104. package/.docs/reference/server/fastify-adapter.md +3 -1
  105. package/.docs/reference/server/hono-adapter.md +3 -1
  106. package/.docs/reference/server/koa-adapter.md +3 -1
  107. package/.docs/reference/server/nestjs-adapter.md +3 -1
  108. package/.docs/reference/storage/clickhouse.md +0 -32
  109. package/.docs/reference/storage/composite.md +1 -27
  110. package/.docs/reference/storage/retention.md +0 -11
  111. package/.docs/reference/tools/mcp-client.md +0 -22
  112. package/.docs/reference/tools/mcp-server.md +4 -161
  113. package/.docs/reference/voice/livekit.md +8 -272
  114. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +3 -1
  115. package/.docs/reference/workspace/agentfs-filesystem.md +3 -1
  116. package/.docs/reference/workspace/apple-container-sandbox.md +3 -1
  117. package/.docs/reference/workspace/archil-filesystem.md +3 -1
  118. package/.docs/reference/workspace/azure-blob-filesystem.md +3 -1
  119. package/.docs/reference/workspace/blaxel-sandbox.md +3 -1
  120. package/.docs/reference/workspace/daytona-sandbox.md +3 -1
  121. package/.docs/reference/workspace/docker-sandbox.md +3 -1
  122. package/.docs/reference/workspace/e2b-sandbox.md +3 -1
  123. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -1
  124. package/.docs/reference/workspace/gcs-filesystem.md +3 -1
  125. package/.docs/reference/workspace/google-drive-filesystem.md +3 -1
  126. package/.docs/reference/workspace/local-filesystem.md +3 -1
  127. package/.docs/reference/workspace/local-sandbox.md +3 -1
  128. package/.docs/reference/workspace/modal-sandbox.md +3 -1
  129. package/.docs/reference/workspace/railway-sandbox.md +3 -1
  130. package/.docs/reference/workspace/s3-filesystem.md +3 -1
  131. package/.docs/reference/workspace/vercel-sandbox.md +7 -5
  132. package/.docs/reference/workspace/vercel-serverless.md +3 -1
  133. package/CHANGELOG.md +0 -29
  134. package/package.json +5 -5
  135. package/.docs/docs/capabilities/channels/discord.md +0 -98
  136. package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
  137. package/.docs/docs/capabilities/channels/overview.md +0 -255
  138. package/.docs/docs/capabilities/channels/slack.md +0 -225
  139. package/.docs/docs/capabilities/channels/teams.md +0 -100
  140. package/.docs/docs/capabilities/channels/telegram.md +0 -98
  141. package/.docs/docs/capabilities/channels/whatsapp.md +0 -99
  142. package/.docs/docs/getting-started/file-based-agents.md +0 -116
  143. package/.docs/models/providers/crossmodel.md +0 -109
  144. package/.docs/models/providers/empiriolabs.md +0 -106
  145. package/.docs/models/providers/meta.md +0 -101
  146. package/.docs/models/providers/model-oracle-ai.md +0 -87
  147. package/.docs/models/providers/pioneer.md +0 -148
  148. package/.docs/models/providers/unorouter.md +0 -95
  149. package/.docs/models/providers/zenifra.md +0 -73
  150. package/.docs/reference/file-based-agents/config.md +0 -97
  151. package/.docs/reference/file-based-agents/instructions.md +0 -54
  152. package/.docs/reference/file-based-agents/logger.md +0 -26
  153. package/.docs/reference/file-based-agents/memory.md +0 -58
  154. package/.docs/reference/file-based-agents/observability.md +0 -32
  155. package/.docs/reference/file-based-agents/processors.md +0 -56
  156. package/.docs/reference/file-based-agents/scorers.md +0 -54
  157. package/.docs/reference/file-based-agents/server.md +0 -37
  158. package/.docs/reference/file-based-agents/skills.md +0 -56
  159. package/.docs/reference/file-based-agents/storage.md +0 -30
  160. package/.docs/reference/file-based-agents/studio.md +0 -56
  161. package/.docs/reference/file-based-agents/subagents.md +0 -123
  162. package/.docs/reference/file-based-agents/tools.md +0 -63
  163. package/.docs/reference/file-based-agents/workflows.md +0 -52
  164. package/.docs/reference/file-based-agents/workspace.md +0 -74
  165. package/.docs/reference/memory/summarizeConversation.md +0 -99
  166. package/.docs/reference/memory/summarizeThread.md +0 -93
@@ -1,26 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Logger
4
-
5
- Mastra sets the project's [logger](https://mastra.ai/docs/observability/logging) from a `logger.ts` file directly under `src/mastra/`. The file default-exports a logger, which replaces the built-in `ConsoleLogger` used across agents, workflows, and other components.
6
-
7
- Use this page for the file-based convention. For log levels, transports, and provider details, see [logging](https://mastra.ai/docs/observability/logging).
8
-
9
- ## Quickstart
10
-
11
- Create `src/mastra/logger.ts` and default-export a logger, such as [`PinoLogger`](https://mastra.ai/reference/logging/pino-logger):
12
-
13
- ```typescript
14
- import { PinoLogger } from '@mastra/loggers'
15
-
16
- export default new PinoLogger({
17
- name: 'Mastra',
18
- level: 'info',
19
- })
20
- ```
21
-
22
- Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they are wired up.
23
-
24
- ## Precedence with code
25
-
26
- Code-registered logging wins over `logger.ts`. If you pass `logger` to `new Mastra({ logger })` in `src/mastra/index.ts` (or set `logger: false` to disable logging), `logger.ts` is ignored with a warning. Use `logger.ts` when one project-wide logger is enough; use code registration when setup depends on runtime wiring.
@@ -1,58 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Memory
4
-
5
- A file-based agent gets [memory](https://mastra.ai/docs/memory/overview) from a `memory.ts` file that default-exports a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance. Use this page for the file-based convention; use the memory docs for message history, semantic recall, storage, and processors.
6
-
7
- Without `memory.ts` or `config.memory`, the agent has no memory by default. Each `generate()` or `stream()` call starts without remembered conversation state unless you pass the prior context yourself.
8
-
9
- ## Quickstart
10
-
11
- Create `memory.ts` next to the agent's `config.ts`:
12
-
13
- ```typescript
14
- import { Memory } from '@mastra/memory'
15
-
16
- export default new Memory()
17
- ```
18
-
19
- The exported instance becomes the agent's `memory`. If your app configures a storage provider on the main Mastra instance, memory data is stored there. See [storage](https://mastra.ai/docs/storage/overview) for more information.
20
-
21
- Use the same `resource` and `thread` values when calling the agent to continue a conversation:
22
-
23
- ```typescript
24
- const response = await weatherAgent.generate('Remember that I prefer Celsius.', {
25
- memory: {
26
- resource: 'user-123',
27
- thread: 'weather-chat',
28
- },
29
- })
30
- ```
31
-
32
- ## Configure memory
33
-
34
- Pass options to `new Memory()` when the default behavior isn't enough.
35
-
36
- ```typescript
37
- import { Memory } from '@mastra/memory'
38
-
39
- export default new Memory({
40
- options: {
41
- lastMessages: 20,
42
- workingMemory: {
43
- enabled: true,
44
- scope: 'resource',
45
- },
46
- },
47
- })
48
- ```
49
-
50
- Visit the [`Memory` reference](https://mastra.ai/reference/memory/memory-class) for constructor options. Use these pages for related memory features:
51
-
52
- - [Storage](https://mastra.ai/docs/storage/overview): configure persistence for memory data.
53
- - [Semantic recall](https://mastra.ai/docs/memory/semantic-recall): retrieve relevant past messages by semantic meaning.
54
- - [Memory processors](https://mastra.ai/docs/memory/memory-processors): filter, trim, or transform messages before memory adds them to model context.
55
-
56
- ## Precedence with config
57
-
58
- `config.memory` wins over `memory.ts`. If neither is present, the assembled file-based agent has no memory. See [`config.ts` precedence](https://mastra.ai/reference/file-based-agents/config) for the full merge table.
@@ -1,32 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # Observability
4
-
5
- Mastra configures [observability](https://mastra.ai/docs/observability/overview) from an `observability.ts` file directly under `src/mastra/`. The file default-exports an `Observability` instance that sets up tracing, logging, metrics, and feedback for the project.
6
-
7
- Use this page for the file-based convention. For the signal model, exporters, storage, and multi-config setup, see [Observability overview](https://mastra.ai/docs/observability/overview) and [Observability configuration](https://mastra.ai/docs/observability/config).
8
-
9
- ## Quickstart
10
-
11
- Create `src/mastra/observability.ts` and default-export an `Observability` instance:
12
-
13
- ```typescript
14
- import { MastraStorageExporter, Observability } from '@mastra/observability'
15
-
16
- export default new Observability({
17
- configs: {
18
- default: {
19
- serviceName: 'mastra',
20
- exporters: [new MastraStorageExporter()],
21
- },
22
- },
23
- })
24
- ```
25
-
26
- ## Observability and storage
27
-
28
- `observability.ts` configures which signals are collected and where they're exported. [`storage.ts`](https://mastra.ai/reference/file-based-agents/storage) configures the project store that can persist observability records. For storage support by signal, see [Observability storage](https://mastra.ai/docs/observability/storage).
29
-
30
- ## Precedence with code
31
-
32
- Code-registered observability wins over `observability.ts`. Use `observability.ts` when one project-wide configuration is enough; use code registration when setup depends on runtime wiring in `src/mastra/index.ts`.
@@ -1,56 +0,0 @@
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.
@@ -1,54 +0,0 @@
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.
@@ -1,37 +0,0 @@
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.
@@ -1,56 +0,0 @@
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.
@@ -1,30 +0,0 @@
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`.
@@ -1,56 +0,0 @@
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`.
@@ -1,123 +0,0 @@
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
- ```
@@ -1,63 +0,0 @@
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.
@@ -1,52 +0,0 @@
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.