@mastra/mcp-docs-server 1.3.5-alpha.8 → 1.3.5

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 (106) hide show
  1. package/.docs/docs/agents/code-mode.md +0 -2
  2. package/.docs/docs/agents/overview.md +1 -1
  3. package/.docs/docs/agents/processors.md +8 -0
  4. package/.docs/docs/agents/tools.md +17 -0
  5. package/.docs/docs/auth/composite-auth.md +1 -1
  6. package/.docs/docs/auth/custom-auth-provider.md +28 -22
  7. package/.docs/docs/auth/jwt.md +1 -1
  8. package/.docs/docs/auth/overview.md +2 -2
  9. package/.docs/docs/auth/simple-auth.md +6 -1
  10. package/.docs/docs/browser.md +1 -2
  11. package/.docs/docs/deployment/overview.md +1 -1
  12. package/.docs/docs/deployment/web-framework.md +1 -1
  13. package/.docs/docs/develop.md +1 -3
  14. package/.docs/docs/evals/built-in-scorers.md +2 -2
  15. package/.docs/docs/guides/context-engineering.md +0 -2
  16. package/.docs/docs/guides/overview.md +15 -0
  17. package/.docs/docs/harness/agent-controller.md +7 -12
  18. package/.docs/docs/harness/goals.md +1 -3
  19. package/.docs/docs/harness/schedules.md +0 -2
  20. package/.docs/docs/harness/signal-providers.md +1 -3
  21. package/.docs/docs/harness/signals.md +0 -2
  22. package/.docs/docs/mastra-platform/configuration.md +1 -1
  23. package/.docs/docs/mastra-platform/environments.md +1 -1
  24. package/.docs/docs/mastra-platform/observability.md +1 -1
  25. package/.docs/docs/memory/observational-memory.md +2 -0
  26. package/.docs/docs/observability/overview.md +0 -5
  27. package/.docs/docs/sandbox/filesystem.md +12 -12
  28. package/.docs/docs/studio/observability.md +1 -1
  29. package/.docs/docs/workflows/error-handling.md +2 -0
  30. package/.docs/integrations/voice/livekit.md +449 -2
  31. package/.docs/models/gateways/neon.md +2 -1
  32. package/.docs/models/gateways/netlify.md +1 -1
  33. package/.docs/models/gateways/openrouter.md +3 -4
  34. package/.docs/models/gateways/vercel.md +10 -3
  35. package/.docs/models/index.md +1 -1
  36. package/.docs/models/providers/aki-io.md +12 -12
  37. package/.docs/models/providers/blueclaw.md +8 -9
  38. package/.docs/models/providers/coralbricks.md +6 -4
  39. package/.docs/models/providers/cortecs.md +5 -11
  40. package/.docs/models/providers/deepinfra.md +1 -1
  41. package/.docs/models/providers/edenai.md +16 -12
  42. package/.docs/models/providers/kilo.md +13 -15
  43. package/.docs/models/providers/llmgateway-providers.md +6 -2
  44. package/.docs/models/providers/llmgateway.md +3 -2
  45. package/.docs/models/providers/mistral.md +7 -6
  46. package/.docs/models/providers/nano-gpt.md +13 -4
  47. package/.docs/models/providers/opencode-go.md +2 -2
  48. package/.docs/models/providers/opencode.md +3 -1
  49. package/.docs/models/providers/requesty.md +3 -1
  50. package/.docs/models/providers/subconscious.md +8 -8
  51. package/.docs/models/providers/the-grid-ai.md +19 -12
  52. package/.docs/models/providers/umans-ai-coding-plan.md +2 -1
  53. package/.docs/models/providers/umans-ai.md +2 -1
  54. package/.docs/models/providers/wandb.md +4 -13
  55. package/.docs/reference/agent-controller/agent-controller-class.md +2 -4
  56. package/.docs/reference/agent-controller/session.md +18 -13
  57. package/.docs/reference/agents/createSkill.md +1 -2
  58. package/.docs/reference/agents/generate.md +2 -0
  59. package/.docs/reference/agents/getModel.md +1 -1
  60. package/.docs/reference/agents/getSkill.md +6 -1
  61. package/.docs/reference/agents/listSkills.md +0 -1
  62. package/.docs/reference/auth/jwt.md +1 -1
  63. package/.docs/reference/auth/supabase.md +1 -1
  64. package/.docs/reference/browser/mastra-browser.md +13 -11
  65. package/.docs/reference/cli/create-mastra.md +1 -1
  66. package/.docs/reference/cli/mastra.md +43 -5
  67. package/.docs/reference/client-js/agent-controller.md +19 -3
  68. package/.docs/reference/client-js/agents.md +1 -1
  69. package/.docs/reference/client-js/conversations.md +1 -1
  70. package/.docs/reference/client-js/mastra-client.md +2 -2
  71. package/.docs/reference/client-js/observability.md +28 -0
  72. package/.docs/reference/client-js/workflows.md +18 -2
  73. package/.docs/reference/code-sdk/acp-server.md +19 -2
  74. package/.docs/reference/code-sdk/mount-agent-controller.md +1 -3
  75. package/.docs/reference/editor/prompt-blocks.md +41 -0
  76. package/.docs/reference/editor/tool-provider.md +19 -0
  77. package/.docs/reference/file-based-agents/config.md +0 -2
  78. package/.docs/reference/file-based-agents/instructions.md +0 -2
  79. package/.docs/reference/file-based-agents/logger.md +0 -2
  80. package/.docs/reference/file-based-agents/memory.md +0 -2
  81. package/.docs/reference/file-based-agents/observability.md +0 -2
  82. package/.docs/reference/file-based-agents/processors.md +0 -2
  83. package/.docs/reference/file-based-agents/schedules.md +0 -2
  84. package/.docs/reference/file-based-agents/scorers.md +0 -2
  85. package/.docs/reference/file-based-agents/server.md +0 -2
  86. package/.docs/reference/file-based-agents/skills.md +0 -2
  87. package/.docs/reference/file-based-agents/storage.md +0 -2
  88. package/.docs/reference/file-based-agents/studio.md +0 -2
  89. package/.docs/reference/file-based-agents/subagents.md +0 -2
  90. package/.docs/reference/file-based-agents/tools.md +0 -2
  91. package/.docs/reference/file-based-agents/workflows.md +0 -2
  92. package/.docs/reference/file-based-agents/workspace.md +0 -2
  93. package/.docs/reference/memory/observational-memory.md +2 -0
  94. package/.docs/reference/observability/tracing/interfaces.md +62 -2
  95. package/.docs/reference/observability/tracing/trace-query.md +65 -4
  96. package/.docs/reference/schedules/overview.md +0 -2
  97. package/.docs/reference/signals/create-notification-inbox-tool.md +0 -2
  98. package/.docs/reference/signals/signal-provider.md +1 -3
  99. package/.docs/reference/signals/task-signal-provider.md +1 -1
  100. package/.docs/reference/signals/webhook-signal-provider.md +1 -3
  101. package/.docs/reference/streaming/ChunkType.md +2 -0
  102. package/.docs/reference/tools/create-code-mode.md +0 -2
  103. package/.docs/reference/tools/create-tool.md +2 -0
  104. package/.docs/reference/tools/mcp-server.md +8 -2
  105. package/.docs/reference/vectors/lance.md +56 -10
  106. package/package.json +6 -6
@@ -428,7 +428,7 @@ mastra deploy --env staging --yes
428
428
 
429
429
  Manages environments on Mastra platform. Environments are deploy targets (for example `production`, `staging`, `preview-42`) that belong to a project. The current organization is resolved from stored credentials.
430
430
 
431
- Every subcommand resolves its project in a fixed order. It first checks the `MASTRA_PROJECT_ID` environment variable and the `--project <name|slug|id>` flag. It then reads the `.mastra-project.json` file written by [`mastra deploy`](#mastra-deploy) in the current directory. Run from your project directory and you never need to name the project.
431
+ Every subcommand resolves its project in a fixed order. It first checks the `--project <name|slug|id>` flag, then the `MASTRA_PROJECT_ID` environment variable. It then reads the `.mastra-project.json` file written by [`mastra deploy`](#mastra-deploy) in the current directory. Run from your project directory and you never need to name the project.
432
432
 
433
433
  ### `mastra env list`
434
434
 
@@ -790,7 +790,7 @@ Organization ID. Can also be set via the `MASTRA_ORG_ID` environment variable.
790
790
 
791
791
  #### `--project`
792
792
 
793
- Project ID or slug when `MASTRA_PROJECT_ID` isn't set. Slugs are resolved against projects in the current organization.
793
+ Project ID or slug. Takes precedence over `MASTRA_PROJECT_ID`. Slugs are resolved against projects in the current organization.
794
794
 
795
795
  #### `-c, --config`
796
796
 
@@ -858,7 +858,7 @@ The file defaults to `.env` when no argument is given. All values are double-quo
858
858
 
859
859
  #### `--project`
860
860
 
861
- Project ID or slug. Overrides the linked project when `MASTRA_PROJECT_ID` isn't set.
861
+ Project ID or slug. Takes precedence over `MASTRA_PROJECT_ID` and the linked project.
862
862
 
863
863
  #### CI usage
864
864
 
@@ -913,6 +913,44 @@ Revokes an API token.
913
913
  mastra auth tokens revoke <token-id>
914
914
  ```
915
915
 
916
+ ## `mastra connect`
917
+
918
+ Manages provider connections for the linked platform project, so agents using `@mastra/connect` pick up provider toolsets without leaving the terminal.
919
+
920
+ The target project resolves from the `--project` flag, the `MASTRA_PROJECT_ID` environment variable, or the `.mastra-project.json` written by `mastra deploy`, in that order. All subcommands accept `--project <name|slug|id>`.
921
+
922
+ ### `mastra connect list`
923
+
924
+ Lists the available providers. Providers already connected to the project are shown in green, and unconnected providers are shown in grey.
925
+
926
+ ```bash
927
+ mastra connect list
928
+ ```
929
+
930
+ ### `mastra connect add`
931
+
932
+ Connects a provider to the project. When the organization already has connections for the provider that aren't attached to the project, the command lists them and lets you attach an existing connection or create a new one. With no existing connections it goes straight to the provider's auth flow.
933
+
934
+ OAuth providers open the provider's consent screen in your browser, while API key and Basic auth providers prompt for credentials in the terminal. Providers with other auth types open a hosted connect page. The command waits until the connection becomes active before exiting.
935
+
936
+ Once a new connection is active, the command offers to set a display name so you can tell connections to the same provider apart. It lists the provider's existing connections, suggests a name that doesn't collide with them, and asks for confirmation if the chosen name duplicates another connection's name. Leave the field blank to skip naming.
937
+
938
+ ```bash
939
+ mastra connect add <provider>
940
+ ```
941
+
942
+ Pass `--yes` to skip all prompts. This always creates a new connection without a display name, even when existing connections could be reused.
943
+
944
+ ### `mastra connect remove`
945
+
946
+ Unlinks a provider's connection from the project. The organization-level connection is kept and can be re-attached later.
947
+
948
+ ```bash
949
+ mastra connect remove <provider>
950
+ ```
951
+
952
+ When a provider has multiple connections, the command prompts for which one to remove. Pass `--yes` to skip confirmation. Without a terminal, or with `--yes`, removing several connections at once requires `--all`, and `--connection <id>` removes a single one.
953
+
916
954
  ## `mastra lint`
917
955
 
918
956
  The `mastra lint` command validates the structure and code of your Mastra project.
@@ -1100,7 +1138,7 @@ See [Import existing traces](https://mastra.ai/docs/mastra-platform/observabilit
1100
1138
 
1101
1139
  #### `--project <name|slug|id>`
1102
1140
 
1103
- Selects the destination Mastra Platform project. `MASTRA_PROJECT_ID` takes precedence when set. Without either value, the command uses the project linked in `.mastra-project.json`.
1141
+ Selects the destination Mastra Platform project. Takes precedence over `MASTRA_PROJECT_ID`. Without either value, the command uses the project linked in `.mastra-project.json`.
1104
1142
 
1105
1143
  #### `--from <date>`
1106
1144
 
@@ -1136,7 +1174,7 @@ The command loads `.env` and `.env.local` from the current directory.
1136
1174
  | `MASTRA_API_TOKEN` | For headless authentication | Mastra Platform API token. Without it, the command uses credentials from `mastra auth login`. |
1137
1175
  | `MASTRA_ORG_ID` | With `MASTRA_API_TOKEN` | Organization that owns the destination project. |
1138
1176
  | `MASTRA_PLATFORM_ACCESS_TOKEN` | For upload and read-back with interactive login | Mastra Platform access token for the destination. Not required for `--dry-run` or when `MASTRA_API_TOKEN` is set. |
1139
- | `MASTRA_PROJECT_ID` | When no project is otherwise linked | Destination project ID. Takes precedence over `--project`. |
1177
+ | `MASTRA_PROJECT_ID` | When no project is otherwise linked | Destination project ID. The `--project` flag takes precedence over it. |
1140
1178
 
1141
1179
  ### Examples
1142
1180
 
@@ -39,12 +39,22 @@ Retrieve the agent controllers hosted on the connected Mastra instance:
39
39
  const controllers = await client.listAgentControllers()
40
40
  ```
41
41
 
42
+ Each entry's `id` is the key the controller is registered under in `new Mastra({ agentControllers })`, not the controller's own `id`.
43
+
42
44
  ## Working with a specific agent controller
43
45
 
44
- Get an instance of an agent controller by the ID it's registered under:
46
+ Get an instance of an agent controller by the key it's registered under in `new Mastra({ agentControllers })`. The key can differ from the controller's `id`. In this example, pass `'coding'`, not `'coding-controller'`:
47
+
48
+ ```typescript
49
+ const codingController = new AgentController({ id: 'coding-controller', agent, modes })
50
+
51
+ export const mastra = new Mastra({
52
+ agentControllers: { coding: codingController },
53
+ })
54
+ ```
45
55
 
46
56
  ```typescript
47
- const controller = client.getAgentController('coding-controller')
57
+ const controller = client.getAgentController('coding')
48
58
  ```
49
59
 
50
60
  ### `listModes()`
@@ -155,7 +165,13 @@ Switches the active mode.
155
165
 
156
166
  ### `switchModel(modelId, options?)`
157
167
 
158
- Switches the model. `options.scope` is `'thread'` (default) or `'global'`. `options.modeId` targets a specific mode.
168
+ Switches the session's active model and persists it as the current model for the active thread. Switching modes doesn't change it. Pass `{ thinkingLevel }` as the second argument to apply and persist a thinking level with the model.
169
+
170
+ ```typescript
171
+ await session.switchModel('anthropic/claude-sonnet-4-6', {
172
+ thinkingLevel: 'high',
173
+ })
174
+ ```
159
175
 
160
176
  ### `listThreads(options?)`
161
177
 
@@ -1040,7 +1040,7 @@ console.log(diff.changes) // Fields that changed between versions
1040
1040
  In the React SDK, pass an `agentVersionId` through `requestContext` when using the `useChat` hook:
1041
1041
 
1042
1042
  ```typescript
1043
- import { useChat } from '@mastra/react'
1043
+ import { useChat } from '@mastra/react/chat'
1044
1044
 
1045
1045
  function Chat() {
1046
1046
  const { messages, input, handleInputChange, handleSubmit } = useChat({
@@ -122,7 +122,7 @@ console.log(items.data)
122
122
  - `data`: Conversation items such as `message`, `function_call`, and `function_call_output`
123
123
  - `first_id`: The first item ID in the page
124
124
  - `last_id`: The last item ID in the page
125
- - `has_more`: Whether more items exist beyond the current page
125
+ - `has_more`: Currently always `false`. `items.list()` returns up to 1000 items in a single response.
126
126
 
127
127
  ## Parameters
128
128
 
@@ -59,9 +59,9 @@ You can also pass `requestContext` as a `Record<string, any>`.
59
59
 
60
60
  **getAgent(agentId)** (`Agent`): Retrieves a specific agent instance by ID.
61
61
 
62
- **listAgentControllers()** (`Promise<AgentControllerInfo[]>`): Returns the agent controllers hosted on the connected Mastra instance.
62
+ **listAgentControllers()** (`Promise<AgentControllerInfo[]>`): Returns the agent controllers hosted on the connected Mastra instance. Each entry's id is the key the controller is registered under in new Mastra({ agentControllers }).
63
63
 
64
- **getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by ID. .session(resourceId) returns a session client; call await session.create() to create or resume the server session.
64
+ **getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by the key it is registered under in new Mastra({ agentControllers }), which can differ from the controller id. .session(resourceId) returns a session client; call await session.create() to create or resume the server session.
65
65
 
66
66
  **listMemoryThreads(params)** (`Promise<StorageThreadType[]>`): Retrieves memory threads for the specified resource and agent. Requires a resourceId and an agentId.
67
67
 
@@ -217,6 +217,34 @@ The API limits predicate depth, nodes, related clauses, set members, literal byt
217
217
 
218
218
  See [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for the complete limits, request fields, predicates, thread qualification semantics, cursor pagination, response shapes, and errors.
219
219
 
220
+ ## Querying spans
221
+
222
+ `querySpans()` returns one row per matching completed span across traces. Use it to list the spans themselves. `queryTraces()` with a `spans.some` predicate returns the traces that contain a matching span instead. Every query requires an ISO timestamp range of at most 31 days.
223
+
224
+ ```typescript
225
+ const result = await mastraClient.querySpans({
226
+ timeRange: {
227
+ from: '2026-10-01T00:00:00.000Z',
228
+ to: '2026-10-02T00:00:00.000Z',
229
+ },
230
+ where: {
231
+ op: 'eq',
232
+ left: { path: 'spanType' },
233
+ right: { literal: 'tool_call' },
234
+ },
235
+ orderBy: [{ field: 'startedAt', direction: 'desc' }],
236
+ page: { limit: 50 },
237
+ })
238
+
239
+ // { spans: [{ traceId, spanId, name, spanType, status, durationMs, cost, ... }], page: { next } }
240
+ ```
241
+
242
+ Pass `result.page.next` back as `page.after` with the same time range, filter, and ordering to load the next page. Each row contains identifiers, display fields, input and output previews, and the span's model cost. Use `getSpan()` to load the full span.
243
+
244
+ Span queries are optional for observability stores. Check `capabilities.spanQuery` from `getObservabilityCapabilities()` before calling `querySpans()`, and treat a missing value as unsupported. Unsupported servers reject with `501 SPAN_QUERY_UNSUPPORTED`.
245
+
246
+ See [Query individual spans](https://mastra.ai/reference/observability/tracing/trace-query) for filters, ordering, cursors, cost states, limits, and errors.
247
+
220
248
  ## Deleting traces
221
249
 
222
250
  Delete traces and their associated spans, metrics, logs, scores, and feedback:
@@ -223,9 +223,25 @@ A workflow run result yields the following:
223
223
 
224
224
  **runId** (`string`): Unique identifier for this workflow run instance
225
225
 
226
- **eventTimestamp** (`Date`): The timestamp of the event
226
+ **workflowName** (`string`): Name of the workflow this run belongs to
227
227
 
228
- **payload** (`object`): Contains currentStep (id, status, output, payload) and workflowState (status, steps record)
228
+ **resourceId** (`string`): Resource ID associated with the run, if one was set
229
+
230
+ **createdAt** (`string`): ISO 8601 timestamp of when the run was created
231
+
232
+ **updatedAt** (`string`): ISO 8601 timestamp of when the run was last updated
233
+
234
+ **status** (`WorkflowRunStatus`): Current status of the run, such as 'running', 'success', 'failed', 'suspended', 'waiting', or 'canceled'
235
+
236
+ **payload** (`Record<string, any>`): Input data the run was started with
237
+
238
+ **result** (`Record<string, any>`): Final output of the workflow when the run succeeded
239
+
240
+ **error** (`SerializedError`): Error details when the run failed
241
+
242
+ **steps** (`Record<string, WorkflowStateStepResult>`): Per-step results, including status, output, payload, and timing
243
+
244
+ Use the `fields` option to limit which optional fields are returned. Metadata fields and `status` are always included.
229
245
 
230
246
  ## Dynamic workflows
231
247
 
@@ -25,10 +25,27 @@ A client that accepts command and argument fields can use:
25
25
  }
26
26
  ```
27
27
 
28
- Configure provider authentication in Mastra Code before starting the client, or supply API keys in the server process's environment. ACP sessions don't load project `.env` files into the shared process environment. The server doesn't offer interactive ACP authentication.
29
-
30
28
  After initialization, the client calls `session/new` with an absolute `cwd` and an `mcpServers` array. The response includes the session ID and configuration choices. Send that ID with subsequent prompts and configuration requests.
31
29
 
30
+ ## Authentication
31
+
32
+ `session/new` returns an `auth_required` error when no model provider is configured, so clients can offer the methods from the `initialize` response:
33
+
34
+ | Method ID | Type | Behavior |
35
+ | ------------------ | -------- | ---------------------------------------------------------------------------------------------- |
36
+ | `openai-codex` | Agent | Opens the browser to sign in with a ChatGPT Plus or Pro subscription. |
37
+ | `kimi-for-coding` | Agent | Opens the browser to approve a Kimi For Coding device sign-in. |
38
+ | `xai` | Agent | Opens the browser to approve an xAI device sign-in. |
39
+ | `anthropic` | Terminal | Runs `mastracode login --provider anthropic` to sign in with a Claude Pro or Max subscription. |
40
+ | `github-copilot` | Terminal | Runs `mastracode login --provider github-copilot` to sign in with GitHub Copilot. |
41
+ | `mastracode-login` | Terminal | Runs `mastracode login` to choose any provider or save an API key. |
42
+
43
+ Terminal methods are offered only to clients that advertise terminal authentication.
44
+
45
+ For agent methods, `authenticate` runs the sign-in inside the server process and returns after the credentials are saved. If a provider needs typed input, such as a code to paste, the request fails and asks you to run `mastracode login` in a terminal.
46
+
47
+ API keys in the server process's environment also count as a configured provider. ACP sessions don't load project `.env` files into the shared process environment. New sessions pick up saved credentials without restarting the server. When the default model's provider isn't configured, a new session starts on the default model of a provider that is, such as `anthropic/claude-fable-5` after an Anthropic sign-in.
48
+
32
49
  ## `acpMain(options?)`
33
50
 
34
51
  To start the same server from an SDK entry point:
@@ -4,8 +4,6 @@
4
4
 
5
5
  # mountAgentControllerOnMastra()
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller (the coding agent behind [Mastra Code](https://code.mastra.ai), with its modes, tools, memory, and thread management) and registers it on a server-owned [Mastra](https://mastra.ai/reference/core/mastra-class) instance. Use it to serve the Mastra Code agent to your own UI (web app, editor, bot): each client creates or resumes its own isolated session through the returned [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class).
10
8
 
11
9
  To construct the `Mastra` instance yourself (for example in a deployable entry file), use `prepareAgentControllerMount()` from the same package, which returns the constructor args plus a `finalize()` callback.
@@ -60,7 +58,7 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
60
58
 
61
59
  **mastra** (`Mastra`): Existing Mastra instance to mount onto. When omitted, a Mastra is created that owns the controller storage.
62
60
 
63
- **controllerId** (`string`): Id under which the controller is registered on the Mastra instance.
61
+ **controllerId** (`string`): Key the controller is registered under on the Mastra instance. Clients pass this key to client.getAgentController(). (Default: `controller.id`)
64
62
 
65
63
  **modes** (`AgentControllerMode[]`): Override agent modes (model ids, colors, which modes exist). (Default: `build/plan/fast`)
66
64
 
@@ -92,6 +92,47 @@ Dot paths are supported. An empty group evaluates to `true`, and an unknown oper
92
92
 
93
93
  Blocks without conditions are always included.
94
94
 
95
+ A `prompt_block_ref` can also have its own `rules`. They apply only to that reference in that agent, so you can reuse one stored block under different conditions. If the stored block has rules too, both must pass.
96
+
97
+ ### Runtime slot with a fallback
98
+
99
+ Combine an inline `prompt_block` and a conditional `prompt_block_ref` to insert a value from request context and fall back to a shared stored block when the value is missing:
100
+
101
+ ```typescript
102
+ await editor.agent.update({
103
+ id: 'support-agent',
104
+ instructions: [
105
+ { type: 'text', content: 'Follow the platform safety policy.' },
106
+ {
107
+ type: 'prompt_block',
108
+ content: '{{userPrompt}}',
109
+ rules: {
110
+ operator: 'AND',
111
+ conditions: [
112
+ { field: 'userPrompt', operator: 'exists' },
113
+ { field: 'userPrompt', operator: 'not_equals', value: '' },
114
+ ],
115
+ },
116
+ },
117
+ {
118
+ type: 'prompt_block_ref',
119
+ id: 'default-user-prompt',
120
+ rules: {
121
+ operator: 'OR',
122
+ conditions: [
123
+ { field: 'userPrompt', operator: 'not_exists' },
124
+ { field: 'userPrompt', operator: 'equals', value: '' },
125
+ ],
126
+ },
127
+ },
128
+ ],
129
+ })
130
+ ```
131
+
132
+ When the request context contains a non-empty `userPrompt`, the agent receives that value. Otherwise, it receives the published `default-user-prompt` block. The stored block doesn't need to know about `userPrompt`.
133
+
134
+ > **Note:** The `exists` operator treats an empty string as present. The extra `''` conditions make an empty `userPrompt` use the fallback too.
135
+
95
136
  ## Programmatic API
96
137
 
97
138
  Access prompt blocks through `mastra.getEditor().prompt`. See the [`prompt` namespace](https://mastra.ai/reference/editor/mastra-editor) for complete method signatures.
@@ -81,6 +81,8 @@ const editor = new MastraEditor({
81
81
 
82
82
  **userIdResolver** (`ComposioUserIdResolver`): Server-side resolver that derives the effective Composio userId from authenticated context fields. Used for invoker and caller-supplied execution. The exact connected account always comes from the stored connection pin.
83
83
 
84
+ **sharedConnections** (`{ acl?: ComposioSharedAccountAcl }`): Opt in to Composio SHARED connected accounts. When set, connections authorized with scope: 'shared' are created as Composio SHARED accounts. acl accepts allowAllUsers, allowedUserIds, and notAllowedUserIds. Omit acl to keep Composio's deny-by-default access.
85
+
84
86
  ### Tool slugs
85
87
 
86
88
  Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MESSAGE`.
@@ -125,6 +127,23 @@ export const mastra = new Mastra({ editor })
125
127
 
126
128
  Configure the agent with an invoker connection pinned to `ca_alice_salesforce`. When Bob invokes the agent, Mastra sends `bob` as the Composio user and the pinned account ID as the exact connected account. The Memory resource stays `project_123`. Composio then checks whether the account's ACL permits Bob to execute it.
127
129
 
130
+ ### Create shared accounts
131
+
132
+ Set `sharedConnections` to create Composio [SHARED accounts](https://docs.composio.dev/docs/shared-connections) for connections authorized with `scope: 'shared'`:
133
+
134
+ ```typescript
135
+ new ComposioToolProvider({
136
+ apiKey: process.env.COMPOSIO_API_KEY!,
137
+ sharedConnections: {
138
+ acl: { allowAllUsers: true, notAllowedUserIds: ['contractor_1'] },
139
+ },
140
+ })
141
+ ```
142
+
143
+ Without `sharedConnections`, shared-scope connections are Composio PRIVATE accounts under the `shared` user. Composio doesn't support SHARED accounts for toolkits that require custom connection fields, so authorization fails for those toolkits instead of creating a PRIVATE account.
144
+
145
+ `listConnections()` returns the requested users' PRIVATE and SHARED accounts, plus SHARED accounts owned by other users whose ACL grants access to one of the requested users. You can pin these accounts like any other connected account.
146
+
128
147
  ### Map application users to Composio users
129
148
 
130
149
  Use `userIdResolver` when your Composio user IDs differ from the IDs returned by Mastra authentication, or when your application must authorize the stored account pin before execution.
@@ -4,8 +4,6 @@
4
4
 
5
5
  # config.ts
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  An agent's `config.ts` sets its model and runtime options. Use it for options that belong to the [`Agent`](https://mastra.ai/reference/agents/agent) itself, while sibling files provide instructions, tools, skills, et cetera.
10
8
 
11
9
  ## What belongs in `config.ts`
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Instructions
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  An agent's instructions hold its always-on system prompt: the model reads it on every turn. Use them to define the agent's identity, tone, role, and standing rules.
10
8
 
11
9
  Write them in one of two files at the agent root. Use `instructions.md` when the prompt is fixed text. Use `instructions.ts` when the prompt needs code, for example when it's built from shared constants or resolved per request.
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Logger
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  Use this page for the file-based convention. For log levels, transports, and provider details, see [logging](https://mastra.ai/docs/observability/logging).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Memory
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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.
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Observability
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  Use this page for the file-based convention. For the signal model, exporters, storage, and multi-config setup, see the [observability overview](https://mastra.ai/docs/observability/overview) and [observability configuration](https://mastra.ai/docs/observability/overview).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Processors
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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.
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Schedules
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  A file-based agent discovers **schedules** from its `schedules/` directory. Each file declares one recurring task: a cron expression plus what the agent should do when it fires. Mastra registers them into schedule storage at startup. A scheduled agent needs no runtime registration code.
10
8
 
11
9
  Use this page for the file-based convention. To create schedules at runtime instead, see [Schedules](https://mastra.ai/reference/schedules/overview).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Scorers
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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.
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Server
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  Mastra configures its HTTP [server](https://mastra.ai/docs/server/overview) 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).
10
8
 
11
9
  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/overview).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Skills
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  Use this page for the file-based convention. For code-defined skills, see [Agent skills](https://mastra.ai/docs/skills). For the `SKILL.md` package format, see [Workspace skills](https://mastra.ai/docs/sandbox/skills).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Storage
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  Mastra sets the project's default [storage](https://mastra.ai/docs/storage) 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.
10
8
 
11
9
  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).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Studio
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Subagents
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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 and calls that tool to hand off a task. The subagent's result returns to the parent conversation.
10
8
 
11
9
  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/subagents).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Tools
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Workflows
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  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.
10
8
 
11
9
  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).
@@ -4,8 +4,6 @@
4
4
 
5
5
  # Workspace
6
6
 
7
- > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
-
9
7
  A [workspace](https://mastra.ai/docs/sandbox/overview) assembles capabilities such as filesystem access and command execution. The configured backends determine which tools are available. File-based agents get a default workspace automatically when discovered through `mastra dev` or `mastra build`. This default includes filesystem access and command execution, so agents can read and write files and run shell commands without extra configuration.
10
8
 
11
9
  Use this page for the file-based convention. For workspace providers, tools, search, lifecycle, and sandbox details, see [Sandbox](https://mastra.ai/docs/sandbox/overview).
@@ -592,6 +592,8 @@ Emitted when observation or reflection fails. The system falls back to synchrono
592
592
 
593
593
  **error** (`string`): Error message.
594
594
 
595
+ **retrying** (`true`): Set when a reflection attempt did not compress below its target and OM is retrying at a higher compression level. A new start marker follows, so this failure is not final. Absent on final failures.
596
+
595
597
  **observations** (`string`): Any partial content available for display.
596
598
 
597
599
  **recordId** (`string`): The OM record ID.
@@ -557,8 +557,8 @@ interface ModelGenerationAttributes {
557
557
  /**
558
558
  * Definitions of the tools made available to the model for this generation
559
559
  * (name, description, and JSON-schema parameters), captured once per
560
- * generation. Per-step tool names live on MODEL_INFERENCE spans as
561
- * `availableTools`.
560
+ * generation. The definitions sent on each provider call live on
561
+ * MODEL_INFERENCE spans as `tools`.
562
562
  */
563
563
  tools?: ModelToolDefinition[]
564
564
 
@@ -639,6 +639,66 @@ interface ModelStepAttributes {
639
639
  }
640
640
  ```
641
641
 
642
+ ### `ModelInferenceAttributes`
643
+
644
+ Model Inference attributes - for a single call to the model provider within a step. The span covers only the provider call, so it doesn't include processors or tool executions.
645
+
646
+ ```typescript
647
+ interface ModelInferenceAttributes {
648
+ /** Model name (e.g., 'gpt-5.4', 'claude-opus-4-6') */
649
+ model?: string
650
+
651
+ /** Model provider (e.g., 'openai', 'anthropic') */
652
+ provider?: string
653
+
654
+ /** Index of the parent step in the generation (0, 1, 2, ...) */
655
+ stepIndex?: number
656
+
657
+ /** Token usage statistics */
658
+ usage?: UsageStats
659
+
660
+ /** Reason this inference finished (stop, tool-calls, length, etc.) */
661
+ finishReason?: string
662
+
663
+ /** Whether this was a streaming response */
664
+ streaming?: boolean
665
+
666
+ /** When the first token/chunk of the completion was received */
667
+ completionStartTime?: Date
668
+
669
+ /** Result warnings */
670
+ warnings?: Record<string, any>
671
+
672
+ /** Actual model used in the response (may differ from request model) */
673
+ responseModel?: string
674
+
675
+ /** Unique identifier for the response */
676
+ responseId?: string
677
+
678
+ /** Model parameters sent on the request (temperature, maxOutputTokens, topP, etc.) */
679
+ parameters?: Record<string, unknown>
680
+
681
+ /** Provider-specific options forwarded on the request */
682
+ providerOptions?: Record<string, unknown>
683
+
684
+ /** Names of tools made available to the model on this inference call */
685
+ availableTools?: string[]
686
+
687
+ /**
688
+ * Definitions of the tools sent to the provider on this inference call
689
+ * (name, description, and JSON-schema parameters), after per-step changes
690
+ * from processors, `prepareStep`, `activeTools`, and `toolChoice`.
691
+ */
692
+ tools?: ModelToolDefinition[]
693
+
694
+ /** How the model was instructed to choose tools */
695
+ toolChoice?: 'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }
696
+
697
+ /** Requested response format */
698
+ responseFormat?: 'text' | 'json' | 'json_schema' | { type: string; name?: string }
699
+ }
700
+ ```
701
+
642
702
  ### `ModelChunkAttributes`
643
703
 
644
704
  Model Chunk attributes - for individual streaming chunks/events.