@mastra/mcp-docs-server 1.2.16 → 1.2.17-alpha.11

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 (86) hide show
  1. package/.docs/docs/agents/agent-approval.md +2 -0
  2. package/.docs/docs/agents/code-mode.md +2 -2
  3. package/.docs/docs/agents/processors.md +1 -1
  4. package/.docs/docs/agents/skills.md +1 -1
  5. package/.docs/docs/agents/using-tools.md +1 -1
  6. package/.docs/docs/capabilities/channels.md +34 -1
  7. package/.docs/docs/datasets/running-experiments.md +46 -0
  8. package/.docs/docs/harness/agent-controller.md +1 -1
  9. package/.docs/docs/mcp/overview.md +4 -5
  10. package/.docs/docs/server/request-context.md +21 -0
  11. package/.docs/docs/studio/overview.md +1 -1
  12. package/.docs/docs/workspace/filesystem.md +182 -153
  13. package/.docs/docs/workspace/lsp.md +4 -5
  14. package/.docs/docs/workspace/sandbox.md +234 -141
  15. package/.docs/docs/workspace/search.md +52 -4
  16. package/.docs/docs/workspace/skills.md +62 -33
  17. package/.docs/integrations/browsers/browser-viewer.md +2 -2
  18. package/.docs/integrations/databases/postgresql.md +2 -1
  19. package/.docs/integrations/file-storage/amazon-s3.md +1 -1
  20. package/.docs/integrations/file-storage/azure-blob.md +1 -1
  21. package/.docs/integrations/file-storage/google-cloud-storage.md +1 -1
  22. package/.docs/integrations/file-storage/mesa.md +1 -1
  23. package/.docs/integrations/file-storage/vercel-files.md +1 -1
  24. package/.docs/integrations/observability/opentelemetry.md +34 -2
  25. package/.docs/integrations/sandboxes/apple-container.md +1 -1
  26. package/.docs/integrations/sandboxes/daytona.md +1 -1
  27. package/.docs/integrations/sandboxes/docker.md +1 -1
  28. package/.docs/integrations/sandboxes/e2b.md +1 -1
  29. package/.docs/integrations/sandboxes/modal.md +1 -1
  30. package/.docs/models/environment-variables.md +1 -0
  31. package/.docs/models/gateways/openrouter.md +3 -1
  32. package/.docs/models/gateways/vercel.md +3 -2
  33. package/.docs/models/index.md +1 -1
  34. package/.docs/models/providers/abacus.md +14 -1
  35. package/.docs/models/providers/baseten.md +2 -1
  36. package/.docs/models/providers/cloudflare-workers-ai.md +3 -1
  37. package/.docs/models/providers/cortecs.md +5 -2
  38. package/.docs/models/providers/crossmodel.md +2 -2
  39. package/.docs/models/providers/crusoe.md +80 -0
  40. package/.docs/models/providers/deepinfra.md +5 -1
  41. package/.docs/models/providers/edenai.md +227 -23
  42. package/.docs/models/providers/empiriolabs.md +2 -1
  43. package/.docs/models/providers/fireworks-ai.md +26 -20
  44. package/.docs/models/providers/huggingface.md +6 -1
  45. package/.docs/models/providers/hyper.md +8 -7
  46. package/.docs/models/providers/kilo.md +14 -12
  47. package/.docs/models/providers/llmgateway.md +3 -2
  48. package/.docs/models/providers/merge-gateway.md +4 -1
  49. package/.docs/models/providers/nano-gpt.md +13 -10
  50. package/.docs/models/providers/nvidia.md +2 -1
  51. package/.docs/models/providers/ofox.md +32 -1
  52. package/.docs/models/providers/opencode-go.md +2 -1
  53. package/.docs/models/providers/opencode.md +3 -1
  54. package/.docs/models/providers/perplexity-agent.md +4 -2
  55. package/.docs/models/providers/qvac.md +35 -0
  56. package/.docs/models/providers/requesty.md +5 -3
  57. package/.docs/models/providers/zai-coding-plan.md +3 -2
  58. package/.docs/models/providers/zhipuai-coding-plan.md +2 -1
  59. package/.docs/models/providers.md +1 -0
  60. package/.docs/reference/agent-controller/agent-controller-class.md +26 -1
  61. package/.docs/reference/browser/browser-viewer.md +1 -1
  62. package/.docs/reference/configuration.md +1 -1
  63. package/.docs/reference/core/removeWorkspace.md +1 -1
  64. package/.docs/reference/datasets/addItem.md +5 -0
  65. package/.docs/reference/datasets/addItems.md +12 -2
  66. package/.docs/reference/datasets/startExperiment.md +1 -1
  67. package/.docs/reference/datasets/updateItem.md +3 -0
  68. package/.docs/reference/file-based-agents/workspace.md +3 -3
  69. package/.docs/reference/memory/observational-memory.md +4 -0
  70. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +2 -0
  71. package/.docs/reference/processors/provider-history-compat.md +6 -5
  72. package/.docs/reference/processors/skill-search-processor.md +1 -1
  73. package/.docs/reference/pubsub/base.md +13 -3
  74. package/.docs/reference/pubsub/caching-pubsub.md +2 -0
  75. package/.docs/reference/pubsub/event-emitter.md +2 -0
  76. package/.docs/reference/pubsub/redis-streams.md +11 -3
  77. package/.docs/reference/tools/create-code-mode.md +1 -1
  78. package/.docs/reference/tools/create-tool.md +11 -3
  79. package/.docs/reference/tools/mcp-client.md +34 -5
  80. package/.docs/reference/tools/mcp-server.md +4 -1
  81. package/.docs/reference/workspace/local-filesystem.md +1 -1
  82. package/.docs/reference/workspace/local-sandbox.md +1 -1
  83. package/.docs/reference/workspace/workspace-class.md +52 -15
  84. package/CHANGELOG.md +50 -0
  85. package/package.json +4 -4
  86. package/.docs/docs/workspace/overview.md +0 -416
@@ -391,6 +391,8 @@ const agent = new Agent({
391
391
 
392
392
  When enabled, the agent detects suspended tools from message history on the next user message. It extracts `resumeData` based on the tool's `resumeSchema`, then automatically resumes the tool.
393
393
 
394
+ Automatic resumption applies to data-bearing `suspend()` flows. It doesn't approve tools that use `requireApproval`; those tools remain suspended until an explicit approval or decline is submitted through `approveToolCall()`, `declineToolCall()`, `resumeStream({ approved: boolean })`, or an equivalent UI or API action.
395
+
394
396
  The following example shows a complete conversational flow:
395
397
 
396
398
  ```typescript
@@ -29,7 +29,7 @@ Each turn adds the full tool response to the agent's context window which can le
29
29
 
30
30
  With code mode, your tools keep running on the host with full validation, request context, and tracing. Only the model's orchestration code runs in the sandbox. Each `external_*` call is bridged back to the real tool on the host, and the function can reduce or aggregate results before returning one response to the agent.
31
31
 
32
- The function runs in a [Workspace sandbox](https://mastra.ai/docs/workspace/overview). A sandbox is required, because code mode runs model-authored code and the execution boundary must be chosen deliberately. Pass one via `sandbox`, or run the agent in a workspace that provides one. To execute on the host machine, pass `new LocalSandbox()` explicitly. This runs the function as a host `node` process with host privileges, so only use it for trusted or local development.
32
+ The function runs in a [Workspace sandbox](https://mastra.ai/docs/workspace/sandbox). A sandbox is required, because code mode runs model-authored code and the execution boundary must be chosen deliberately. Pass one via `sandbox`, or run the agent in a workspace that provides one. To execute on the host machine, pass `new LocalSandbox()` explicitly. This runs the function as a host `node` process with host privileges, so only use it for trusted or local development.
33
33
 
34
34
  Transports that bring their own execution boundary are the exception: with [`IsolatedVmCodeModeTransport`](https://mastra.ai/reference/tools/isolated-vm-transport) the program runs in an in-process V8 isolate and no sandbox is needed (see [In-process isolation](#in-process-isolation)).
35
35
 
@@ -184,4 +184,4 @@ See [Choosing a transport](https://mastra.ai/reference/tools/quickjs-transport)
184
184
  - [IsolatedVmCodeModeTransport reference](https://mastra.ai/reference/tools/isolated-vm-transport)
185
185
  - [QuickJsCodeModeTransport reference](https://mastra.ai/reference/tools/quickjs-transport)
186
186
  - [Tools](https://mastra.ai/docs/agents/using-tools)
187
- - [Workspace overview](https://mastra.ai/docs/workspace/overview)
187
+ - [Sandbox](https://mastra.ai/docs/workspace/sandbox)
@@ -426,7 +426,7 @@ See the [`ToolSearchProcessor` reference](https://mastra.ai/reference/processors
426
426
 
427
427
  Handles provider-specific history incompatibilities when agents reuse messages across model providers. It can rewrite the outbound LLM request before the provider call, or recover from known provider API errors and retry.
428
428
 
429
- Add `ProviderHistoryCompat` explicitly when you need provider history compatibility rules, reactive API error recovery, custom compatibility rules, or predictable processor ordering.
429
+ Add `ProviderHistoryCompat` explicitly when you need provider history compatibility rules, reactive API error recovery, custom compatibility rules, or predictable processor ordering. For Azure OpenAI agents that use observational memory, the processor rewrites `<system-reminder>` wrappers in outbound prompts to avoid content moderation refusals. Stored history remains unchanged.
430
430
 
431
431
  See the [`ProviderHistoryCompat` reference](https://mastra.ai/reference/processors/provider-history-compat) for setup, built-in rules, and custom rule options.
432
432
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Skills are reusable instructions that teach agents how to perform specific tasks. They follow the [Agent Skills specification](https://agentskills.io).
6
6
 
7
- You can attach skills directly to an agent through its `skills` config, or configure them on a [workspace](https://mastra.ai/docs/workspace/overview). Attach them to the agent when the skills belong to that specific agent and you want to define them in code with no workspace required. Use a workspace when you want skills discovered from the filesystem and shared across every agent that uses it. This page covers the agent-level approach, defining skills in code and loading them from files, plus resolving them per request.
7
+ You can attach skills directly to an agent through its `skills` config, or configure them on a [workspace](https://mastra.ai/docs/workspace/skills). Attach them to the agent when the skills belong to that specific agent and you want to define them in code with no workspace required. Use a workspace when you want skills discovered from the filesystem and shared across every agent that uses it. This page covers the agent-level approach, defining skills in code and loading them from files, plus resolving them per request.
8
8
 
9
9
  ## When to use agent-level skills
10
10
 
@@ -326,7 +326,7 @@ For more phases, including `input`, `inputDelta`, `error`, `approval`, `suspend`
326
326
 
327
327
  ## Run logic around tool calls
328
328
 
329
- Use `hooks` to run custom logic before and after every tool call an agent makes. Hooks apply to all tool sources: assigned tools, memory tools, toolsets, client tools, agent and workflow tools, and [workspace tools](https://mastra.ai/docs/workspace/overview). Common uses include logging, auditing, input validation, and blocking specific calls.
329
+ Use `hooks` to run custom logic before and after every tool call an agent makes. Hooks apply to all tool sources: assigned tools, memory tools, toolsets, client tools, agent and workflow tools, and [workspace tools](https://mastra.ai/reference/workspace/workspace-class). Common uses include logging, auditing, input validation, and blocking specific calls.
330
330
 
331
331
  ```typescript
332
332
  import { Agent } from '@mastra/core/agent'
@@ -152,7 +152,7 @@ export const deleteFile = createTool({
152
152
 
153
153
  When the agent calls this tool, users see a card with the tool name, arguments, and Approve and Deny actions. The tool only executes after approval.
154
154
 
155
- Set `toolDisplay: 'text'` on an adapter to render tool calls as plain text instead of interactive cards. In `'hidden'` mode, `autoResumeSuspendedTools` can resume suspended tools when a later user message arrives on the same thread. This requires memory. Hidden mode only suppresses the approval buttons.
155
+ Set `toolDisplay: 'text'` on an adapter to render tool calls as plain text instead of interactive cards. In `'hidden'` mode, `autoResumeSuspendedTools` can resume data-bearing `suspend()` flows when a later user message arrives on the same thread. This requires memory. Hidden mode only suppresses approval buttons. It doesn't turn a message into consent. Tools that require approval remain suspended until an explicit approval or decline is submitted through a UI or API action.
156
156
 
157
157
  ## Reply formatting
158
158
 
@@ -182,6 +182,39 @@ In group conversations, Mastra prefixes each message with the sender's name and
182
182
  [Bob (@U456DEF)]: I have a question too.
183
183
  ```
184
184
 
185
+ ## Per-message Signal metadata
186
+
187
+ Use `signalMetadata` in a custom Channel handler to attach structured context to one inbound message. The metadata follows the message when it starts an idle run or joins an active run.
188
+
189
+ The following example attaches registered file IDs before calling the default handler:
190
+
191
+ ```typescript
192
+ import { Agent } from '@mastra/core/agent'
193
+ import { createSlackAdapter } from '@chat-adapter/slack'
194
+
195
+ export const yourAgent = new Agent({
196
+ id: 'your-agent',
197
+ name: 'Your Agent',
198
+ instructions: 'You are a helpful assistant.',
199
+ model: 'openai/gpt-5.6-sol',
200
+ channels: {
201
+ adapters: {
202
+ slack: createSlackAdapter(),
203
+ },
204
+ handlers: {
205
+ onDirectMessage: async (thread, message, defaultHandler, ctx) => {
206
+ ctx.signalMetadata.attachmentIds = ['file-1']
207
+ await defaultHandler(thread, message)
208
+ },
209
+ },
210
+ },
211
+ })
212
+ ```
213
+
214
+ Add only JSON-serializable, non-sensitive values. Signal metadata may be stored in memory or sent through a shared publish-subscribe transport. It isn't added to the model prompt.
215
+
216
+ Use `requestContext` for run-scoped configuration, such as credentials for a message that starts a run. Use `signalMetadata` for context that must stay attached to one message, including messages delivered to an active run.
217
+
185
218
  ## Multimodal content
186
219
 
187
220
  Models like Gemini can process images, video, and audio natively. Combine `inlineMedia` and `inlineLinks` to let users share rich content with your agent across platforms:
@@ -35,6 +35,8 @@ console.log(summary.failedCount) // number of items that failed
35
35
 
36
36
  You can also run experiments in [Studio](https://mastra.ai/docs/studio/overview). After you've added a dataset item, open it and select **Run Experiment** and configure the target, scorers, and options.
37
37
 
38
+ To configure scorers for one item, edit the item and enable **Override dataset scorers**. Select one or more scorers, or leave the selection empty to run no scorers for that item.
39
+
38
40
  After running an experiment, the **Experiments** tab shows all runs for that dataset (with status, counts, and timestamps). Select an experiment to see per-item results, scores, and execution traces.
39
41
 
40
42
  In the **Experiments** tab, select **Compare** and choose two or more experiments to compare their scores and results side by side.
@@ -149,6 +151,50 @@ for (const item of summary.results) {
149
151
 
150
152
  Visit the [Scorers overview](https://mastra.ai/docs/evals/overview) for details on available and custom scorers.
151
153
 
154
+ ## Select scorers per item
155
+
156
+ Add registered scorer IDs to a dataset item to override the scorers attached to its dataset:
157
+
158
+ ```typescript
159
+ await dataset.addItem({
160
+ input: 'Translate "hello" to French.',
161
+ scorerIds: ['accuracy', 'fluency'],
162
+ })
163
+ ```
164
+
165
+ An experiment uses exactly one scorer source for each item, in this order:
166
+
167
+ 1. The experiment's `scorers` option, when provided
168
+ 2. The item's `scorerIds` field, when provided
169
+ 3. The dataset's `scorerIds` field
170
+ 4. No scorers
171
+
172
+ Mastra doesn't merge these sources. An explicit empty array at the run or item level selects no scorers and prevents fallback to the next source. An empty categorized run-level configuration has the same effect. Duplicate item or dataset IDs run once, in the order of their first occurrence.
173
+
174
+ The following updates switch between an explicit empty override and dataset inheritance:
175
+
176
+ ```typescript
177
+ // Run no scorers for this item
178
+ await dataset.updateItem({
179
+ itemId: 'translation-item-id',
180
+ scorerIds: [],
181
+ })
182
+
183
+ // Remove the item override and inherit the dataset's scorers
184
+ await dataset.updateItem({
185
+ itemId: 'translation-item-id',
186
+ scorerIds: null,
187
+ })
188
+ ```
189
+
190
+ Omitting `scorerIds` from an update preserves its current value. Each item version stores its scorer ID list, including an empty list. Scorer definitions aren't copied into the item version and continue to use their existing registry or Editor behavior.
191
+
192
+ Mastra resolves each item's scorer IDs before running its target. It checks registered scorers first, then asks the Editor to hydrate a stored scorer. A stale item-level ID produces the `EXPERIMENT_ITEM_SCORER_NOT_FOUND` code for that item. Mastra skips target execution without retrying that item, while the rest of the experiment continues.
193
+
194
+ A missing ID in the selected run-level or dataset-level source fails experiment setup. Mastra doesn't resolve IDs from lower-priority sources that the precedence rules ignore.
195
+
196
+ Workflow step scorers are available only through a run-level categorized `scorers` configuration. Item-level IDs apply to the flat agent, workflow, and trajectory scorer dispatch.
197
+
152
198
  ## Control persistence per run
153
199
 
154
200
  Use `persistence` to skip storage writes for a specific run. Experiment records and score records can be disabled independently:
@@ -412,6 +412,6 @@ Subscriptions are isolated by Session. Events from another Session on the same c
412
412
  ## Related
413
413
 
414
414
  - [Agents](https://mastra.ai/docs/agents/overview)
415
- - [Workspace](https://mastra.ai/docs/workspace/overview)
415
+ - [Workspace](https://mastra.ai/docs/workspace/sandbox)
416
416
  - [Observational memory](https://mastra.ai/docs/memory/observational-memory)
417
417
  - [Channels](https://mastra.ai/docs/capabilities/channels)
@@ -252,7 +252,7 @@ Use an MCP App when a tool result benefits from interaction, such as a form, cal
252
252
 
253
253
  ### Define an app resource
254
254
 
255
- Return a short `content` summary for the model and place UI data in `structuredContent`. Link the tool to its app by setting `_meta.ui.resourceUri` to the same `ui://` URI used in `appResources`:
255
+ Return a short `content` summary for the model and place UI data in `structuredContent`. Link the tool to its app by setting `mcp._meta.ui.resourceUri` to the same `ui://` URI used in `appResources`:
256
256
 
257
257
  ```typescript
258
258
  import { MCPServer } from '@mastra/mcp'
@@ -266,16 +266,15 @@ export const calculatorTool = createTool({
266
266
  num1: z.number(),
267
267
  num2: z.number(),
268
268
  }),
269
+ mcp: {
270
+ _meta: { ui: { resourceUri: 'ui://calculator/main' } },
271
+ },
269
272
  execute: async ({ num1, num2 }) => ({
270
273
  content: [{ type: 'text', text: 'The result is displayed in the calculator app.' }],
271
274
  structuredContent: { result: num1 + num2 },
272
275
  }),
273
276
  })
274
277
 
275
- calculatorTool._meta = {
276
- ui: { resourceUri: 'ui://calculator/main' },
277
- }
278
-
279
278
  export const calculatorMcpServer = new MCPServer({
280
279
  id: 'calculator-app-server',
281
280
  name: 'Calculator App Server',
@@ -56,6 +56,27 @@ await run.resume({
56
56
  await weatherTool.execute({ location: 'London' }, { requestContext })
57
57
  ```
58
58
 
59
+ ### Using runtime-only keys
60
+
61
+ When you provide a type or `requestContextSchema`, the `get`, `set`, `has`, and `delete` methods only accept declared keys. This catches misspelled keys and keeps declared values typed.
62
+
63
+ Use `getRaw`, `setRaw`, `hasRaw`, and `deleteRaw` for infrastructure or middleware keys that aren't part of the schema. Raw values use the `unknown` type, so narrow them before use.
64
+
65
+ ```typescript
66
+ const requestContext = new RequestContext<{ userId: string }>()
67
+
68
+ requestContext.set('userId', 'user-123')
69
+ requestContext.setRaw('session.cache', { hits: 0 })
70
+
71
+ const cache = requestContext.getRaw('session.cache')
72
+
73
+ if (typeof cache === 'object' && cache !== null && 'hits' in cache) {
74
+ console.log(cache.hits)
75
+ }
76
+ ```
77
+
78
+ Prefer schema-declared keys for application data. Use the raw methods only when a key must remain outside the request context schema.
79
+
59
80
  ### Setting values based on request headers
60
81
 
61
82
  You can populate `requestContext` in a runtime server middleware by extracting information from the request. In this example, the `temperature-unit` is set based on the Cloudflare `CF-IPCountry` header to ensure responses match the user's locale.
@@ -85,7 +85,7 @@ Run tools on their own to observe behavior and test them before assigning them t
85
85
 
86
86
  Browse the files in your agent's workspace filesystem using a built-in file browser. Switch between workspace mounts, create directories, and view file contents with syntax highlighting. Writable workspaces allow directory creation and file deletion; read-only workspaces are labeled accordingly. The Skills tab lists all discovered skills with their instructions, references, and metadata. Install community skills from [skills.sh](https://skills.sh) or remove existing ones.
87
87
 
88
- See [workspaces](https://mastra.ai/docs/workspace/overview) for configuration details.
88
+ See [workspaces](https://mastra.ai/docs/workspace/sandbox) for configuration details.
89
89
 
90
90
  ### Request context
91
91