@mastra/mcp-docs-server 1.3.5 → 1.3.6-alpha.10

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 (161) hide show
  1. package/.docs/docs/agents/human-in-the-loop.md +5 -3
  2. package/.docs/docs/agents/processors.md +15 -8
  3. package/.docs/docs/agents/tools.md +24 -0
  4. package/.docs/docs/browser.md +0 -2
  5. package/.docs/docs/channels.md +4 -0
  6. package/.docs/docs/evals/experiments.md +3 -0
  7. package/.docs/docs/guides/authentication-identity.md +1 -1
  8. package/.docs/docs/harness/agent-controller.md +29 -0
  9. package/.docs/docs/mastra-platform/connect/channels.md +153 -0
  10. package/.docs/docs/mastra-platform/connect/overview.md +102 -0
  11. package/.docs/docs/mastra-platform/connect/providers.md +149 -0
  12. package/.docs/docs/mastra-platform/connect/tools.md +129 -0
  13. package/.docs/docs/mastra-platform/overview.md +2 -0
  14. package/.docs/docs/memory/memory-processors.md +2 -5
  15. package/.docs/docs/memory/message-history.md +15 -8
  16. package/.docs/docs/memory/observational-memory.md +33 -4
  17. package/.docs/docs/memory/semantic-recall.md +2 -2
  18. package/.docs/docs/memory/working-memory.md +16 -0
  19. package/.docs/docs/observability/feedback.md +20 -0
  20. package/.docs/docs/observability/tracing/overview.md +31 -1
  21. package/.docs/docs/subagents.md +10 -8
  22. package/.docs/docs/workflows/control-flow.md +1 -1
  23. package/.docs/docs/workflows/time-travel.md +5 -3
  24. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +60 -0
  25. package/.docs/integrations/deploy/temporal.md +23 -0
  26. package/.docs/integrations/observability/langfuse.md +2 -0
  27. package/.docs/integrations/sandboxes/docker.md +61 -0
  28. package/.docs/integrations/sandboxes/e2b.md +37 -0
  29. package/.docs/models/embeddings.md +1 -1
  30. package/.docs/models/gateways/merge-gateway.md +2 -1
  31. package/.docs/models/gateways/netlify.md +4 -5
  32. package/.docs/models/gateways/openrouter.md +4 -3
  33. package/.docs/models/gateways/vercel.md +4 -5
  34. package/.docs/models/index.md +1 -1
  35. package/.docs/models/providers/alibaba.md +1 -1
  36. package/.docs/models/providers/anthropic.md +4 -3
  37. package/.docs/models/providers/berget.md +1 -1
  38. package/.docs/models/providers/coralbricks.md +1 -2
  39. package/.docs/models/providers/cortecs.md +5 -2
  40. package/.docs/models/providers/crossmodel.md +2 -1
  41. package/.docs/models/providers/deepinfra.md +0 -2
  42. package/.docs/models/providers/edenai.md +11 -8
  43. package/.docs/models/providers/hyper.md +4 -6
  44. package/.docs/models/providers/kilo.md +20 -18
  45. package/.docs/models/providers/llmgateway-providers.md +6 -2
  46. package/.docs/models/providers/llmgateway.md +4 -1
  47. package/.docs/models/providers/mistral.md +10 -17
  48. package/.docs/models/providers/nano-gpt.md +32 -30
  49. package/.docs/models/providers/neuralwatt.md +3 -1
  50. package/.docs/models/providers/ollama-cloud.md +2 -1
  51. package/.docs/models/providers/opencode-go.md +7 -5
  52. package/.docs/models/providers/opencode.md +3 -2
  53. package/.docs/models/providers/ovhcloud.md +1 -2
  54. package/.docs/models/providers/requesty.md +7 -4
  55. package/.docs/models/providers/vivgrid.md +2 -1
  56. package/.docs/reference/agent-controller/agent-controller-class.md +15 -1
  57. package/.docs/reference/agent-controller/session.md +17 -6
  58. package/.docs/reference/agents/durable-agent.md +2 -0
  59. package/.docs/reference/agents/generate.md +3 -1
  60. package/.docs/reference/agents/inngest-agent.md +1 -1
  61. package/.docs/reference/agents/network.md +2 -0
  62. package/.docs/reference/ai-sdk/chat-route.md +4 -0
  63. package/.docs/reference/ai-sdk/handle-chat-stream.md +3 -1
  64. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +3 -1
  65. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +3 -3
  66. package/.docs/reference/channels/slack-provider.md +1 -1
  67. package/.docs/reference/classifier/classifier.md +35 -35
  68. package/.docs/reference/cli/mastra.md +20 -3
  69. package/.docs/reference/client-js/memory.md +13 -1
  70. package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
  71. package/.docs/reference/configuration.md +2 -2
  72. package/.docs/reference/connect/channels.md +91 -0
  73. package/.docs/reference/connect/credential.md +63 -0
  74. package/.docs/reference/connect/providers.md +1065 -0
  75. package/.docs/reference/connect/tools.md +157 -0
  76. package/.docs/reference/core/getClassifier.md +1 -1
  77. package/.docs/reference/core/mastra-model-gateway.md +10 -2
  78. package/.docs/reference/datasets/addItem.md +2 -2
  79. package/.docs/reference/datasets/datasets-manager.md +1 -0
  80. package/.docs/reference/datasets/delete.md +1 -1
  81. package/.docs/reference/datasets/getExperiment.md +5 -1
  82. package/.docs/reference/datasets/startExperimentAsync.md +1 -0
  83. package/.docs/reference/datasets/updateItem.md +10 -0
  84. package/.docs/reference/deployer/vercel.md +1 -1
  85. package/.docs/reference/deployer.md +7 -14
  86. package/.docs/reference/editor/blob-store-provider.md +2 -1
  87. package/.docs/reference/editor/browser-provider.md +3 -2
  88. package/.docs/reference/editor/filesystem-provider.md +2 -1
  89. package/.docs/reference/editor/processor-provider.md +2 -2
  90. package/.docs/reference/editor/sandbox-provider.md +2 -1
  91. package/.docs/reference/editor/storage-workspace-ref.md +27 -2
  92. package/.docs/reference/evals/answer-relevancy.md +4 -2
  93. package/.docs/reference/evals/answer-similarity.md +1 -1
  94. package/.docs/reference/evals/bias.md +3 -1
  95. package/.docs/reference/evals/content-similarity.md +1 -1
  96. package/.docs/reference/evals/context-recall.md +1 -1
  97. package/.docs/reference/evals/context-relevance.md +6 -6
  98. package/.docs/reference/evals/create-classifier-scorer.md +5 -5
  99. package/.docs/reference/evals/hallucination.md +7 -8
  100. package/.docs/reference/evals/keyword-coverage.md +4 -4
  101. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  102. package/.docs/reference/evals/prompt-alignment.md +1 -1
  103. package/.docs/reference/evals/run-evals.md +1 -1
  104. package/.docs/reference/evals/scorer-utils.md +8 -8
  105. package/.docs/reference/evals/tone-consistency.md +23 -24
  106. package/.docs/reference/evals/tool-call-accuracy.md +19 -15
  107. package/.docs/reference/evals/toxicity.md +3 -1
  108. package/.docs/reference/index.md +6 -0
  109. package/.docs/reference/logging/pino-logger.md +4 -4
  110. package/.docs/reference/memory/deleteMessages.md +1 -1
  111. package/.docs/reference/memory/memory-class.md +2 -2
  112. package/.docs/reference/memory/observational-memory.md +8 -4
  113. package/.docs/reference/memory/summarizeConversation.md +1 -1
  114. package/.docs/reference/migrations/ai-sdk-v4-to-v5.md +2 -2
  115. package/.docs/reference/migrations/upgrade-to-v1/mcp.md +2 -0
  116. package/.docs/reference/migrations/upgrade-to-v1/memory.md +1 -1
  117. package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
  118. package/.docs/reference/observability/tracing/configuration.md +10 -1
  119. package/.docs/reference/observability/tracing/exporters/posthog.md +9 -2
  120. package/.docs/reference/observability/tracing/instances.md +1 -1
  121. package/.docs/reference/observability/tracing/interfaces.md +8 -1
  122. package/.docs/reference/observability/tracing/trace-query.md +46 -20
  123. package/.docs/reference/processors/batch-parts-processor.md +1 -1
  124. package/.docs/reference/processors/classifier-processor.md +6 -6
  125. package/.docs/reference/processors/file-upload-processor.md +236 -0
  126. package/.docs/reference/processors/message-history-processor.md +3 -2
  127. package/.docs/reference/processors/model-selection-processor.md +11 -11
  128. package/.docs/reference/processors/processor-interface.md +2 -0
  129. package/.docs/reference/processors/response-cache.md +1 -1
  130. package/.docs/reference/processors/semantic-recall-processor.md +2 -3
  131. package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
  132. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  133. package/.docs/reference/processors/unsupported-file-handler.md +69 -0
  134. package/.docs/reference/processors/working-memory-processor.md +3 -2
  135. package/.docs/reference/project-structure.md +11 -13
  136. package/.docs/reference/pubsub/unix-socket-pubsub.md +6 -2
  137. package/.docs/reference/rag/chunk.md +2 -2
  138. package/.docs/reference/rag/chunking-and-embedding.md +1 -1
  139. package/.docs/reference/rag/database-config.md +14 -2
  140. package/.docs/reference/rag/document.md +7 -2
  141. package/.docs/reference/rag/extract-params.md +5 -5
  142. package/.docs/reference/rag/graph-rag-guide.md +1 -1
  143. package/.docs/reference/rag/metadata-filters.md +1 -1
  144. package/.docs/reference/rag/rerank.md +5 -4
  145. package/.docs/reference/rag/rerankWithScorer.md +2 -2
  146. package/.docs/reference/rag/retrieval.md +7 -5
  147. package/.docs/reference/rag/vector-databases.md +1 -1
  148. package/.docs/reference/server/mastra-server.md +2 -2
  149. package/.docs/reference/streaming/agents/stream.md +3 -1
  150. package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
  151. package/.docs/reference/streaming/workflows/stream.md +2 -0
  152. package/.docs/reference/tools/ask-user-tool.md +5 -1
  153. package/.docs/reference/tools/isolated-vm-transport.md +0 -2
  154. package/.docs/reference/tools/quickjs-transport.md +0 -2
  155. package/.docs/reference/workflows/run-methods/restart.md +8 -0
  156. package/.docs/reference/workflows/run-methods/resume.md +2 -0
  157. package/.docs/reference/workflows/run-methods/start.md +2 -0
  158. package/.docs/reference/workflows/run-methods/timeTravel.md +2 -0
  159. package/.docs/reference/workflows/step.md +1 -1
  160. package/.docs/reference/workspace/platform-sandbox.md +36 -2
  161. package/package.json +5 -5
@@ -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
 
@@ -4,11 +4,13 @@
4
4
 
5
5
  # Tone consistency scorer
6
6
 
7
- The `createToneScorer()` function evaluates the text's emotional tone and sentiment consistency. It can operate in two modes: comparing tone between input/output pairs or analyzing tone stability within a single text.
7
+ The `createToneScorer()` function evaluates the text's emotional tone and sentiment consistency. It can operate in two modes: comparing the agent output's sentiment against a configured `referenceTone`, or analyzing tone stability across the sentences of the agent output.
8
8
 
9
9
  ## Parameters
10
10
 
11
- The `createToneScorer()` function doesn't take any options.
11
+ The `createToneScorer()` function accepts an optional config object with the following properties:
12
+
13
+ **referenceTone** (`string`): Reference text whose sentiment the agent output is compared against. When omitted, the scorer measures sentiment stability across the output's sentences instead.
12
14
 
13
15
  This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
14
16
 
@@ -16,7 +18,7 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
16
18
 
17
19
  **runId** (`string`): The id of the run (optional).
18
20
 
19
- **analyzeStepResult** (`object`): Object with tone metrics: { responseSentiment: number, referenceSentiment: number, difference: number } (for comparison mode) OR { avgSentiment: number, sentimentVariance: number } (for stability mode)
21
+ **preprocessStepResult** (`object`): Object with tone metrics: { score: number, responseSentiment: number, referenceSentiment: number, difference: number } (for comparison mode) OR { score: number, avgSentiment: number, sentimentVariance: number } (for stability mode)
20
22
 
21
23
  **score** (`number`): Tone consistency/stability score (0-1).
22
24
 
@@ -25,7 +27,8 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
25
27
  ```typescript
26
28
  {
27
29
  runId: string,
28
- analyzeStepResult: {
30
+ preprocessStepResult: {
31
+ score: number,
29
32
  responseSentiment?: number,
30
33
  referenceSentiment?: number,
31
34
  difference?: number,
@@ -48,20 +51,20 @@ The scorer evaluates sentiment consistency through tone pattern analysis and mod
48
51
  - Computes sentiment scores
49
52
  - Measures tone variations
50
53
 
51
- 2. Calculates mode-specific score: **Tone Consistency** (input and output):
54
+ 2. Calculates mode-specific score: **Tone Consistency** (`referenceTone` set):
52
55
 
53
- - Compares sentiment between texts
54
- - Calculates sentiment difference
55
- - Score = 1 - (sentiment\_difference / max\_difference) **Tone Stability** (single input):
56
- - Analyzes sentiment across sentences
56
+ - Compares the output's sentiment with the `referenceTone` sentiment
57
+ - Calculates the absolute sentiment difference
58
+ - Score = max(0, 1 - sentiment\_difference) **Tone Stability** (no `referenceTone`):
59
+ - Analyzes sentiment across the output's sentences
57
60
  - Calculates sentiment variance
58
- - Score = 1 - (sentiment\_variance / max\_variance)
61
+ - Score = max(0, 1 - sentiment\_variance)
59
62
 
60
- Final score: `mode_specific_score * scale`
63
+ Final score: `mode_specific_score`
61
64
 
62
65
  ### Score interpretation
63
66
 
64
- (0 to scale, default 0-1)
67
+ (0-1)
65
68
 
66
69
  - 1.0: Perfect tone consistency/stability
67
70
  - 0.7-0.9: Strong consistency with minor variations
@@ -69,37 +72,33 @@ Final score: `mode_specific_score * scale`
69
72
  - 0.1-0.3: Poor consistency with major tone changes
70
73
  - 0.0: No consistency - completely different tones
71
74
 
72
- ### `analyzeStepResult`
75
+ ### `preprocessStepResult`
73
76
 
74
77
  Object with tone metrics:
75
78
 
76
79
  - **responseSentiment**: Sentiment score for the response (comparison mode).
77
- - **referenceSentiment**: Sentiment score for the input/reference (comparison mode).
80
+ - **referenceSentiment**: Sentiment score for the `referenceTone` (comparison mode).
78
81
  - **difference**: Absolute difference between sentiment scores (comparison mode).
79
82
  - **avgSentiment**: Average sentiment across sentences (stability mode).
80
83
  - **sentimentVariance**: Variance of sentiment across sentences (stability mode).
81
84
 
82
85
  ## Example
83
86
 
84
- Evaluate tone consistency between related agent responses:
87
+ Evaluate whether agent responses match a positive reference tone:
85
88
 
86
89
  ```typescript
87
90
  import { runEvals } from '@mastra/core/evals'
88
91
  import { createToneScorer } from '@mastra/evals/scorers/prebuilt'
89
92
  import { myAgent } from './agent'
90
93
 
91
- const scorer = createToneScorer()
94
+ const scorer = createToneScorer({
95
+ referenceTone: 'We are happy to help and glad you had a great experience!',
96
+ })
92
97
 
93
98
  const result = await runEvals({
94
99
  data: [
95
- {
96
- input: 'How was your experience with our service?',
97
- groundTruth: 'The service was excellent and exceeded expectations!',
98
- },
99
- {
100
- input: 'Tell me about the customer support',
101
- groundTruth: 'The support team was friendly and very helpful.',
102
- },
100
+ { input: 'How was your experience with our service?' },
101
+ { input: 'Tell me about the customer support' },
103
102
  ],
104
103
  scorers: [scorer],
105
104
  target: myAgent,
@@ -94,7 +94,7 @@ const strictOrderScorer = createCodeScorer({
94
94
  {
95
95
  runId: string,
96
96
  preprocessStepResult: {
97
- expectedTool: string,
97
+ expectedTool?: string, // undefined when only expectedToolOrder is configured
98
98
  actualTools: string[],
99
99
  strictMode: boolean,
100
100
  expectedToolOrder?: string[],
@@ -283,7 +283,7 @@ The `createToolCallAccuracyScorerLLM()` function from `@mastra/evals/scorers/pre
283
283
 
284
284
  **model** (`MastraModelConfig`): The LLM model to use for evaluating tool appropriateness
285
285
 
286
- **availableTools** (`Array<{name: string, description: string}>`): List of available tools with their descriptions for context
286
+ **availableTools** (`Tool[]`): Tools available to the agent, for example created with createTool(). Each tool's id and description are passed to the judge as context.
287
287
 
288
288
  ### Features
289
289
 
@@ -315,8 +315,8 @@ The LLM-based scorer provides:
315
315
  const basicLLMScorer = createLLMScorer({
316
316
  model: 'openai/gpt-5.6-sol',
317
317
  availableTools: [
318
- { name: 'tool1', description: 'Description 1' },
319
- { name: 'tool2', description: 'Description 2' }
318
+ createTool({ id: 'tool1', description: 'Description 1' }),
319
+ createTool({ id: 'tool2', description: 'Description 2' })
320
320
  ]
321
321
  });
322
322
 
@@ -352,21 +352,24 @@ The LLM-based scorer uses AI to evaluate whether tool selections are appropriate
352
352
  ### Basic LLM evaluation
353
353
 
354
354
  ```typescript
355
+ import { createTool } from '@mastra/core/tools'
356
+ import { createToolCallAccuracyScorerLLM } from '@mastra/evals/scorers/prebuilt'
357
+
355
358
  const llmScorer = createToolCallAccuracyScorerLLM({
356
359
  model: 'openai/gpt-5.6-sol',
357
360
  availableTools: [
358
- {
359
- name: 'weather-tool',
361
+ createTool({
362
+ id: 'weather-tool',
360
363
  description: 'Get current weather information for any location',
361
- },
362
- {
363
- name: 'calendar-tool',
364
+ }),
365
+ createTool({
366
+ id: 'calendar-tool',
364
367
  description: 'Check calendar events and scheduling',
365
- },
366
- {
367
- name: 'search-tool',
368
+ }),
369
+ createTool({
370
+ id: 'search-tool',
368
371
  description: 'Search the web for general information',
369
- },
372
+ }),
370
373
  ],
371
374
  })
372
375
 
@@ -474,6 +477,7 @@ console.log(result.reason); // "The agent appropriately asked for clarification
474
477
  Here's an example using both scorers on the same data:
475
478
 
476
479
  ```typescript
480
+ import { createTool } from '@mastra/core/tools'
477
481
  import {
478
482
  createToolCallAccuracyScorerCode as createCodeScorer,
479
483
  createToolCallAccuracyScorerLLM as createLLMScorer,
@@ -488,8 +492,8 @@ const codeScorer = createCodeScorer({
488
492
  const llmScorer = createLLMScorer({
489
493
  model: 'openai/gpt-5.6-sol',
490
494
  availableTools: [
491
- { name: 'weather-tool', description: 'Get weather information' },
492
- { name: 'search-tool', description: 'Search the web' },
495
+ createTool({ id: 'weather-tool', description: 'Get weather information' }),
496
+ createTool({ id: 'search-tool', description: 'Search the web' }),
493
497
  ],
494
498
  })
495
499
 
@@ -12,7 +12,9 @@ The `createToxicityScorer()` function accepts a single options object with the f
12
12
 
13
13
  **model** (`LanguageModel`): Configuration for the model used to evaluate toxicity.
14
14
 
15
- **scale** (`number`): Maximum score value (default is 1). (Default: `1`)
15
+ **options** (`ToxicityMetricOptions`): Configuration options.
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
 
@@ -90,6 +90,10 @@ The Reference section provides documentation of Mastra's API, including paramete
90
90
  - [mountAgentControllerOnMastra()](https://mastra.ai/reference/code-sdk/mount-agent-controller)
91
91
  - [buildBasePrompt()](https://mastra.ai/reference/coding-agent/build-base-prompt)
92
92
  - [createCodingAgent()](https://mastra.ai/reference/coding-agent/create-coding-agent)
93
+ - [channels()](https://mastra.ai/reference/connect/channels)
94
+ - [credential()](https://mastra.ai/reference/connect/credential)
95
+ - [Provider toolsets](https://mastra.ai/reference/connect/providers)
96
+ - [tools()](https://mastra.ai/reference/connect/tools)
93
97
  - [Mastra Class](https://mastra.ai/reference/core/mastra-class)
94
98
  - [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway)
95
99
  - [.addDynamicWorkflow()](https://mastra.ai/reference/core/addDynamicWorkflow)
@@ -272,6 +276,7 @@ The Reference section provides documentation of Mastra's API, including paramete
272
276
  - [BatchPartsProcessor](https://mastra.ai/reference/processors/batch-parts-processor)
273
277
  - [ClassifierProcessor](https://mastra.ai/reference/processors/classifier-processor)
274
278
  - [CyberRefusalHandler](https://mastra.ai/reference/processors/cyber-refusal-handler)
279
+ - [FileUploadProcessor](https://mastra.ai/reference/processors/file-upload-processor)
275
280
  - [LanguageDetector](https://mastra.ai/reference/processors/language-detector)
276
281
  - [MemoryInputFilter](https://mastra.ai/reference/processors/memory-input-filter)
277
282
  - [MessageHistory](https://mastra.ai/reference/processors/message-history-processor)
@@ -293,6 +298,7 @@ The Reference section provides documentation of Mastra's API, including paramete
293
298
  - [ToolCallFilter](https://mastra.ai/reference/processors/tool-call-filter)
294
299
  - [ToolSearchProcessor](https://mastra.ai/reference/processors/tool-search-processor)
295
300
  - [UnicodeNormalizer](https://mastra.ai/reference/processors/unicode-normalizer)
301
+ - [UnsupportedFileHandler](https://mastra.ai/reference/processors/unsupported-file-handler)
296
302
  - [WorkingMemory](https://mastra.ai/reference/processors/working-memory-processor)
297
303
  - [CachingPubSub](https://mastra.ai/reference/pubsub/caching-pubsub)
298
304
  - [EventEmitterPubSub](https://mastra.ai/reference/pubsub/event-emitter)
@@ -98,7 +98,7 @@ Writes structured logs to a file using the `FileTransport`. The logger accepts a
98
98
 
99
99
  ```typescript
100
100
  import { FileTransport } from '@mastra/loggers/file'
101
- import { PinoLogger } from '@mastra/loggers/pino'
101
+ import { PinoLogger } from '@mastra/loggers'
102
102
 
103
103
  export const fileLogger = new PinoLogger({
104
104
  name: 'Mastra',
@@ -122,7 +122,7 @@ Streams structured logs to a remote Redis list using the `UpstashTransport`. The
122
122
 
123
123
  ```typescript
124
124
  import { UpstashTransport } from '@mastra/loggers/upstash'
125
- import { PinoLogger } from '@mastra/loggers/pino'
125
+ import { PinoLogger } from '@mastra/loggers'
126
126
 
127
127
  export const upstashLogger = new PinoLogger({
128
128
  name: 'Mastra',
@@ -156,8 +156,8 @@ You can create custom transports using the `createCustomTransport` utility to in
156
156
  Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`. The custom transport forwards logs to an external system such as Sentry for advanced monitoring and observability.
157
157
 
158
158
  ```typescript
159
- import { createCustomTransport } from '@mastra/core/loggers'
160
- import { PinoLogger } from '@mastra/loggers/pino'
159
+ import { createCustomTransport } from '@mastra/core/logger'
160
+ import { PinoLogger } from '@mastra/loggers'
161
161
  import pinoSentry from 'pino-sentry-transport'
162
162
 
163
163
  const sentryStream = await pinoSentry({
@@ -24,7 +24,7 @@ await memory?.deleteMessages(['671ae63f-3a91-4082-a907-fe7de78e10ec'])
24
24
 
25
25
  ```typescript
26
26
  import { mastra } from './mastra'
27
- import { MastraDBMessage } from '@mastra/core'
27
+ import type { MastraDBMessage } from '@mastra/core/agent'
28
28
 
29
29
  const agent = mastra.getAgent('agent')
30
30
  const memory = await agent.getMemory()
@@ -101,14 +101,14 @@ export const agent = new Agent({
101
101
  import { Memory } from '@mastra/memory'
102
102
  import { Agent } from '@mastra/core/agent'
103
103
  import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
104
- import { PgStore, PgVector } from '@mastra/pg'
104
+ import { PostgresStore, PgVector } from '@mastra/pg'
105
105
 
106
106
  export const agent = new Agent({
107
107
  name: 'pg-agent',
108
108
  instructions: 'You are an agent with optimized PostgreSQL memory.',
109
109
  model: 'openai/gpt-5.6-sol',
110
110
  memory: new Memory({
111
- storage: new PgStore({
111
+ storage: new PostgresStore({
112
112
  id: 'pg-agent-storage',
113
113
  connectionString: process.env.DATABASE_URL,
114
114
  }),
@@ -29,7 +29,7 @@ export const agent = new Agent({
29
29
 
30
30
  ## Configuration
31
31
 
32
- The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with `google/gemini-2.5-flash` as the default model. When passing a config object, set `model` at the top level or on `observation.model` and/or `reflection.model`; when all model fields are omitted, OM falls back to `google/gemini-2.5-flash`.
32
+ The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with automatic model selection. When passing a config object, set `model` at the top level or on `observation.model` and/or `reflection.model`. When all model fields are omitted, each role defaults to `'auto'`.
33
33
 
34
34
  Observer input is multimodal-aware. OM keeps text placeholders like `[Image #1: screenshot.png]` in the transcript it builds for the Observer, and also sends the underlying image parts when possible. This applies to both single-thread observation and batched multi-thread observation. Non-image files appear as placeholders only.
35
35
 
@@ -37,7 +37,11 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
37
37
 
38
38
  **enabled** (`boolean`): Enable or disable Observational Memory. When omitted from a config object, defaults to true. Only enabled: false explicitly disables it. (Default: `true`)
39
39
 
40
- **model** (`string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with observation.model or reflection.model — an error will be thrown if both are set. When this and observation.model/reflection.model are all omitted, OM falls back to google/gemini-2.5-flash. Use "default" to explicitly use the default model (google/gemini-2.5-flash). (Default: `'google/gemini-2.5-flash'`)
40
+ **model** (`'auto' | string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Cannot be used together with observation.model or reflection.model. When all model fields are omitted, each role defaults to "auto". Automatic selection prefers google/gemini-2.5-flash when GOOGLE\_GENERATIVE\_AI\_API\_KEY is configured, then a low-cost model for the active provider, then the active main model. Use "default" for the legacy fixed default. (Default: `'auto'`)
41
+
42
+ **autoModels** (`Record<string, string>`): Overrides the model automatic selection picks for a provider, keyed by provider ID. For example, { openai: "\_\_GATEWAY\_OPENAI\_MODEL\_NANO\_\_" }. Providers not listed use the built-in pick.
43
+
44
+ **resolveModel** (`(modelId: string, context: { requestContext?: RequestContext }) => MastraModelConfig | Promise<MastraModelConfig>`): Creates the model automatic selection picked, so it can use your credentials and routing. Receives only concrete model IDs, never "auto". When omitted, the picked ID goes through Mastra model routing.
41
45
 
42
46
  **scope** (`'resource' | 'thread'`): Memory scope for observations. 'thread' keeps observations per-thread. 'resource' is deprecated and will be removed in a future release. It shares observations across all threads for a resource and works much worse than thread scope for prompt caching and agent understanding. For cross-thread continuity, use thread scope with retrieval or resource-scoped working memory. See resource scope (deprecated). (Default: `'thread'`)
43
47
 
@@ -55,7 +59,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
55
59
 
56
60
  **observation** (`ObservationalMemoryObservationConfig`): Configuration for the observation step. Controls when the Observer agent runs and how it behaves.
57
61
 
58
- **observation.model** (`string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for the Observer agent. Cannot be set if a top-level model is also provided. If neither this nor the top-level model is set, falls back to reflection.model.
62
+ **observation.model** (`'auto' | string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for the Observer agent. With 'auto', each observation uses the Gemini default when GOOGLE\_GENERATIVE\_AI\_API\_KEY is set, otherwise a low-cost model for the calling agent's effective provider, then the calling model or configured model instance. Cannot be set if a top-level model is also provided. If neither this nor the top-level model is set, falls back to reflection.model.
59
63
 
60
64
  **observation.instruction** (`string`): Custom instruction appended to the Observer's system prompt. Use this to customize what the Observer focuses on, such as domain-specific preferences or priorities.
61
65
 
@@ -101,7 +105,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
101
105
 
102
106
  **reflection** (`ObservationalMemoryReflectionConfig`): Configuration for the reflection step. Controls when the Reflector agent runs and how it behaves.
103
107
 
104
- **reflection.model** (`string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for the Reflector agent. Cannot be set if a top-level model is also provided. If neither this nor the top-level model is set, falls back to observation.model.
108
+ **reflection.model** (`'auto' | string | LanguageModel | DynamicModel | ModelByInputTokens | ModelWithRetries[]`): Model for the Reflector agent. With 'auto', each reflection uses the Gemini default when GOOGLE\_GENERATIVE\_AI\_API\_KEY is set, otherwise a low-cost model for the calling agent's effective provider, then the calling model or configured model instance. Cannot be set if a top-level model is also provided. If neither this nor the top-level model is set, falls back to observation.model.
105
109
 
106
110
  **reflection.maxRetries** (`number`): Retries after the initial Reflector model call on transient provider errors. Governs OM's own retry ladder; the Reflector model call itself is configured with no provider-level retries.
107
111
 
@@ -24,7 +24,7 @@ const result = await summarizeConversation({
24
24
 
25
25
  ## Parameters
26
26
 
27
- **model** (`string | LanguageModel | DynamicModel`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'.
27
+ **model** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model that runs the summarization, such as a router string like '\_\_GATEWAY\_OPENAI\_MODEL\_MINI\_\_'. Pass an array of { model, maxRetries } entries to fall back to the next model when one fails.
28
28
 
29
29
  **messages** (`MastraDBMessage[]`): The conversation to summarize. When empty, the function returns an empty result without calling the model.
30
30
 
@@ -28,10 +28,10 @@ import { convertMessages } from '@mastra/core/agent'
28
28
  const aiv5Messages = convertMessages(aiv4Messages).to('AIV5.UI')
29
29
 
30
30
  // Convert Mastra messages to AI SDK v5
31
- const aiv5Messages = convertMessages(mastraMessages).to('AIV5.Core')
31
+ const aiv5ModelMessages = convertMessages(mastraMessages).to('AIV5.Model')
32
32
 
33
33
  // Supported output formats:
34
- // 'Mastra.V2', 'AIV4.UI', 'AIV5.UI', 'AIV5.Core', 'AIV5.Model'
34
+ // 'Mastra.V2', 'AIV4.UI', 'AIV4.Core', 'AIV5.UI', 'AIV5.Model', 'AIV6.UI'
35
35
  ```
36
36
 
37
37
  This utility is helpful when you want to fetch messages directly from your storage DB and convert them for use in AI SDK.
@@ -83,6 +83,8 @@ createTool({
83
83
  });
84
84
  ```
85
85
 
86
+ > **Note:** `context.mcp.elicitation.sendRequest()` is deprecated. It throws on servers running `@mastra/mcp` 2.x, which serve the MCP `2026-07-28` revision. On those servers, call `context.suspend(payload)` and read the caller's answer from `context.resumeData` when the tool runs again. See [Tools that ask the caller for input suspend and resume](https://mastra.ai/reference/migrations/mcp-v2).
87
+
86
88
  ## Removed
87
89
 
88
90
  ### Deprecated MCP client classes
@@ -177,7 +177,7 @@ To migrate, replace all instances of `MastraMessageV2` with `MastraDBMessage`.
177
177
  ```diff
178
178
  - import { MastraMessageV2 } from '@mastra/core';
179
179
  - function yourCustomFunction(input: MastraMessageV2) {}
180
- + import { MastraDBMessage } from '@mastra/core';
180
+ + import type { MastraDBMessage } from '@mastra/core/agent';
181
181
  + function yourCustomFunction(input: MastraDBMessage) {}
182
182
  ```
183
183
 
@@ -117,7 +117,7 @@ This applies to all tool executions, whether called directly or through agents a
117
117
 
118
118
  Tools with an `outputSchema` now validate their return values at runtime. Previously, `outputSchema` was only used for type inference - the output was never validated.
119
119
 
120
- If your tool returns data that doesn't match its `outputSchema`, it will now return a `ValidationError` instead of the invalid data.
120
+ If your tool returns data that doesn't match its `outputSchema`, it will now return a `ValidationError` instead of the invalid data. This is the default `outputValidation: 'strict'` behavior. With [`outputValidation: 'warn'`](https://mastra.ai/reference/tools/create-tool), Mastra logs the mismatch and returns the original output unchanged.
121
121
 
122
122
  To fix validation errors, ensure the tool's output matches the schema definition:
123
123
 
@@ -82,7 +82,16 @@ type SamplingStrategy =
82
82
  | { type: 'always' }
83
83
  | { type: 'never' }
84
84
  | { type: 'ratio'; probability: number }
85
- | { type: 'custom'; sampler: (options?: TracingOptions) => boolean }
85
+ | { type: 'custom'; sampler: (options?: CustomSamplerOptions) => boolean }
86
+ ```
87
+
88
+ ## `CustomSamplerOptions`
89
+
90
+ ```typescript
91
+ interface CustomSamplerOptions {
92
+ requestContext?: RequestContext
93
+ metadata?: Record<string, any>
94
+ }
86
95
  ```
87
96
 
88
97
  ## `ConfigSelector`
@@ -92,8 +92,9 @@ const exporter = new PosthogExporter({
92
92
 
93
93
  | Mastra Span Type | PostHog Event Type |
94
94
  | -------------------- | ------------------ |
95
- | `MODEL_GENERATION` | `$ai_generation` |
96
- | `MODEL_STEP` | `$ai_generation` |
95
+ | `MODEL_INFERENCE` | `$ai_generation` |
96
+ | `MODEL_GENERATION` | `$ai_span` |
97
+ | `MODEL_STEP` | `$ai_span` |
97
98
  | `MODEL_CHUNK` | `$ai_span` |
98
99
  | `TOOL_CALL` | `$ai_span` |
99
100
  | `MCP_TOOL_CALL` | `$ai_span` |
@@ -104,6 +105,12 @@ const exporter = new PosthogExporter({
104
105
  | All other workflows | `$ai_span` |
105
106
  | `GENERIC` | `$ai_span` |
106
107
 
108
+ Each call to the model provider is a `MODEL_INFERENCE` span and is exported as one `$ai_generation` event. The event carries the model, token usage, output, and the tool definitions sent on that call as `$ai_tools`. Its `$ai_input` is the conversation that call received: the run's input messages, followed by the output and tool results of each earlier call in the run. A run that calls the model three times sends three `$ai_generation` events.
109
+
110
+ The `MODEL_GENERATION` span wraps those calls and is exported as `$ai_span`. PostHog only adds up tokens and cost on `$ai_generation` events. Tokens and cost aren't counted twice. With `@mastra/core` or `@mastra/observability` versions that don't record `MODEL_INFERENCE` spans, `MODEL_GENERATION` is exported as `$ai_generation`.
111
+
112
+ > **Note:** Runs through the deprecated `generateLegacy()` and `streamLegacy()` methods don't record `MODEL_INFERENCE` spans. Their `MODEL_GENERATION` span is exported as `$ai_span`. These runs send no `$ai_generation` events and no token or cost data to PostHog. Use `generate()` and `stream()` to keep token and cost data.
113
+
107
114
  ## Feedback export
108
115
 
109
116
  Feedback recorded with [`addFeedback()`](https://mastra.ai/docs/observability/feedback) is exported to PostHog as a native `$ai_feedback` event. PostHog shows it as **User feedback** on the linked trace. No extra configuration is needed.
@@ -29,7 +29,7 @@ Base class for custom ObservabilityInstance implementations.
29
29
  #### `getConfig`
30
30
 
31
31
  ```typescript
32
- getConfig(): Readonly<Required<ObservabilityInstanceConfig>>
32
+ getConfig(): Readonly<ObservabilityInstanceConfig>
33
33
  ```
34
34
 
35
35
  Returns the current observability configuration.