@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012

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 (285) hide show
  1. package/.docs/docs/agents/adding-voice.md +18 -17
  2. package/.docs/docs/agents/background-tasks.md +242 -0
  3. package/.docs/docs/agents/channels.md +2 -1
  4. package/.docs/docs/agents/overview.md +4 -0
  5. package/.docs/docs/agents/processors.md +177 -5
  6. package/.docs/docs/agents/structured-output.md +66 -1
  7. package/.docs/docs/agents/supervisor-agents.md +65 -0
  8. package/.docs/docs/agents/using-tools.md +73 -0
  9. package/.docs/docs/browser/agent-browser.md +78 -0
  10. package/.docs/docs/browser/browser-viewer.md +144 -0
  11. package/.docs/docs/browser/overview.md +168 -0
  12. package/.docs/docs/browser/stagehand.md +129 -0
  13. package/.docs/docs/deployment/cloud-providers.md +5 -1
  14. package/.docs/docs/deployment/mastra-server.md +4 -4
  15. package/.docs/docs/deployment/monorepo.md +3 -3
  16. package/.docs/docs/deployment/overview.md +11 -8
  17. package/.docs/docs/editor/overview.md +290 -0
  18. package/.docs/docs/editor/prompts.md +134 -0
  19. package/.docs/docs/editor/tools.md +152 -0
  20. package/.docs/docs/evals/custom-scorers.md +63 -3
  21. package/.docs/docs/evals/datasets/overview.md +1 -1
  22. package/.docs/docs/index.md +2 -2
  23. package/.docs/docs/mastra-platform/configuration.md +36 -0
  24. package/.docs/docs/mastra-platform/overview.md +78 -0
  25. package/.docs/docs/mcp/overview.md +17 -0
  26. package/.docs/docs/memory/memory-processors.md +3 -3
  27. package/.docs/docs/memory/message-history.md +8 -2
  28. package/.docs/docs/memory/observational-memory.md +65 -8
  29. package/.docs/docs/memory/storage.md +1 -2
  30. package/.docs/docs/memory/working-memory.md +2 -2
  31. package/.docs/docs/observability/logging.md +1 -1
  32. package/.docs/docs/observability/metrics/overview.md +2 -2
  33. package/.docs/docs/observability/overview.md +1 -1
  34. package/.docs/docs/observability/tracing/bridges/datadog.md +217 -0
  35. package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
  36. package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
  37. package/.docs/docs/observability/tracing/exporters/cloud.md +135 -63
  38. package/.docs/docs/observability/tracing/exporters/datadog.md +3 -1
  39. package/.docs/docs/observability/tracing/exporters/default.md +5 -5
  40. package/.docs/docs/observability/tracing/exporters/laminar.md +22 -14
  41. package/.docs/docs/observability/tracing/exporters/langfuse.md +50 -33
  42. package/.docs/docs/observability/tracing/overview.md +87 -20
  43. package/.docs/docs/server/custom-adapters.md +5 -5
  44. package/.docs/docs/server/custom-api-routes.md +3 -3
  45. package/.docs/docs/server/mastra-client.md +2 -2
  46. package/.docs/docs/server/mastra-server.md +1 -1
  47. package/.docs/docs/server/middleware.md +46 -42
  48. package/.docs/docs/server/request-context.md +13 -2
  49. package/.docs/docs/server/server-adapters.md +91 -8
  50. package/.docs/docs/streaming/background-task-streaming.md +80 -0
  51. package/.docs/docs/streaming/overview.md +3 -0
  52. package/.docs/docs/studio/deployment.md +24 -6
  53. package/.docs/docs/studio/observability.md +1 -1
  54. package/.docs/docs/studio/overview.md +4 -4
  55. package/.docs/docs/voice/overview.md +74 -5
  56. package/.docs/docs/voice/speech-to-speech.md +45 -1
  57. package/.docs/docs/voice/speech-to-text.md +7 -7
  58. package/.docs/docs/voice/text-to-speech.md +10 -10
  59. package/.docs/docs/workflows/agents-and-tools.md +1 -1
  60. package/.docs/docs/workflows/overview.md +105 -4
  61. package/.docs/docs/workflows/scheduled-workflows.md +181 -0
  62. package/.docs/docs/workspace/filesystem.md +64 -6
  63. package/.docs/docs/workspace/lsp.md +76 -4
  64. package/.docs/docs/workspace/overview.md +62 -15
  65. package/.docs/docs/workspace/sandbox.md +3 -1
  66. package/.docs/docs/workspace/search.md +41 -2
  67. package/.docs/docs/workspace/skills.md +19 -19
  68. package/.docs/guides/agent-frameworks/ai-sdk.md +4 -4
  69. package/.docs/guides/build-your-ui/ai-sdk-ui.md +56 -9
  70. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  71. package/.docs/guides/deployment/mastra-platform.md +191 -0
  72. package/.docs/guides/deployment/netlify.md +16 -1
  73. package/.docs/guides/getting-started/nestjs.md +238 -0
  74. package/.docs/guides/getting-started/next-js.md +0 -4
  75. package/.docs/guides/guide/code-review-bot.md +2 -2
  76. package/.docs/guides/guide/dev-assistant.md +4 -4
  77. package/.docs/{docs/mcp → guides/guide}/publishing-mcp-server.md +21 -1
  78. package/.docs/guides/guide/slack-assistant.md +191 -0
  79. package/.docs/guides/migrations/mastra-cloud.md +368 -0
  80. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  81. package/.docs/models/embeddings.md +3 -3
  82. package/.docs/models/gateways/azure-openai.md +74 -35
  83. package/.docs/models/gateways/mastra.md +64 -0
  84. package/.docs/models/gateways/netlify.md +7 -3
  85. package/.docs/models/gateways/openrouter.md +28 -12
  86. package/.docs/models/gateways/vercel.md +22 -2
  87. package/.docs/models/gateways.md +1 -0
  88. package/.docs/models/index.md +43 -8
  89. package/.docs/models/providers/302ai.md +37 -4
  90. package/.docs/models/providers/abliteration-ai.md +71 -0
  91. package/.docs/models/providers/alibaba-cn.md +8 -2
  92. package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -2
  93. package/.docs/models/providers/alibaba-coding-plan.md +3 -2
  94. package/.docs/models/providers/alibaba.md +8 -1
  95. package/.docs/models/providers/anthropic.md +18 -5
  96. package/.docs/models/providers/baseten.md +3 -1
  97. package/.docs/models/providers/berget.md +10 -12
  98. package/.docs/models/providers/chutes.md +4 -2
  99. package/.docs/models/providers/cloudflare-workers-ai.md +14 -48
  100. package/.docs/models/providers/cortecs.md +22 -2
  101. package/.docs/models/providers/deepinfra.md +8 -2
  102. package/.docs/models/providers/deepseek.md +6 -4
  103. package/.docs/models/providers/digitalocean.md +133 -0
  104. package/.docs/models/providers/fireworks-ai.md +6 -1
  105. package/.docs/models/providers/firmware.md +12 -10
  106. package/.docs/models/providers/friendli.md +6 -7
  107. package/.docs/models/providers/google.md +9 -3
  108. package/.docs/models/providers/helicone.md +1 -2
  109. package/.docs/models/providers/hpc-ai.md +73 -0
  110. package/.docs/models/providers/huggingface.md +6 -2
  111. package/.docs/models/providers/inception.md +9 -11
  112. package/.docs/models/providers/kilo.md +359 -339
  113. package/.docs/models/providers/kimi-for-coding.md +2 -1
  114. package/.docs/models/providers/llmgateway.md +67 -77
  115. package/.docs/models/providers/mistral.md +3 -2
  116. package/.docs/models/providers/mixlayer.md +75 -0
  117. package/.docs/models/providers/moonshotai-cn.md +3 -2
  118. package/.docs/models/providers/moonshotai.md +3 -2
  119. package/.docs/models/providers/nano-gpt.md +8 -2
  120. package/.docs/models/providers/neuralwatt.md +84 -0
  121. package/.docs/models/providers/novita-ai.md +19 -4
  122. package/.docs/models/providers/nvidia.md +8 -1
  123. package/.docs/models/providers/ollama-cloud.md +7 -2
  124. package/.docs/models/providers/openai.md +7 -2
  125. package/.docs/models/providers/opencode-go.md +21 -13
  126. package/.docs/models/providers/opencode.md +11 -4
  127. package/.docs/models/providers/ovhcloud.md +6 -8
  128. package/.docs/models/providers/poe.md +10 -15
  129. package/.docs/models/providers/regolo-ai.md +83 -0
  130. package/.docs/models/providers/siliconflow-cn.md +5 -2
  131. package/.docs/models/providers/siliconflow.md +6 -3
  132. package/.docs/models/providers/stepfun.md +8 -7
  133. package/.docs/models/providers/synthetic.md +5 -2
  134. package/.docs/models/providers/tencent-token-plan.md +71 -0
  135. package/.docs/models/providers/tencent-tokenhub.md +71 -0
  136. package/.docs/models/providers/togetherai.md +8 -7
  137. package/.docs/models/providers/vivgrid.md +7 -3
  138. package/.docs/models/providers/vultr.md +7 -6
  139. package/.docs/models/providers/wafer.ai.md +73 -0
  140. package/.docs/models/providers/wandb.md +3 -2
  141. package/.docs/models/providers/xai.md +6 -1
  142. package/.docs/models/providers/xiaomi-token-plan-ams.md +75 -0
  143. package/.docs/models/providers/xiaomi-token-plan-cn.md +75 -0
  144. package/.docs/models/providers/xiaomi-token-plan-sgp.md +75 -0
  145. package/.docs/models/providers/xiaomi.md +4 -2
  146. package/.docs/models/providers/zai-coding-plan.md +11 -19
  147. package/.docs/models/providers/zai.md +2 -1
  148. package/.docs/models/providers/zenmux.md +17 -6
  149. package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
  150. package/.docs/models/providers/zhipuai.md +2 -1
  151. package/.docs/models/providers.md +11 -0
  152. package/.docs/reference/agents/agent.md +1 -1
  153. package/.docs/reference/agents/channels.md +3 -3
  154. package/.docs/reference/agents/generate.md +88 -6
  155. package/.docs/reference/agents/generateLegacy.md +1 -1
  156. package/.docs/reference/ai-sdk/chat-route.md +2 -0
  157. package/.docs/reference/ai-sdk/handle-chat-stream.md +19 -0
  158. package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
  159. package/.docs/reference/ai-sdk/network-route.md +2 -0
  160. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +95 -0
  161. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +15 -0
  162. package/.docs/reference/browser/agent-browser.md +375 -0
  163. package/.docs/reference/browser/browser-viewer.md +228 -0
  164. package/.docs/reference/browser/mastra-browser.md +286 -0
  165. package/.docs/reference/browser/stagehand-browser.md +286 -0
  166. package/.docs/reference/cli/mastra.md +703 -0
  167. package/.docs/reference/client-js/agents.md +166 -0
  168. package/.docs/reference/client-js/conversations.md +1 -1
  169. package/.docs/reference/client-js/mastra-client.md +23 -0
  170. package/.docs/reference/client-js/observability.md +2 -2
  171. package/.docs/reference/client-js/responses.md +1 -1
  172. package/.docs/reference/client-js/workflows.md +62 -1
  173. package/.docs/reference/configuration.md +67 -1
  174. package/.docs/reference/core/addGateway.md +5 -5
  175. package/.docs/reference/core/getEditor.md +35 -0
  176. package/.docs/reference/core/getGateway.md +5 -5
  177. package/.docs/reference/core/getGatewayById.md +5 -5
  178. package/.docs/reference/core/getMCPServer.md +2 -2
  179. package/.docs/reference/core/getMCPServerById.md +2 -2
  180. package/.docs/reference/core/getScorer.md +3 -3
  181. package/.docs/reference/core/getScorerById.md +3 -3
  182. package/.docs/reference/core/listGateways.md +5 -5
  183. package/.docs/reference/core/listMCPServers.md +2 -2
  184. package/.docs/reference/core/listScorers.md +3 -3
  185. package/.docs/reference/core/mastra-class.md +11 -1
  186. package/.docs/reference/core/mastra-model-gateway.md +5 -5
  187. package/.docs/reference/datasets/create.md +4 -4
  188. package/.docs/reference/datasets/startExperiment.md +28 -2
  189. package/.docs/reference/datasets/update.md +4 -4
  190. package/.docs/reference/deployer/cloudflare.md +14 -1
  191. package/.docs/reference/deployer/netlify.md +50 -2
  192. package/.docs/reference/editor/mastra-editor.md +168 -0
  193. package/.docs/reference/editor/tool-provider.md +85 -0
  194. package/.docs/reference/evals/context-precision.md +3 -3
  195. package/.docs/reference/evals/context-relevance.md +3 -3
  196. package/.docs/reference/evals/create-scorer.md +5 -3
  197. package/.docs/reference/evals/filter-run.md +117 -0
  198. package/.docs/reference/evals/mastra-scorer.md +4 -4
  199. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  200. package/.docs/reference/evals/prompt-alignment.md +12 -12
  201. package/.docs/reference/evals/run-evals.md +6 -6
  202. package/.docs/reference/evals/scorer-utils.md +3 -3
  203. package/.docs/reference/evals/trajectory-accuracy.md +3 -3
  204. package/.docs/reference/harness/harness-class.md +152 -53
  205. package/.docs/reference/index.md +25 -0
  206. package/.docs/reference/logging/pino-logger.md +0 -2
  207. package/.docs/reference/mastra-platform/api.md +108 -0
  208. package/.docs/reference/memory/clone-utilities.md +4 -2
  209. package/.docs/reference/memory/cloneThread.md +4 -2
  210. package/.docs/reference/memory/observational-memory.md +4 -0
  211. package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
  212. package/.docs/reference/observability/tracing/bridges/datadog.md +211 -0
  213. package/.docs/reference/observability/tracing/bridges/otel.md +3 -3
  214. package/.docs/reference/observability/tracing/configuration.md +18 -11
  215. package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
  216. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +102 -21
  217. package/.docs/reference/observability/tracing/exporters/console-exporter.md +8 -8
  218. package/.docs/reference/observability/tracing/exporters/datadog.md +3 -1
  219. package/.docs/reference/observability/tracing/exporters/default-exporter.md +8 -8
  220. package/.docs/reference/observability/tracing/exporters/langfuse.md +25 -32
  221. package/.docs/reference/observability/tracing/exporters/otel.md +3 -3
  222. package/.docs/reference/observability/tracing/instances.md +7 -7
  223. package/.docs/reference/observability/tracing/interfaces.md +23 -6
  224. package/.docs/reference/observability/tracing/span-filtering.md +95 -0
  225. package/.docs/reference/observability/tracing/spans.md +6 -6
  226. package/.docs/reference/processors/prefill-error-handler.md +70 -0
  227. package/.docs/reference/processors/processor-interface.md +400 -40
  228. package/.docs/reference/processors/skill-search-processor.md +20 -1
  229. package/.docs/reference/processors/stream-error-retry-processor.md +54 -0
  230. package/.docs/reference/processors/tool-call-filter.md +23 -0
  231. package/.docs/reference/server/create-route.md +3 -3
  232. package/.docs/reference/server/express-adapter.md +4 -4
  233. package/.docs/reference/server/fastify-adapter.md +4 -4
  234. package/.docs/reference/server/hono-adapter.md +4 -4
  235. package/.docs/reference/server/koa-adapter.md +4 -4
  236. package/.docs/reference/server/mastra-server.md +3 -3
  237. package/.docs/reference/server/nestjs-adapter.md +169 -0
  238. package/.docs/reference/server/register-api-route.md +4 -4
  239. package/.docs/reference/server/routes.md +11 -10
  240. package/.docs/reference/storage/clickhouse.md +300 -0
  241. package/.docs/reference/storage/cloudflare-d1.md +42 -42
  242. package/.docs/reference/storage/composite.md +5 -3
  243. package/.docs/reference/storage/duckdb.md +150 -0
  244. package/.docs/reference/storage/overview.md +1 -1
  245. package/.docs/reference/storage/redis.md +266 -0
  246. package/.docs/reference/streaming/ChunkType.md +143 -3
  247. package/.docs/reference/streaming/agents/MastraModelOutput.md +2 -2
  248. package/.docs/reference/streaming/agents/stream.md +10 -2
  249. package/.docs/reference/streaming/agents/streamUntilIdle.md +94 -0
  250. package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
  251. package/.docs/reference/templates/overview.md +88 -14
  252. package/.docs/reference/tools/create-tool.md +107 -5
  253. package/.docs/reference/tools/mcp-client.md +45 -0
  254. package/.docs/reference/tools/mcp-server.md +1 -3
  255. package/.docs/reference/tools/perplexity.md +155 -0
  256. package/.docs/reference/tools/tavily.md +307 -0
  257. package/.docs/reference/vectors/mongodb.md +0 -2
  258. package/.docs/reference/voice/aws-nova-sonic.md +247 -0
  259. package/.docs/reference/voice/cloudflare.md +3 -3
  260. package/.docs/reference/voice/sarvam.md +29 -23
  261. package/.docs/reference/voice/voice.connect.md +4 -4
  262. package/.docs/reference/voice/voice.listen.md +3 -3
  263. package/.docs/reference/workflows/run-methods/resume.md +24 -0
  264. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  265. package/.docs/reference/workflows/step.md +88 -7
  266. package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
  267. package/.docs/reference/workflows/workflow.md +88 -4
  268. package/.docs/reference/workspace/azure-blob-filesystem.md +219 -0
  269. package/.docs/reference/workspace/docker-sandbox.md +196 -0
  270. package/.docs/reference/workspace/gcs-filesystem.md +1 -0
  271. package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
  272. package/.docs/reference/workspace/modal-sandbox.md +168 -0
  273. package/.docs/reference/workspace/process-manager.md +1 -1
  274. package/.docs/reference/workspace/s3-filesystem.md +80 -5
  275. package/.docs/reference/workspace/vercel.md +1 -1
  276. package/.docs/reference/workspace/workspace-class.md +37 -6
  277. package/CHANGELOG.md +500 -4
  278. package/dist/stdio.js.map +1 -1
  279. package/dist/utils.d.ts +1 -4
  280. package/dist/utils.d.ts.map +1 -1
  281. package/package.json +11 -11
  282. package/.docs/docs/mastra-cloud/deployment.md +0 -77
  283. package/.docs/docs/mastra-cloud/observability.md +0 -38
  284. package/.docs/docs/mastra-cloud/overview.md +0 -23
  285. package/.docs/docs/mastra-cloud/setup.md +0 -42
@@ -15,7 +15,7 @@ const mastra = new Mastra({
15
15
 
16
16
  const dataset = await mastra.datasets.get({ id: 'dataset-id' })
17
17
 
18
- // Run against a registered agent with scorers
18
+ // Run against a registered agent with a flat scorer list
19
19
  const summary = await dataset.startExperiment({
20
20
  targetType: 'agent',
21
21
  targetId: 'my-agent',
@@ -23,8 +23,34 @@ const summary = await dataset.startExperiment({
23
23
  maxConcurrency: 10,
24
24
  })
25
25
 
26
+ // Or pass the same categorised shape accepted by runEvals
27
+ const summary2 = await dataset.startExperiment({
28
+ targetType: 'agent',
29
+ targetId: 'my-agent',
30
+ scorers: {
31
+ agent: [accuracyScorer],
32
+ trajectory: [toolOrderScorer],
33
+ },
34
+ })
35
+
36
+ // For workflow targets, score individual steps with their own scorers
37
+ const summary3 = await dataset.startExperiment({
38
+ targetType: 'workflow',
39
+ targetId: 'my-workflow',
40
+ scorers: {
41
+ workflow: [overallScorer],
42
+ steps: {
43
+ 'fetch-data': [fetchScorer],
44
+ transform: [transformScorer],
45
+ },
46
+ trajectory: [executionPathScorer],
47
+ },
48
+ })
49
+
26
50
  console.log(`${summary.succeededCount}/${summary.totalItems} succeeded`)
27
51
  console.log(`Status: ${summary.status}`)
52
+ console.log(`${summary2.succeededCount}/${summary2.totalItems} succeeded`)
53
+ console.log(`Status: ${summary2.status}`)
28
54
  ```
29
55
 
30
56
  ## Parameters
@@ -33,7 +59,7 @@ console.log(`Status: ${summary.status}`)
33
59
 
34
60
  **targetId** (`string`): ID of the registered target. Use with \`targetType\`.
35
61
 
36
- **scorers** (`(MastraScorer | string)[]`): Scorers to evaluate each result. Pass \`MastraScorer\` instances or registered scorer IDs.
62
+ **scorers** (`(MastraScorer | string)[] | AgentScorerConfig | WorkflowScorerConfig`): Scorers to evaluate each result. Accepts a flat array of \`MastraScorer\` instances or registered scorer IDs, or the same categorised config shape used by \`runEvals\` (\`AgentScorerConfig\` / \`WorkflowScorerConfig\`). Trajectory scorers (\`type: "trajectory"\`) automatically receive a pre-extracted \`Trajectory\` as their output regardless of which form is used. For workflow targets, per-step scorers can be passed via \`scorers: { steps: { stepId: \[...] } }\` and run against each step's output; their results carry the originating \`stepId\` and keep \`targetScope: "span"\` (matching \`runEvals\`).
37
63
 
38
64
  **name** (`string`): Display name for the experiment.
39
65
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Added in:** `@mastra/core@1.4.0`
4
4
 
5
- Updates dataset metadata, name, description, and/or schemas. Zod schemas are automatically converted to JSON Schema.
5
+ Updates dataset metadata, name, description, and/or schemas. Use Standard JSON Schema (Zod, Valibot, ArkType, etc.) for defining schemas.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -22,7 +22,7 @@ const updated = await dataset.update({
22
22
  description: 'Revised evaluation set',
23
23
  })
24
24
 
25
- // Update with Zod schema (auto-converted to JSON Schema)
25
+ // Update with Zod schema (library that supports Standard JSON Schema)
26
26
  const updated2 = await dataset.update({
27
27
  inputSchema: z.object({
28
28
  question: z.string(),
@@ -39,9 +39,9 @@ const updated2 = await dataset.update({
39
39
 
40
40
  **metadata** (`Record<string, unknown>`): Updated metadata.
41
41
 
42
- **inputSchema** (`unknown`): JSON Schema or Zod schema for item inputs.
42
+ **inputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item inputs.
43
43
 
44
- **groundTruthSchema** (`unknown`): JSON Schema or Zod schema for item ground truths.
44
+ **groundTruthSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item ground truths.
45
45
 
46
46
  ## Returns
47
47
 
@@ -117,4 +117,17 @@ export const mastra = new Mastra({
117
117
  ],
118
118
  },
119
119
  })
120
- ```
120
+ ```
121
+
122
+ > **Keep bindings inline inside new Mastra({...}):** Mastra's Babel plugin defers `new Mastra(...)` so that `env` is available when it runs. Code outside that call evaluates at module load before `env` is populated.
123
+ >
124
+ > ```typescript
125
+ > // ✅ Works — binding is inside new Mastra(), so it's deferred
126
+ > export const mastra = new Mastra({
127
+ > storage: new D1Store({ binding: env.DB }),
128
+ > })
129
+ >
130
+ > // ❌ Breaks — env.DB is undefined at module load
131
+ > const storage = new D1Store({ binding: env.DB })
132
+ > export const mastra = new Mastra({ storage })
133
+ > ```
@@ -1,6 +1,6 @@
1
1
  # NetlifyDeployer
2
2
 
3
- The `NetlifyDeployer` class handles packaging, configuration, and deployment by adapting Mastra's output to create an optimized version of your server. It extends the base [`Deployer`](https://mastra.ai/reference/deployer) class with Netlify specific functionality. It enables you to run Mastra within Netlify functions.
3
+ The `NetlifyDeployer` class handles packaging, configuration, and deployment by adapting Mastra's output to create an optimized version of your server. It extends the base [`Deployer`](https://mastra.ai/reference/deployer) class with Netlify-specific functionality. It enables you to run Mastra within Netlify serverless functions or edge functions.
4
4
 
5
5
  ## Installation
6
6
 
@@ -43,9 +43,31 @@ export const mastra = new Mastra({
43
43
  })
44
44
  ```
45
45
 
46
+ ## Constructor options
47
+
48
+ - `target?: 'serverless' | 'edge'` — Deploy target for Netlify. Defaults to `'serverless'`.
49
+
50
+ - `'serverless'` — Standard [Netlify Functions](https://docs.netlify.com/functions/overview/) (Node.js runtime, 60s default timeout).
51
+ - `'edge'` — [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/) (Deno-based runtime, runs at the edge closest to users, no hard timeout).
52
+
53
+ ### Edge functions example
54
+
55
+ ```typescript
56
+ import { Mastra } from '@mastra/core'
57
+ import { NetlifyDeployer } from '@mastra/deployer-netlify'
58
+
59
+ export const mastra = new Mastra({
60
+ deployer: new NetlifyDeployer({
61
+ target: 'edge',
62
+ }),
63
+ })
64
+ ```
65
+
46
66
  ## Output
47
67
 
48
- After running `mastra build`, the deployer generates a `.netlify` folder. The build output includes all agents, tools, and workflows of your project, alongside a special `config.json` file. The `config.json` file configures the behavior of Netlify functions.
68
+ After running `mastra build`, the deployer generates a `.netlify` folder. The build output includes all agents, tools, and workflows of your project, alongside a `config.json` file that configures the [Netlify Frameworks API](https://docs.netlify.com/build/frameworks/frameworks-api/).
69
+
70
+ ### Serverless output (default)
49
71
 
50
72
  ```bash
51
73
  your-project/
@@ -77,4 +99,30 @@ The `config.json` file contains:
77
99
  }
78
100
  ]
79
101
  }
102
+ ```
103
+
104
+ ### Edge output
105
+
106
+ ```bash
107
+ your-project/
108
+ └── .netlify/
109
+ └── v1/
110
+ ├── config.json
111
+ └── edge-functions/
112
+ ├── index.mjs
113
+ ├── package.json
114
+ └── node_modules/
115
+ ```
116
+
117
+ The `config.json` file contains:
118
+
119
+ ```json
120
+ {
121
+ "edge_functions": [
122
+ {
123
+ "function": "index",
124
+ "path": "/*"
125
+ }
126
+ ]
127
+ }
80
128
  ```
@@ -0,0 +1,168 @@
1
+ # MastraEditor class
2
+
3
+ The `MastraEditor` class sets up the editor system. Pass it to the `Mastra` constructor to turn on editor features like prompt blocks, agent code override, versioning, and tool providers.
4
+
5
+ See the [Editor overview](https://mastra.ai/docs/editor/overview) for an introduction to what the editor does.
6
+
7
+ ## Usage example
8
+
9
+ ```typescript
10
+ import { Mastra } from '@mastra/core'
11
+ import { MastraEditor } from '@mastra/editor'
12
+ import { ComposioToolProvider } from '@mastra/editor/providers/composio'
13
+
14
+ export const mastra = new Mastra({
15
+ agents: {
16
+ /* your agents */
17
+ },
18
+ editor: new MastraEditor({
19
+ toolProviders: {
20
+ composio: new ComposioToolProvider({
21
+ apiKey: process.env.COMPOSIO_API_KEY!,
22
+ }),
23
+ },
24
+ }),
25
+ })
26
+ ```
27
+
28
+ ## Constructor parameters
29
+
30
+ **logger** (`Logger`): Logger instance. Falls back to the Mastra instance logger if not set.
31
+
32
+ **toolProviders** (`Record<string, ToolProvider>`): Integration tool providers keyed by ID (for example, Composio or Arcade). Lets agents use third-party tools added through the editor. (Default: `{}`)
33
+
34
+ **processorProviders** (`Record<string, ProcessorProvider>`): Processor providers for configurable input/output processing (for example, moderation or token limiting). Built-in providers are always included. (Default: `{}`)
35
+
36
+ **filesystems** (`Record<string, FilesystemProvider>`): Filesystem providers for file access (for example, S3 or GCS). A local filesystem provider is always included. (Default: `{}`)
37
+
38
+ **sandboxes** (`Record<string, SandboxProvider>`): Sandbox providers for code execution (for example, E2B). A local sandbox provider is always included. (Default: `{}`)
39
+
40
+ **blobStores** (`Record<string, BlobStoreProvider>`): Blob storage providers for binary data (for example, S3). Falls back to the Mastra storage blob store if no provider is specified. (Default: `{}`)
41
+
42
+ ## Namespaces
43
+
44
+ The editor exposes namespaces for managing different entity types. Access them from any Mastra instance with `mastra.getEditor()` and call the CRUD methods directly in application code, or rely on the Mastra server routes that use them under the hood.
45
+
46
+ All namespaces extend a shared CRUD base class, so they expose the same `create`, `getById`, `update`, `delete`, `list`, `listResolved`, and `clearCache` methods. The namespace-specific property tables below also document any additional methods.
47
+
48
+ **agent** (`EditorAgentNamespace`): CRUD operations and version management for stored agents. Handles applying stored overrides to code-defined agents.
49
+
50
+ **agent.create** (`(input: StorageCreateAgentInput) => Promise<Agent>`): Create a new stored agent and return a hydrated Agent instance. Accepts an id, authorId, metadata, and the initial snapshot (name, description, instructions, model, tools, memory, and so on).
51
+
52
+ **agent.getById** (`(id: string, options?: GetByIdOptions) => Promise<Agent | null>`): Return a hydrated Agent instance for a stored agent. Pass options with versionId, versionNumber, or status ("draft" | "published" | "archived") to target a specific version. Default version requests are cached.
53
+
54
+ **agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a new draft version with the provided snapshot fields (instructions, tools, memory, and so on) and invalidates the cache. Set memory to null to disable memory.
55
+
56
+ **agent.delete** (`(id: string) => Promise<void>`): Delete a stored agent and remove it from the Mastra runtime registry.
57
+
58
+ **agent.list** (`(args?: StorageListAgentsInput) => Promise<StorageListAgentsOutput>`): List stored agents with optional pagination, orderBy, authorId, and metadata filters. Returns raw stored snapshots.
59
+
60
+ **agent.listResolved** (`(args?: StorageListAgentsInput) => Promise<StorageListAgentsResolvedOutput>`): Same as list, but returns fully resolved configurations with references dereferenced.
61
+
62
+ **agent.applyStoredOverrides** (`(agent: Agent, options?: { versionId?: string; status?: "draft" | "published" }) => Promise<Agent>`): Mutate a code-defined agent in place to apply any stored overrides (instructions, tools, variables). Called internally by mastra.getAgent() — you rarely call it directly.
63
+
64
+ **agent.clone** (`(agent: Agent, options: { newId: string; newName?: string; metadata?: Record<string, unknown>; authorId?: string; requestContext?: RequestContext; }) => Promise<Agent>`): Create a new stored agent by cloning an existing agent.
65
+
66
+ **agent.clearCache** (`(agentId?: string) => void`): Clear the in-memory cache for one agent or all agents. Called automatically after mutations.
67
+
68
+ **prompt** (`EditorPromptNamespace`): CRUD operations for prompt blocks. Includes a preview method for resolving instruction blocks with draft content.
69
+
70
+ **prompt.create** (`(input: StorageCreatePromptBlockInput) => Promise<StorageResolvedPromptBlockType>`): Create a new stored prompt block. Accepts an id, authorId, metadata, and the initial snapshot (name, description, content, rules, requestContextSchema).
71
+
72
+ **prompt.getById** (`(id: string, options?: GetByIdOptions) => Promise<StorageResolvedPromptBlockType | null>`): Return a resolved prompt block. Pass options to target a specific version or status.
73
+
74
+ **prompt.update** (`(input: StorageUpdatePromptBlockInput) => Promise<StorageResolvedPromptBlockType>`): Partially update a stored prompt block. Creates a new draft version with the provided snapshot fields.
75
+
76
+ **prompt.delete** (`(id: string) => Promise<void>`): Delete a stored prompt block and remove it from the Mastra runtime registry.
77
+
78
+ **prompt.list** (`(args?: StorageListPromptBlocksInput) => Promise<StorageListPromptBlocksOutput>`): List stored prompt blocks with optional pagination, orderBy, authorId, metadata, and status filters.
79
+
80
+ **prompt.listResolved** (`(args?: StorageListPromptBlocksInput) => Promise<StorageListPromptBlocksResolvedOutput>`): Same as list, but returns fully resolved prompt block content.
81
+
82
+ **prompt.preview** (`(blocks: AgentInstructionBlock[], context: Record<string, unknown>) => Promise<string>`): Resolve an array of instruction blocks against a context, rendering template variables and evaluating display conditions. Includes draft content for referenced prompt blocks.
83
+
84
+ **prompt.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one prompt block or all prompt blocks.
85
+
86
+ **mcp** (`EditorMCPNamespace`): CRUD operations for stored MCP client configurations.
87
+
88
+ **mcp.create** (`(input: StorageCreateMCPClientInput) => Promise<MCPClient>`): Create a new stored MCP client. Accepts an id, authorId, metadata, and the initial snapshot (servers, tool filtering).
89
+
90
+ **mcp.getById** (`(id: string, options?: GetByIdOptions) => Promise<MCPClient | null>`): Return a hydrated MCPClient instance for a stored MCP client.
91
+
92
+ **mcp.update** (`(input: StorageUpdateMCPClientInput) => Promise<MCPClient>`): Partially update a stored MCP client and invalidate the cache.
93
+
94
+ **mcp.delete** (`(id: string) => Promise<void>`): Delete a stored MCP client and remove it from the Mastra runtime registry.
95
+
96
+ **mcp.list** (`(args?: StorageListMCPClientsInput) => Promise<StorageListMCPClientsOutput>`): List stored MCP clients with optional pagination and filters.
97
+
98
+ **mcp.listResolved** (`(args?: StorageListMCPClientsInput) => Promise<StorageListMCPClientsResolvedOutput>`): Same as list, but returns fully resolved MCP client configurations.
99
+
100
+ **mcp.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one MCP client or all MCP clients.
101
+
102
+ **mcpServer** (`EditorMCPServerNamespace`): CRUD operations for MCP server configurations.
103
+
104
+ **mcpServer.create** (`(input: StorageCreateMCPServerInput) => Promise<MCPServerBase>`): Create a new stored MCP server configuration and return a hydrated server instance.
105
+
106
+ **mcpServer.getById** (`(id: string, options?: GetByIdOptions) => Promise<MCPServerBase | null>`): Return a hydrated MCP server for a given id.
107
+
108
+ **mcpServer.update** (`(input: StorageUpdateMCPServerInput) => Promise<MCPServerBase>`): Partially update a stored MCP server configuration.
109
+
110
+ **mcpServer.delete** (`(id: string) => Promise<void>`): Delete a stored MCP server configuration.
111
+
112
+ **mcpServer.list** (`(args?: StorageListMCPServersInput) => Promise<StorageListMCPServersOutput>`): List stored MCP server configurations.
113
+
114
+ **mcpServer.listResolved** (`(args?: StorageListMCPServersInput) => Promise<StorageListMCPServersResolvedOutput>`): Same as list, but returns fully resolved server configurations.
115
+
116
+ **mcpServer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one MCP server or all MCP servers.
117
+
118
+ **scorer** (`EditorScorerNamespace`): CRUD operations for scorer configurations.
119
+
120
+ **scorer.create** (`(input: StorageCreateScorerInput) => Promise<MastraScorer>`): Create a new stored scorer and return a hydrated MastraScorer instance.
121
+
122
+ **scorer.getById** (`(id: string, options?: GetByIdOptions) => Promise<MastraScorer | null>`): Return a hydrated scorer for a given id.
123
+
124
+ **scorer.update** (`(input: StorageUpdateScorerInput) => Promise<MastraScorer>`): Partially update a stored scorer.
125
+
126
+ **scorer.delete** (`(id: string) => Promise<void>`): Delete a stored scorer and remove it from the Mastra runtime registry.
127
+
128
+ **scorer.list** (`(args?: StorageListScorersInput) => Promise<StorageListScorersOutput>`): List stored scorers with optional pagination and filters.
129
+
130
+ **scorer.listResolved** (`(args?: StorageListScorersInput) => Promise<StorageListScorersResolvedOutput>`): Same as list, but returns fully resolved scorer configurations.
131
+
132
+ **scorer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one scorer or all scorers.
133
+
134
+ ## Methods
135
+
136
+ ### Provider access
137
+
138
+ #### `getToolProvider(id)`
139
+
140
+ Returns a registered tool provider by its ID.
141
+
142
+ ```typescript
143
+ const composio = mastra.getEditor()?.getToolProvider('composio')
144
+ ```
145
+
146
+ #### `getToolProviders()`
147
+
148
+ Returns all registered tool providers as a `Record<string, ToolProvider>`.
149
+
150
+ #### `getProcessorProvider(id)`
151
+
152
+ Returns a registered processor provider by its ID.
153
+
154
+ #### `getProcessorProviders()`
155
+
156
+ Returns all registered processor providers.
157
+
158
+ #### `getFilesystemProviders()`
159
+
160
+ Returns all registered filesystem providers.
161
+
162
+ #### `getSandboxProviders()`
163
+
164
+ Returns all registered sandbox providers.
165
+
166
+ #### `getBlobStoreProviders()`
167
+
168
+ Returns all registered blob store providers.
@@ -0,0 +1,85 @@
1
+ # ToolProvider
2
+
3
+ The `ToolProvider` interface defines how the editor discovers and resolves integration tools from external platforms. Mastra ships with two built-in implementations: `ComposioToolProvider` and `ArcadeToolProvider`.
4
+
5
+ See [Tools](https://mastra.ai/docs/editor/tools) for a guide on setting up tool providers.
6
+
7
+ ## ToolProvider interface
8
+
9
+ Tool providers implement these methods:
10
+
11
+ **listToolkits()** (`() => Promise<Toolkit[]>`): Returns a list of available toolkits (tool categories) from the provider.
12
+
13
+ **listTools(params?)** (`(params?) => Promise<Tool[]>`): Returns a list of available tools. Accepts optional filtering by toolkit, search query, and limit.
14
+
15
+ **getToolSchema(slug)** (`(slug: string) => Promise<JSONSchema>`): Returns the JSON schema for a specific tool identified by its slug.
16
+
17
+ **resolveTools(slugs, options?)** (`(slugs: string[], options?) => Promise<Record<string, ToolAction>>`): Resolves tool slugs into executable Mastra tool actions. The options object can include userId for per-user authentication.
18
+
19
+ ***
20
+
21
+ ## ComposioToolProvider
22
+
23
+ Connects to [Composio](https://composio.dev) for access to hundreds of integration tools.
24
+
25
+ ### Usage example
26
+
27
+ ```typescript
28
+ import { MastraEditor } from '@mastra/editor'
29
+ import { ComposioToolProvider } from '@mastra/editor/providers/composio'
30
+
31
+ const editor = new MastraEditor({
32
+ toolProviders: {
33
+ composio: new ComposioToolProvider({
34
+ apiKey: process.env.COMPOSIO_API_KEY!,
35
+ }),
36
+ },
37
+ })
38
+ ```
39
+
40
+ ### Constructor parameters
41
+
42
+ **apiKey** (`string`): Your Composio API key.
43
+
44
+ ### Tool slugs
45
+
46
+ Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MESSAGE`.
47
+
48
+ ### Authentication
49
+
50
+ Tool execution is scoped to a `userId` passed through request context. Each user authenticates with the integration separately through Composio's auth flow.
51
+
52
+ ***
53
+
54
+ ## ArcadeToolProvider
55
+
56
+ Connects to [Arcade](https://arcade.dev) for a curated tool catalog with built-in authentication.
57
+
58
+ ### Usage example
59
+
60
+ ```typescript
61
+ import { MastraEditor } from '@mastra/editor'
62
+ import { ArcadeToolProvider } from '@mastra/editor/providers/arcade'
63
+
64
+ const editor = new MastraEditor({
65
+ toolProviders: {
66
+ arcade: new ArcadeToolProvider({
67
+ apiKey: process.env.ARCADE_API_KEY!,
68
+ }),
69
+ },
70
+ })
71
+ ```
72
+
73
+ ### Constructor parameters
74
+
75
+ **apiKey** (`string`): Your Arcade API key.
76
+
77
+ **baseURL** (`string`): Custom base URL for the Arcade API.
78
+
79
+ ### Tool slugs
80
+
81
+ Arcade tools use `Toolkit.ToolName` format: `Github.GetRepository`, `Slack.SendMessage`.
82
+
83
+ ### Authentication
84
+
85
+ Like Composio, tool execution requires a `userId` for per-user authorization through Arcade's auth flow.
@@ -191,6 +191,6 @@ Choose the right scorer for your needs:
191
191
 
192
192
  ## Related
193
193
 
194
- - [Answer Relevancy Scorer](https://mastra.ai/reference/evals/answer-relevancy) - Evaluates if answers address the question
195
- - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness) - Measures answer groundedness in context
196
- - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers) - Creating your own evaluation metrics
194
+ - [Answer Relevancy Scorer](https://mastra.ai/reference/evals/answer-relevancy): Evaluates if answers address the question
195
+ - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness): Measures answer groundedness in context
196
+ - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Creating your own evaluation metrics
@@ -526,6 +526,6 @@ Choose the right scorer for your needs:
526
526
 
527
527
  ## Related
528
528
 
529
- - [Context Precision Scorer](https://mastra.ai/reference/evals/context-precision) - Evaluates context ranking using MAP
530
- - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness) - Measures answer groundedness in context
531
- - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers) - Creating your own evaluation metrics
529
+ - [Context Precision Scorer](https://mastra.ai/reference/evals/context-precision): Evaluates context ranking using MAP
530
+ - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness): Measures answer groundedness in context
531
+ - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Creating your own evaluation metrics
@@ -51,6 +51,8 @@ const scorer = createScorer({
51
51
 
52
52
  **type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
53
53
 
54
+ **prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The \[\`filterRun()\`]\(/reference/evals/filter-run) utility creates this function from declarative options. Can be async.
55
+
54
56
  This function returns a scorer builder that you can chain step methods onto. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
55
57
 
56
58
  The judge only runs for steps defined as **prompt objects** (`preprocess`, `analyze`, `generateScore`, `generateReason` in prompt mode). If you use function steps only, the judge is never called and there is no LLM output to inspect. In that case, any score/reason must be produced by your functions.
@@ -164,7 +166,7 @@ The method can return any value. The returned value will be available to subsequ
164
166
 
165
167
  **description** (`string`): Description of what this preprocessing step does.
166
168
 
167
- **outputSchema** (`ZodSchema`): Zod schema for the expected output of the preprocess step.
169
+ **outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for the expected output of the preprocess step.
168
170
 
169
171
  **createPrompt** (`function`): Function: ({ run, results }) => string. Returns the prompt for the LLM.
170
172
 
@@ -193,7 +195,7 @@ The method can return any value. The returned value will be available to subsequ
193
195
 
194
196
  **description** (`string`): Description of what this analysis step does.
195
197
 
196
- **outputSchema** (`ZodSchema`): Zod schema for the expected output of the analyze step.
198
+ **outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for the expected output of the analyze step.
197
199
 
198
200
  **createPrompt** (`function`): Function: ({ run, results }) => string. Returns the prompt for the LLM.
199
201
 
@@ -224,7 +226,7 @@ The method must return a numerical score.
224
226
 
225
227
  **description** (`string`): Description of what this scoring step does.
226
228
 
227
- **outputSchema** (`ZodSchema`): Zod schema for the expected output of the generateScore step.
229
+ **outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for the expected output of the generateScore step.
228
230
 
229
231
  **createPrompt** (`function`): Function: ({ run, results }) => string. Returns the prompt for the LLM.
230
232
 
@@ -0,0 +1,117 @@
1
+ # filterRun()
2
+
3
+ Creates a `prepareRun` function from declarative options. Pass the result to `createScorer()` to filter messages, limit context size, and drop unnecessary fields before the scorer pipeline runs.
4
+
5
+ Use [`filterRun()`](#usage-example) for declarative filtering. Write a custom `prepareRun` function directly when you need imperative logic that `filterRun()` doesn't cover. See [Custom scorers: input filtering](https://mastra.ai/docs/evals/custom-scorers) for more.
6
+
7
+ ## Usage example
8
+
9
+ The following example creates a scorer that only sees tool invocations and text messages, limited to the 20 most recent context messages:
10
+
11
+ ```typescript
12
+ import { createScorer, filterRun } from '@mastra/core/evals'
13
+
14
+ const toolScorer = createScorer({
15
+ id: 'tool-usage',
16
+ description: 'Evaluates tool usage patterns',
17
+ type: 'agent',
18
+ prepareRun: filterRun({
19
+ partTypes: ['tool-invocation', 'text'],
20
+ maxRememberedMessages: 20,
21
+ }),
22
+ }).generateScore(({ run }) => {
23
+ // run.input.rememberedMessages contains only tool and text messages
24
+ // run.output contains only tool and text messages
25
+ return 1
26
+ })
27
+ ```
28
+
29
+ ### Filter by tool name
30
+
31
+ Keep only messages involving specific tools:
32
+
33
+ ```typescript
34
+ import { createScorer, filterRun } from '@mastra/core/evals'
35
+
36
+ const fileEditScorer = createScorer({
37
+ id: 'file-edit-quality',
38
+ description: 'Evaluates file editing patterns',
39
+ type: 'agent',
40
+ prepareRun: filterRun({
41
+ toolNames: ['write_file', 'string_replace_lsp', 'view'],
42
+ }),
43
+ }).generateScore(({ run }) => {
44
+ // Only messages with these tool calls remain
45
+ return 1
46
+ })
47
+ ```
48
+
49
+ ### Drop fields
50
+
51
+ Remove fields the scorer doesn't need:
52
+
53
+ ```typescript
54
+ import { createScorer, filterRun } from '@mastra/core/evals'
55
+
56
+ const simpleScorer = createScorer({
57
+ id: 'response-length',
58
+ description: 'Checks response length',
59
+ type: 'agent',
60
+ prepareRun: filterRun({
61
+ dropRequestContext: true,
62
+ dropExpectedTrajectory: true,
63
+ dropGroundTruth: true,
64
+ maxOutputMessages: 5,
65
+ }),
66
+ }).generateScore(({ run }) => {
67
+ return run.output.length > 0 ? 1 : 0
68
+ })
69
+ ```
70
+
71
+ ## Parameters
72
+
73
+ **options** (`FilterRunOptions`): Configuration object that controls what data the scorer receives.
74
+
75
+ **options.partTypes** (`MastraPartType[]`): Keep only messages whose parts match these types. Each entry is prefix-matched against the message part's type. Plain text messages (no tool invocations) are always kept unless explicitly excluded. System messages and tagged system messages are never filtered.
76
+
77
+ **options.toolNames** (`string[]`): Keep only tool-invocation messages for these specific tools. Each entry is prefix-matched against the tool name. Non-tool messages (text, data) are unaffected.
78
+
79
+ **options.maxRememberedMessages** (`number`): Maximum number of messages to keep in remembered messages (context). Takes from the end (most recent). Applied after type and tool filtering.
80
+
81
+ **options.maxOutputMessages** (`number`): Maximum number of messages to keep in the output. Takes from the end. Applied after type and tool filtering.
82
+
83
+ **options.dropRequestContext** (`boolean`): Remove request context from the run entirely.
84
+
85
+ **options.dropExpectedTrajectory** (`boolean`): Remove expected trajectory from the run.
86
+
87
+ **options.dropGroundTruth** (`boolean`): Remove ground truth from the run.
88
+
89
+ **Returns:** `(run: ScorerRun) => ScorerRun` — A function suitable for the `prepareRun` option on [`createScorer()`](https://mastra.ai/reference/evals/create-scorer).
90
+
91
+ ## Part types
92
+
93
+ The `partTypes` option accepts `MastraPartType` values. Each value is prefix-matched, so `'data-'` matches all data part types.
94
+
95
+ | Type | Description |
96
+ | ------------------- | -------------------------------------------- |
97
+ | `'text'` | Text content parts |
98
+ | `'tool-invocation'` | Tool call and result parts |
99
+ | `'reasoning'` | Chain-of-thought reasoning parts |
100
+ | `'step-start'` | Step marker parts |
101
+ | `'image'` | Image parts |
102
+ | `'file'` | File parts |
103
+ | `'source'` | Source reference parts |
104
+ | `'source-document'` | Source document parts |
105
+ | `'data-'` | All data parts (matches any `data-*` prefix) |
106
+ | `'data-om-'` | Observational memory data parts |
107
+ | `'data-workspace-'` | Workspace data parts |
108
+ | `'data-sandbox-'` | Sandbox data parts |
109
+ | `'data-tool-'` | Tool-related data parts |
110
+
111
+ ## Filtering behavior
112
+
113
+ - **Part type filtering** applies to both `input.rememberedMessages` and `output` when they contain agent message arrays.
114
+ - **Tool name filtering** only affects messages that contain tool invocations. Text-only messages pass through.
115
+ - **System messages** (`systemMessages`, `taggedSystemMessages`) are never filtered, regardless of `partTypes` or `toolNames`.
116
+ - **Message limits** (`maxRememberedMessages`, `maxOutputMessages`) apply after type and tool filtering, taking the most recent messages.
117
+ - When both `partTypes` and `toolNames` are set, a message must satisfy both filters to be kept.
@@ -73,10 +73,10 @@ const result = await scorer.run({
73
73
 
74
74
  When you call `.run()`, the MastraScorer executes the defined steps in this order:
75
75
 
76
- 1. **preprocess** (optional) - Extracts or transforms data
77
- 2. **analyze** (optional) - Processes the input/output and preprocessed data
78
- 3. **generateScore** (required) - Computes the numerical score
79
- 4. **generateReason** (optional) - Provides explanation for the score
76
+ 1. **preprocess** (optional): Extracts or transforms data
77
+ 2. **analyze** (optional): Processes the input/output and preprocessed data
78
+ 3. **generateScore** (required): Computes the numerical score
79
+ 4. **generateReason** (optional): Provides explanation for the score
80
80
 
81
81
  Each step receives the results from previous steps, allowing you to build complex evaluation pipelines.
82
82
 
@@ -115,7 +115,7 @@ Checks if noise causes the agent to generate false or fabricated information tha
115
115
  ### Formula
116
116
 
117
117
  ```text
118
- Final Score = max(0, min(llm_score, calculated_score) - issues_penalty)
118
+ Final Score = max(0, min(llm_score, calculated_score): issues_penalty)
119
119
  ```
120
120
 
121
121
  Where:
@@ -661,7 +661,7 @@ jobs:
661
661
  - run: npm run test:noise-sensitivity
662
662
  - name: Check robustness threshold
663
663
  run: |
664
- if [ $(npm run test:noise-sensitivity -- --json | jq '.score') -lt 0.8 ]; then
664
+ if [ $(npm run test:noise-sensitivity -- --json | jq '.score'):lt 0.8 ]; then
665
665
  echo "Agent failed noise sensitivity threshold"
666
666
  exit 1
667
667
  fi
@@ -669,7 +669,7 @@ jobs:
669
669
 
670
670
  ## Related
671
671
 
672
- - [Scorers Overview](https://mastra.ai/docs/evals/overview) - Setting up scorer pipelines
673
- - [Hallucination Scorer](https://mastra.ai/reference/evals/hallucination) - Evaluates fabricated content
674
- - [Answer Relevancy Scorer](https://mastra.ai/reference/evals/answer-relevancy) - Measures response focus
675
- - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers) - Creating your own evaluation metrics
672
+ - [Scorers Overview](https://mastra.ai/docs/evals/overview): Setting up scorer pipelines
673
+ - [Hallucination Scorer](https://mastra.ai/reference/evals/hallucination): Evaluates fabricated content
674
+ - [Answer Relevancy Scorer](https://mastra.ai/reference/evals/answer-relevancy): Measures response focus
675
+ - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Creating your own evaluation metrics