@mastra/mcp-docs-server 1.3.6-alpha.1 → 1.3.6-alpha.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 (105) hide show
  1. package/.docs/docs/agents/human-in-the-loop.md +5 -3
  2. package/.docs/docs/agents/processors.md +7 -3
  3. package/.docs/docs/agents/tools.md +24 -0
  4. package/.docs/docs/memory/memory-processors.md +2 -5
  5. package/.docs/docs/memory/semantic-recall.md +2 -2
  6. package/.docs/docs/memory/working-memory.md +16 -0
  7. package/.docs/docs/observability/tracing/overview.md +1 -1
  8. package/.docs/docs/subagents.md +10 -8
  9. package/.docs/docs/workflows/control-flow.md +1 -1
  10. package/.docs/docs/workflows/time-travel.md +5 -3
  11. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +60 -0
  12. package/.docs/integrations/deploy/temporal.md +23 -0
  13. package/.docs/models/embeddings.md +1 -1
  14. package/.docs/models/gateways/merge-gateway.md +2 -1
  15. package/.docs/models/gateways/netlify.md +2 -1
  16. package/.docs/models/gateways/openrouter.md +2 -1
  17. package/.docs/models/gateways/vercel.md +3 -5
  18. package/.docs/models/index.md +1 -1
  19. package/.docs/models/providers/alibaba.md +1 -1
  20. package/.docs/models/providers/anthropic.md +4 -3
  21. package/.docs/models/providers/berget.md +1 -1
  22. package/.docs/models/providers/coralbricks.md +1 -2
  23. package/.docs/models/providers/cortecs.md +3 -1
  24. package/.docs/models/providers/crossmodel.md +2 -1
  25. package/.docs/models/providers/edenai.md +5 -3
  26. package/.docs/models/providers/kilo.md +12 -10
  27. package/.docs/models/providers/llmgateway-providers.md +4 -2
  28. package/.docs/models/providers/llmgateway.md +2 -1
  29. package/.docs/models/providers/mistral.md +9 -16
  30. package/.docs/models/providers/nano-gpt.md +29 -29
  31. package/.docs/models/providers/ollama-cloud.md +2 -1
  32. package/.docs/models/providers/opencode-go.md +5 -4
  33. package/.docs/models/providers/opencode.md +2 -1
  34. package/.docs/models/providers/ovhcloud.md +1 -2
  35. package/.docs/models/providers/requesty.md +6 -4
  36. package/.docs/models/providers/vivgrid.md +2 -1
  37. package/.docs/reference/agents/generate.md +1 -1
  38. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +3 -3
  39. package/.docs/reference/classifier/classifier.md +35 -35
  40. package/.docs/reference/client-js/memory.md +13 -1
  41. package/.docs/reference/configuration.md +2 -2
  42. package/.docs/reference/connect/providers.md +118 -112
  43. package/.docs/reference/core/getClassifier.md +1 -1
  44. package/.docs/reference/datasets/updateItem.md +10 -0
  45. package/.docs/reference/deployer/vercel.md +1 -1
  46. package/.docs/reference/deployer.md +7 -14
  47. package/.docs/reference/editor/blob-store-provider.md +2 -1
  48. package/.docs/reference/editor/browser-provider.md +3 -2
  49. package/.docs/reference/editor/filesystem-provider.md +2 -1
  50. package/.docs/reference/editor/processor-provider.md +2 -2
  51. package/.docs/reference/editor/sandbox-provider.md +2 -1
  52. package/.docs/reference/editor/storage-workspace-ref.md +27 -2
  53. package/.docs/reference/evals/answer-relevancy.md +4 -2
  54. package/.docs/reference/evals/answer-similarity.md +1 -1
  55. package/.docs/reference/evals/bias.md +3 -1
  56. package/.docs/reference/evals/content-similarity.md +1 -1
  57. package/.docs/reference/evals/context-recall.md +1 -1
  58. package/.docs/reference/evals/context-relevance.md +6 -6
  59. package/.docs/reference/evals/create-classifier-scorer.md +5 -5
  60. package/.docs/reference/evals/hallucination.md +7 -8
  61. package/.docs/reference/evals/keyword-coverage.md +4 -4
  62. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  63. package/.docs/reference/evals/prompt-alignment.md +1 -1
  64. package/.docs/reference/evals/run-evals.md +1 -1
  65. package/.docs/reference/evals/scorer-utils.md +8 -8
  66. package/.docs/reference/evals/tone-consistency.md +23 -24
  67. package/.docs/reference/evals/tool-call-accuracy.md +19 -15
  68. package/.docs/reference/evals/toxicity.md +3 -1
  69. package/.docs/reference/logging/pino-logger.md +4 -4
  70. package/.docs/reference/memory/deleteMessages.md +1 -1
  71. package/.docs/reference/memory/memory-class.md +2 -2
  72. package/.docs/reference/memory/summarizeConversation.md +1 -1
  73. package/.docs/reference/migrations/ai-sdk-v4-to-v5.md +2 -2
  74. package/.docs/reference/migrations/upgrade-to-v1/mcp.md +2 -0
  75. package/.docs/reference/migrations/upgrade-to-v1/memory.md +1 -1
  76. package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
  77. package/.docs/reference/observability/tracing/configuration.md +10 -1
  78. package/.docs/reference/observability/tracing/instances.md +1 -1
  79. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  80. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  81. package/.docs/reference/processors/classifier-processor.md +6 -6
  82. package/.docs/reference/processors/message-history-processor.md +3 -2
  83. package/.docs/reference/processors/model-selection-processor.md +11 -11
  84. package/.docs/reference/processors/response-cache.md +1 -1
  85. package/.docs/reference/processors/semantic-recall-processor.md +2 -3
  86. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  87. package/.docs/reference/processors/working-memory-processor.md +3 -2
  88. package/.docs/reference/project-structure.md +11 -13
  89. package/.docs/reference/pubsub/unix-socket-pubsub.md +6 -2
  90. package/.docs/reference/rag/chunk.md +2 -2
  91. package/.docs/reference/rag/chunking-and-embedding.md +1 -1
  92. package/.docs/reference/rag/database-config.md +14 -2
  93. package/.docs/reference/rag/document.md +7 -2
  94. package/.docs/reference/rag/extract-params.md +5 -5
  95. package/.docs/reference/rag/graph-rag-guide.md +1 -1
  96. package/.docs/reference/rag/metadata-filters.md +1 -1
  97. package/.docs/reference/rag/rerank.md +5 -4
  98. package/.docs/reference/rag/rerankWithScorer.md +2 -2
  99. package/.docs/reference/rag/retrieval.md +7 -5
  100. package/.docs/reference/rag/vector-databases.md +1 -1
  101. package/.docs/reference/server/mastra-server.md +2 -2
  102. package/.docs/reference/streaming/agents/stream.md +1 -1
  103. package/.docs/reference/workflows/run-methods/restart.md +6 -0
  104. package/.docs/reference/workflows/step.md +1 -1
  105. package/package.json +6 -6
@@ -34,10 +34,20 @@ const updated = await dataset.updateItem({
34
34
 
35
35
  **groundTruth** (`unknown`): Updated ground truth.
36
36
 
37
+ **expectedTrajectory** (`unknown`): Updated expected trajectory for trajectory scorers.
38
+
39
+ **toolMocks** (`DatasetItemToolMock[]`): Updated static tool mocks used during experiments. Each mock has toolName, args, output, and an optional matchArgs ('strict' | 'ignore').
40
+
41
+ **unmockedToolPolicy** (`'allow' | 'deny'`): Overrides how the experiment handles tool calls that are not declared in toolMocks.
42
+
43
+ **requestContext** (`Record<string, unknown>`): Updated request context applied when the item runs.
44
+
37
45
  **scorerIds** (`string[] | null`): Scorer IDs that override dataset-attached scorers for this item. Use \[] to run no scorers, null to remove the override and restore dataset inheritance, or omit the field to preserve the current value.
38
46
 
39
47
  **metadata** (`Record<string, unknown>`): Updated metadata.
40
48
 
49
+ **source** (`{ type: 'csv' | 'json' | 'trace' | 'llm' | 'experiment-result' | 'candidate-screener'; referenceId?: string }`): Updated provenance of the item.
50
+
41
51
  ## Returns
42
52
 
43
53
  **result** (`Promise<DatasetItem>`): The updated dataset item. See dataset.addItem() for the item shape.
@@ -115,6 +115,6 @@ With `studio: true`:
115
115
  └── node_modules/
116
116
  ```
117
117
 
118
- When studio is enabled, the routing is configured so that `/api/*` requests are handled by the serverless function, static assets (JS, CSS) are served from Vercel's Edge CDN with no function invocations, and all other paths fall back to `index.html` for client-side routing.
118
+ When studio is enabled, the routing is configured so that `/` and the Studio routes listed in the Studio build's route manifest are served from `index.html` for client-side routing, and static assets (JS, CSS) are served from Vercel's Edge CDN with no function invocations. All other paths, including `/api/*` and custom routes registered with `registerApiRoute()`, are handled by the serverless function. Custom routes that fall under a Studio route (for example, `/agents/custom`) are served from `index.html` instead, so register custom routes outside Studio's route roots.
119
119
 
120
120
  This folder is generated during build and shouldn't be committed to version control.
@@ -44,7 +44,7 @@ class CustomDeployer extends Deployer {
44
44
 
45
45
  ## Methods
46
46
 
47
- **getEnvFiles** (`() => Promise<string[]>`): Returns a list of environment files to be used during deployment. By default, it looks for '.env.production' and '.env' files.
47
+ **getEnvFiles** (`() => Promise<string[]>`): Returns the environment files to be used during deployment. By default, it returns every existing file among '.env', '.env.local', and '.env.production', in that order (lowest to highest precedence).
48
48
 
49
49
  **deploy** (`(outputDirectory: string) => Promise<void>`): Abstract method that must be implemented by subclasses. Handles the deployment process to the specified output directory.
50
50
 
@@ -65,7 +65,7 @@ The Deployer class inherits the following key methods from the Bundler class:
65
65
  The Deployer abstract class implements a structured deployment lifecycle:
66
66
 
67
67
  1. **Initialization**: The deployer is initialized with a name and creates a Deps instance for dependency management.
68
- 2. **Environment Setup**: The `getEnvFiles` method identifies environment files (.env.production, .env) to be used during deployment.
68
+ 2. **Environment Setup**: The `getEnvFiles` method identifies the environment files (`.env`, `.env.local`, `.env.production`) to be used during deployment.
69
69
  3. **Preparation**: The `prepare` method (inherited from Bundler) cleans the output directory and creates necessary subdirectories.
70
70
  4. **Bundling**: The `_bundle` method (inherited from Bundler) packages the application code and its dependencies.
71
71
  5. **Deployment**: The abstract `deploy` method is implemented by subclasses to handle the actual deployment process.
@@ -74,23 +74,16 @@ The Deployer abstract class implements a structured deployment lifecycle:
74
74
 
75
75
  The Deployer class includes built-in support for environment file management through the `getEnvFiles` method. This method:
76
76
 
77
- - Looks for environment files in a predefined order (.env.production, .env)
78
- - Uses the FileService to find the first existing file
79
- - Returns an array of found environment files
77
+ - Looks for environment files in a predefined order, from lowest to highest precedence: `.env`, `.env.local`, `.env.production`
78
+ - Returns every file that exists, in that order, so values in later files override earlier ones
80
79
  - Returns an empty array if no environment files are found
81
80
 
82
81
  ```typescript
83
82
  getEnvFiles(): Promise<string[]> {
84
- const possibleFiles = ['.env.production', '.env.local', '.env'];
83
+ const possibleFiles = ['.env', '.env.local', '.env.production'];
84
+ const fileService = new FileService();
85
85
 
86
- try {
87
- const fileService = new FileService();
88
- const envFile = fileService.getFirstExistingFile(possibleFiles);
89
-
90
- return Promise.resolve([envFile]);
91
- } catch {}
92
-
93
- return Promise.resolve([]);
86
+ return Promise.resolve(fileService.getExistingFiles(possibleFiles));
94
87
  }
95
88
  ```
96
89
 
@@ -36,7 +36,8 @@ new MastraEditor({
36
36
  ## Implementing a provider
37
37
 
38
38
  ```typescript
39
- import type { BlobStore, BlobStoreProvider } from '@mastra/core/editor'
39
+ import type { BlobStoreProvider } from '@mastra/core/editor'
40
+ import type { BlobStore } from '@mastra/core/storage'
40
41
 
41
42
  export const myBlobStoreProvider: BlobStoreProvider<{ bucket: string; region: string }> = {
42
43
  id: 'my-blob-store',
@@ -31,12 +31,13 @@ new MastraEditor({
31
31
 
32
32
  **configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
33
33
 
34
- **createBrowser** (`(config: TConfig) => MastraBrowser | Promise<MastraBrowser>`): Create a runtime MastraBrowser instance from the stored config. Called once per agent hydration; the resulting instance is cached alongside the agent.
34
+ **createBrowser** (`(config: TConfig) => MastraBrowser | Promise<MastraBrowser>`): Create a runtime MastraBrowser instance from the stored config. For a static browser config, it is called once per agent hydration and the resulting instance is cached alongside the agent.
35
35
 
36
36
  ## Implementing a provider
37
37
 
38
38
  ```typescript
39
- import type { BrowserProvider, MastraBrowser } from '@mastra/core/editor'
39
+ import type { BrowserProvider } from '@mastra/core/editor'
40
+ import type { MastraBrowser } from '@mastra/core/browser'
40
41
 
41
42
  export const myBrowserProvider: BrowserProvider<{ apiKey: string }> = {
42
43
  id: 'my-browser',
@@ -36,7 +36,8 @@ new MastraEditor({
36
36
  ## Implementing a provider
37
37
 
38
38
  ```typescript
39
- import type { FilesystemProvider, WorkspaceFilesystem } from '@mastra/core/editor'
39
+ import type { FilesystemProvider } from '@mastra/core/editor'
40
+ import type { WorkspaceFilesystem } from '@mastra/core/workspace'
40
41
 
41
42
  export const myFilesystemProvider: FilesystemProvider<{ bucket: string; region: string }> = {
42
43
  id: 'my-fs',
@@ -15,11 +15,11 @@ Providers are supplied via `MastraEditorConfig.processorProviders`.
15
15
 
16
16
  ```typescript
17
17
  import { MastraEditor } from '@mastra/editor'
18
- import { moderationProcessorProvider } from '@mastra/processors/moderation'
18
+ import { moderationProvider } from '@mastra/core/processor-provider'
19
19
 
20
20
  new MastraEditor({
21
21
  processorProviders: {
22
- moderation: moderationProcessorProvider,
22
+ moderation: moderationProvider,
23
23
  },
24
24
  })
25
25
  ```
@@ -36,7 +36,8 @@ new MastraEditor({
36
36
  ## Implementing a provider
37
37
 
38
38
  ```typescript
39
- import type { SandboxProvider, WorkspaceSandbox } from '@mastra/core/editor'
39
+ import type { SandboxProvider } from '@mastra/core/editor'
40
+ import type { WorkspaceSandbox } from '@mastra/core/workspace'
40
41
 
41
42
  export const mySandboxProvider: SandboxProvider<{ apiKey: string }> = {
42
43
  id: 'my-sandbox',
@@ -4,7 +4,7 @@
4
4
 
5
5
  # StorageWorkspaceRef
6
6
 
7
- `StorageWorkspaceRef` is the discriminated union used to attach a workspace to a stored agent. It either points at a workspace registered on the Mastra runtime by ID, or embeds a workspace snapshot inline.
7
+ `StorageWorkspaceRef` is the discriminated union used to attach a workspace to a stored agent. It points at a workspace registered on the Mastra runtime by ID, embeds a workspace snapshot inline, or names a workspace provider registered on `MastraEditor.workspaces` that builds the workspace.
8
8
 
9
9
  It's the type used by [`BuilderAgentDefaults.workspace`](https://agent-builder.mastra.ai/reference/builder-agent-defaults) and by stored agent records.
10
10
 
@@ -45,6 +45,23 @@ new MastraEditor({
45
45
  },
46
46
  },
47
47
  })
48
+
49
+ // Variant 3 — build the workspace with a registered workspace provider
50
+ new MastraEditor({
51
+ workspaces: { 'my-provider': myWorkspaceProvider },
52
+ builder: {
53
+ enabled: true,
54
+ configuration: {
55
+ agent: {
56
+ workspace: {
57
+ type: 'provider',
58
+ provider: 'my-provider',
59
+ config: { region: 'us-east-1' },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ })
48
65
  ```
49
66
 
50
67
  ## Variants
@@ -61,6 +78,14 @@ new MastraEditor({
61
78
 
62
79
  **{ type: 'inline'; config: StorageWorkspaceSnapshotType }.config** (`StorageWorkspaceSnapshotType`): Serialized workspace configuration (filesystem, sandbox, mounts, search, skills, tools). See the StorageWorkspaceSnapshotType section below for the field list.
63
80
 
81
+ **{ type: 'provider'; provider: string; config: Record\<string, unknown> }** (`ProviderRef`): Build the entire workspace with a workspace provider registered on MastraEditor.workspaces. The ref is stored as-is in the agent snapshot; no separate workspace record is persisted.
82
+
83
+ **{ type: 'provider'; provider: string; config: Record\<string, unknown> }.type** (`'provider'`): Discriminant. Must be the literal "provider".
84
+
85
+ **{ type: 'provider'; provider: string; config: Record\<string, unknown> }.provider** (`string`): Id of a workspace provider registered via new MastraEditor({ workspaces }).
86
+
87
+ **{ type: 'provider'; provider: string; config: Record\<string, unknown> }.config** (`Record<string, unknown>`): Provider-specific configuration passed to the provider's createWorkspace(config).
88
+
64
89
  ## `StorageWorkspaceSnapshotType`
65
90
 
66
91
  The shape embedded under `{ type: 'inline', config }`. Defined in `@mastra/core/storage`.
@@ -87,7 +112,7 @@ The shape embedded under `{ type: 'inline', config }`. Defined in `@mastra/core/
87
112
 
88
113
  ## Hydration
89
114
 
90
- `StorageWorkspaceRef` is resolved lazily on `mastra.editor.agent.getById()`, not on `list()`. The editor looks up filesystem and sandbox providers on `MastraEditor.filesystems` / `MastraEditor.sandboxes` and materializes a runtime `Workspace`. Missing providers surface as a warning and the workspace is omitted.
115
+ `StorageWorkspaceRef` is resolved lazily on `mastra.editor.agent.getById()`, not on `list()`. The editor looks up filesystem and sandbox providers on `MastraEditor.filesystems` / `MastraEditor.sandboxes` and materializes a runtime `Workspace`. Missing providers surface as a warning and the workspace is omitted. For `{ type: 'provider' }` refs, the editor calls `createWorkspace(config)` on the provider registered on `MastraEditor.workspaces`. An unregistered provider throws an error.
91
116
 
92
117
  ## Related
93
118
 
@@ -10,9 +10,11 @@ The `createAnswerRelevancyScorer()` function accepts a single options object wit
10
10
 
11
11
  **model** (`LanguageModel`): Configuration for the model used to evaluate relevancy.
12
12
 
13
- **uncertaintyWeight** (`number`): Weight given to 'unsure' verdicts in scoring (0-1). (Default: `0.3`)
13
+ **options** (`Record<'uncertaintyWeight' | 'scale', number>`): Configuration options for the scorer. (Default: `{ uncertaintyWeight: 0.3, scale: 1 }`)
14
14
 
15
- **scale** (`number`): Maximum score value. (Default: `1`)
15
+ **options.uncertaintyWeight** (`number`): Weight given to 'unsure' verdicts in scoring (0-1).
16
+
17
+ **options.scale** (`number`): Maximum score value.
16
18
 
17
19
  This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but the return value includes LLM-specific fields as documented below.
18
20
 
@@ -26,7 +26,7 @@ The `createAnswerSimilarityScorer()` function creates a scorer that evaluates ho
26
26
 
27
27
  **options.scale** (`number`): Score scaling factor.
28
28
 
29
- This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but **requires ground truth** to be provided in the run object.
29
+ This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but expects ground truth to be provided in the run object. When `options.requireGroundTruth` is `true` (the default), a run without ground truth throws an error. Set it to `false` to score runs without ground truth as 0.
30
30
 
31
31
  ## `.run()` returns
32
32
 
@@ -10,7 +10,9 @@ The `createBiasScorer()` function accepts a single options object with the follo
10
10
 
11
11
  **model** (`LanguageModel`): Configuration for the model used to evaluate bias.
12
12
 
13
- **scale** (`number`): Maximum score value. (Default: `1`)
13
+ **options** (`BiasMetricOptions`): Configuration options for the scorer.
14
+
15
+ **options.scale** (`number`): Maximum score value.
14
16
 
15
17
  This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but the return value includes LLM-specific fields as documented below.
16
18
 
@@ -44,7 +44,7 @@ The scorer evaluates textual similarity through character-level matching and con
44
44
  - Considers relative positions
45
45
  - Accounts for length differences
46
46
 
47
- Final score: `similarity_value * scale`
47
+ Final score: `similarity_value` (0-1, returned directly from the string-similarity comparison)
48
48
 
49
49
  ## Example
50
50
 
@@ -30,7 +30,7 @@ Use when running evaluations against curated test sets:
30
30
 
31
31
  **options** (`ContextRecallMetricOptions`): Configuration options for the scorer
32
32
 
33
- Either `context` or `contextExtractor` must be provided. When both are provided, `contextExtractor` is used only if the run input and output are agent-shaped (`MastraDBMessage[]`); otherwise the scorer falls back to `context`.
33
+ Either `context` or `contextExtractor` must be provided. When both are provided, `contextExtractor` is used only if the run input and output are agent-shaped: the input must be an agent run-input object (`{ inputMessages, rememberedMessages, systemMessages, taggedSystemMessages }`) and the output must be a `MastraDBMessage[]`. Otherwise the scorer falls back to `context`.
34
34
 
35
35
  ## `.run()` returns
36
36
 
@@ -119,7 +119,7 @@ Use results to improve your system:
119
119
  Control how penalties are applied for unused and missing context:
120
120
 
121
121
  ```typescript
122
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
122
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
123
123
 
124
124
  // Stricter penalty configuration
125
125
  const strictScorer = createContextRelevanceScorerLLM({
@@ -249,7 +249,7 @@ const scorer = createContextRelevanceScorerLLM({
249
249
  This example shows excellent context relevance where all context directly supports the response:
250
250
 
251
251
  ```typescript
252
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
252
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
253
253
 
254
254
  const scorer = createContextRelevanceScorerLLM({
255
255
  model: 'openai/gpt-5.6-sol',
@@ -296,7 +296,7 @@ console.log(result)
296
296
  This example shows moderate relevance with some context being irrelevant or unused:
297
297
 
298
298
  ```typescript
299
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
299
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
300
300
 
301
301
  const scorer = createContextRelevanceScorerLLM({
302
302
  model: 'openai/gpt-5.6-sol',
@@ -385,7 +385,7 @@ console.log(customResult)
385
385
  This example shows poor context relevance with mostly irrelevant information:
386
386
 
387
387
  ```typescript
388
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
388
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
389
389
 
390
390
  const scorer = createContextRelevanceScorerLLM({
391
391
  model: 'openai/gpt-5.6-sol',
@@ -433,7 +433,7 @@ console.log(result)
433
433
  Extract context at runtime based on the run input:
434
434
 
435
435
  ```typescript
436
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
436
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
437
437
 
438
438
  const scorer = createContextRelevanceScorerLLM({
439
439
  model: 'openai/gpt-5.6-sol',
@@ -476,7 +476,7 @@ const scorer = createContextRelevanceScorerLLM({
476
476
  Integrate with RAG pipelines to evaluate retrieved context:
477
477
 
478
478
  ```typescript
479
- import { createContextRelevanceScorerLLM } from '@mastra/evals'
479
+ import { createContextRelevanceScorerLLM } from '@mastra/evals/scorers/prebuilt'
480
480
 
481
481
  const scorer = createContextRelevanceScorerLLM({
482
482
  model: 'openai/gpt-5.6-sol',
@@ -8,7 +8,7 @@
8
8
 
9
9
  The adapter evaluates exactly one question and always returns a score between 0 and 1. It doesn't aggregate questions, apply boolean thresholds, infer choice ordering, or call a second judge model.
10
10
 
11
- Agent scorer runs contain message objects that `Classifier.evaluate()` can't accept directly, so `state` is required. Use it to extract JSON-compatible text, for example with the helpers from `@mastra/evals/scorers/utils`.
11
+ Agent scorer runs contain message objects that `Classifier.decide()` can't accept directly, so `state` is required. Use it to extract JSON-compatible text, for example with the helpers from `@mastra/evals/scorers/utils`.
12
12
 
13
13
  ## Example
14
14
 
@@ -23,7 +23,7 @@ import {
23
23
 
24
24
  const responseJudge = new Classifier({
25
25
  id: 'response-judge',
26
- model: typeSafeAi.evaluationModel('jev-latest'),
26
+ model: typeSafeAi.decisionModel('jev-latest'),
27
27
  questions: {
28
28
  quality: {
29
29
  type: 'score',
@@ -165,7 +165,7 @@ Running an ID-backed scorer before registering it with Mastra rejects with an er
165
165
 
166
166
  **maxRetries** (`number`): Classifier model retry count. This is separate from scorer or batch retry policy.
167
167
 
168
- **providerOptions** (`SharedV4ProviderOptions`): Provider-specific options passed to Classifier.evaluate().
168
+ **providerOptions** (`SharedV4ProviderOptions`): Provider-specific options passed to Classifier.decide().
169
169
 
170
170
  **prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transforms scorer run data before the pipeline executes.
171
171
 
@@ -193,9 +193,9 @@ Failures while the scorer runs reject `scorer.run()` with a `ScorerRunError` who
193
193
  - `question`: The selected question key.
194
194
  - `answer`: The exact typed choice, score, or boolean answer, including optional probabilities.
195
195
  - `usage`: Normalized classifier token usage.
196
- - `warnings`, `rounding`, and `providerMetadata`: Evidence returned by the evaluation model.
196
+ - `warnings`, `rounding`, and `providerMetadata`: Evidence returned by the decision model.
197
197
  - `response`: Safe response identity with `id`, `timestamp`, and `modelId`.
198
198
 
199
- Raw provider response bodies and headers aren't copied into scorer results. Call `Classifier.evaluate()` directly when you need the full raw response.
199
+ Raw provider response bodies and headers aren't copied into scorer results. Call `Classifier.decide()` directly when you need the full raw response.
200
200
 
201
201
  Classifier evaluation runs inside the scorer's active trace context.
@@ -46,15 +46,14 @@ The scorer evaluates hallucination through contradiction detection and unsupport
46
46
 
47
47
  ### Scoring Process
48
48
 
49
- 1. Analyzes factual content:
49
+ 1. Extracts claims from the output:
50
50
 
51
- - Extracts statements from context
52
- - Identifies numerical values and dates
53
- - Maps statement relationships
51
+ - Breaks the agent's response into factual claims
52
+ - Includes numerical values and dates
54
53
 
55
- 2. Analyzes output for hallucinations:
54
+ 2. Checks each claim against the provided context:
56
55
 
57
- - Compares against context statements
56
+ - Compares the claim with the context
58
57
  - Marks direct conflicts as hallucinations
59
58
  - Identifies unsupported claims as hallucinations
60
59
  - Evaluates numerical accuracy
@@ -125,7 +124,7 @@ Use `getContext` for live scoring scenarios where context comes from tool result
125
124
 
126
125
  ```typescript
127
126
  import { createHallucinationScorer } from '@mastra/evals/scorers/prebuilt'
128
- import { extractToolResults } from '@mastra/evals/scorers'
127
+ import { extractToolResults } from '@mastra/evals/scorers/utils'
129
128
 
130
129
  const scorer = createHallucinationScorer({
131
130
  model: 'openai/gpt-5.6-sol',
@@ -146,7 +145,7 @@ Attach the scorer to an agent for live evaluation:
146
145
  ```typescript
147
146
  import { Agent } from '@mastra/core/agent'
148
147
  import { createHallucinationScorer } from '@mastra/evals/scorers/prebuilt'
149
- import { extractToolResults } from '@mastra/evals/scorers'
148
+ import { extractToolResults } from '@mastra/evals/scorers/utils'
150
149
 
151
150
  const hallucinationScorer = createHallucinationScorer({
152
151
  model: 'openai/gpt-5.6-sol',
@@ -18,7 +18,7 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
18
18
 
19
19
  **preprocessStepResult** (`object`): Object with extracted keywords: { referenceKeywords: Set\<string>, responseKeywords: Set\<string> }
20
20
 
21
- **analyzeStepResult** (`object`): Object with keyword coverage: { totalKeywords: number, matchedKeywords: number }
21
+ **analyzeStepResult** (`object`): Object with keyword coverage: { totalKeywordsLength: number, matchedKeywordsLength: number }
22
22
 
23
23
  **score** (`number`): Coverage score (0-1) representing the proportion of matched keywords.
24
24
 
@@ -27,13 +27,13 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
27
27
  ```typescript
28
28
  {
29
29
  runId: string,
30
- extractStepResult: {
30
+ preprocessStepResult: {
31
31
  referenceKeywords: Set<string>,
32
32
  responseKeywords: Set<string>
33
33
  },
34
34
  analyzeStepResult: {
35
- totalKeywords: number,
36
- matchedKeywords: number
35
+ totalKeywordsLength: number,
36
+ matchedKeywordsLength: number
37
37
  },
38
38
  score: number
39
39
  }
@@ -292,7 +292,7 @@ describe('Agent Noise Resistance CI Tests', () => {
292
292
  This example shows an agent that completely resists misinformation in a test scenario:
293
293
 
294
294
  ```typescript
295
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
295
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
296
296
 
297
297
  const scorer = createNoiseSensitivityScorerLLM({
298
298
  model: 'openai/gpt-5.6-sol',
@@ -383,7 +383,7 @@ console.log(result)
383
383
  This example shows an agent that incorporates misinformation:
384
384
 
385
385
  ```typescript
386
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
386
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
387
387
 
388
388
  const scorer = createNoiseSensitivityScorerLLM({
389
389
  model: 'openai/gpt-5.6-sol',
@@ -428,7 +428,7 @@ console.log(result)
428
428
  Adjust scoring sensitivity for your specific use case:
429
429
 
430
430
  ```typescript
431
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
431
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
432
432
 
433
433
  // Lenient scoring - more forgiving of minor issues
434
434
  const lenientScorer = createNoiseSensitivityScorerLLM({
@@ -477,7 +477,7 @@ const strictScorer = createNoiseSensitivityScorerLLM({
477
477
  Create detailed test suites to evaluate agent performance across noise categories in your CI pipeline:
478
478
 
479
479
  ```typescript
480
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
480
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
481
481
 
482
482
  const noiseTestCases = [
483
483
  {
@@ -546,7 +546,7 @@ async function evaluateNoiseResistance(testCases) {
546
546
  Use in your CI pipeline to compare noise resistance across different models before deployment:
547
547
 
548
548
  ```typescript
549
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
549
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
550
550
 
551
551
  async function compareModelRobustness() {
552
552
  const models = [
@@ -599,7 +599,7 @@ function getGrade(score) {
599
599
  Include noise sensitivity tests in your security test suite to validate prompt injection resistance:
600
600
 
601
601
  ```typescript
602
- import { createNoiseSensitivityScorerLLM } from '@mastra/evals'
602
+ import { createNoiseSensitivityScorerLLM } from '@mastra/evals/scorers/prebuilt'
603
603
 
604
604
  const scorer = createNoiseSensitivityScorerLLM({
605
605
  model: 'openai/gpt-5.6-sol',
@@ -308,7 +308,7 @@ for (const agent of agents) {
308
308
  ### Basic Configuration
309
309
 
310
310
  ```typescript
311
- import { createPromptAlignmentScorerLLM } from '@mastra/evals'
311
+ import { createPromptAlignmentScorerLLM } from '@mastra/evals/scorers/prebuilt'
312
312
 
313
313
  const scorer = createPromptAlignmentScorerLLM({
314
314
  model: 'openai/gpt-5.6-sol',
@@ -239,7 +239,7 @@ Use `AgentScorerConfig` to evaluate both the agent response and its tool-calling
239
239
 
240
240
  ```typescript
241
241
  import { runEvals } from '@mastra/core/evals'
242
- import { createTrajectoryAccuracyScorerCode } from '@mastra/evals/scorers/code/trajectory'
242
+ import { createTrajectoryAccuracyScorerCode } from '@mastra/evals/scorers/prebuilt'
243
243
 
244
244
  const trajectoryScorer = createTrajectoryAccuracyScorerCode()
245
245
 
@@ -37,7 +37,7 @@ import {
37
37
 
38
38
  ### `getAssistantMessageFromRunOutput`
39
39
 
40
- Extracts the text content from the first assistant message in the run output.
40
+ Extracts the text content from the last assistant message that contains text in the run output. Trailing assistant messages without text (for example, tool-call-only messages) are skipped.
41
41
 
42
42
  ```typescript
43
43
  const scorer = createScorer({
@@ -298,7 +298,7 @@ const trajectory = extractTrajectory(agentOutputMessages)
298
298
  // trajectory.rawOutput — the original MastraDBMessage[] array
299
299
  ```
300
300
 
301
- **Returns:** `Trajectory`: Contains `steps: TrajectoryStep[]`, `totalDurationMs`, and `rawOutput`.
301
+ **Returns:** `Trajectory`: Contains `steps: TrajectoryStep[]` and `rawOutput`.
302
302
 
303
303
  ### `extractWorkflowTrajectory`
304
304
 
@@ -352,12 +352,12 @@ const trajectory = extractTrajectoryFromTrace(traceData.spans, rootSpanId)
352
352
  | `AGENT_RUN` | `agent_run` | `agentId` (from entity ID) |
353
353
  | `WORKFLOW_RUN` | `workflow_run` | `workflowId` (from entity ID) |
354
354
  | `WORKFLOW_STEP` | `workflow_step` | `output` |
355
- | `WORKFLOW_CONDITIONAL` | `workflow_conditional` | `conditionCount`, `selectedSteps` |
356
- | `WORKFLOW_PARALLEL` | `workflow_parallel` | `branchCount`, `parallelSteps` |
357
- | `WORKFLOW_LOOP` | `workflow_loop` | `loopType`, `totalIterations` |
358
- | `WORKFLOW_SLEEP` | `workflow_sleep` | `sleepDurationMs`, `sleepType` |
359
- | `WORKFLOW_WAIT_EVENT` | `workflow_wait_event` | `eventName`, `eventReceived` |
360
- | `PROCESSOR_RUN` | `processor_run` | `processorId` |
355
+ | `WORKFLOW_CONDITIONAL` | `workflow_conditional` | Base fields only (`name`, `durationMs`, `metadata`) |
356
+ | `WORKFLOW_PARALLEL` | `workflow_parallel` | Base fields only (`name`, `durationMs`, `metadata`) |
357
+ | `WORKFLOW_LOOP` | `workflow_loop` | Base fields only (`name`, `durationMs`, `metadata`) |
358
+ | `WORKFLOW_SLEEP` | `workflow_sleep` | Base fields only (`name`, `durationMs`, `metadata`) |
359
+ | `WORKFLOW_WAIT_EVENT` | `workflow_wait_event` | Base fields only (`name`, `durationMs`, `metadata`) |
360
+ | `PROCESSOR_RUN` | `processor_run` | Base fields only (`name`, `durationMs`, `metadata`) |
361
361
 
362
362
  Spans with types `GENERIC`, `MODEL_STEP`, `MODEL_CHUNK`, and `WORKFLOW_CONDITIONAL_EVAL` are skipped as noise.
363
363