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

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 (108) hide show
  1. package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
  2. package/.docs/docs/agents/background-tasks.md +62 -2
  3. package/.docs/docs/agents/processors.md +9 -1
  4. package/.docs/docs/agents/response-caching.md +148 -0
  5. package/.docs/docs/agents/signals.md +151 -0
  6. package/.docs/docs/agents/using-tools.md +8 -0
  7. package/.docs/docs/browser/agent-browser.md +15 -0
  8. package/.docs/docs/browser/stagehand.md +25 -1
  9. package/.docs/docs/editor/tools.md +1 -1
  10. package/.docs/docs/index.md +2 -2
  11. package/.docs/docs/mastra-platform/configuration.md +1 -1
  12. package/.docs/docs/mastra-platform/overview.md +1 -1
  13. package/.docs/docs/memory/observational-memory.md +61 -13
  14. package/.docs/docs/memory/semantic-recall.md +68 -6
  15. package/.docs/docs/observability/logging.md +2 -2
  16. package/.docs/docs/observability/metrics/overview.md +4 -4
  17. package/.docs/docs/observability/overview.md +6 -6
  18. package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
  19. package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
  20. package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
  21. package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
  22. package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
  23. package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
  24. package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
  25. package/.docs/docs/observability/tracing/overview.md +30 -29
  26. package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
  27. package/.docs/docs/server/mastra-server.md +30 -19
  28. package/.docs/docs/studio/observability.md +4 -4
  29. package/.docs/docs/studio/overview.md +6 -0
  30. package/.docs/docs/voice/overview.md +84 -0
  31. package/.docs/docs/workflows/suspend-and-resume.md +28 -1
  32. package/.docs/guides/deployment/inngest.md +23 -0
  33. package/.docs/guides/migrations/mastra-cloud.md +6 -6
  34. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
  35. package/.docs/models/gateways/netlify.md +2 -1
  36. package/.docs/models/gateways/openrouter.md +4 -1
  37. package/.docs/models/gateways/vercel.md +2 -1
  38. package/.docs/models/index.md +1 -1
  39. package/.docs/models/providers/chutes.md +23 -54
  40. package/.docs/models/providers/databricks.md +96 -0
  41. package/.docs/models/providers/deepseek.md +3 -1
  42. package/.docs/models/providers/digitalocean.md +9 -2
  43. package/.docs/models/providers/firepass.md +71 -0
  44. package/.docs/models/providers/google.md +3 -2
  45. package/.docs/models/providers/kilo.md +5 -3
  46. package/.docs/models/providers/llmgateway.md +7 -1
  47. package/.docs/models/providers/nebius.md +37 -55
  48. package/.docs/models/providers/novita-ai.md +5 -5
  49. package/.docs/models/providers/nvidia.md +59 -49
  50. package/.docs/models/providers/ollama-cloud.md +1 -1
  51. package/.docs/models/providers/openai.md +2 -0
  52. package/.docs/models/providers/opencode.md +44 -43
  53. package/.docs/models/providers/poe.md +4 -1
  54. package/.docs/models/providers/sarvam.md +72 -0
  55. package/.docs/models/providers/wafer.ai.md +2 -1
  56. package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
  57. package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
  58. package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
  59. package/.docs/models/providers.md +3 -1
  60. package/.docs/reference/agents/agent.md +85 -0
  61. package/.docs/reference/browser/agent-browser.md +37 -11
  62. package/.docs/reference/browser/stagehand-browser.md +35 -9
  63. package/.docs/reference/cli/mastra.md +33 -1
  64. package/.docs/reference/client-js/agents.md +115 -1
  65. package/.docs/reference/client-js/responses.md +4 -0
  66. package/.docs/reference/configuration.md +6 -6
  67. package/.docs/reference/editor/tool-provider.md +3 -3
  68. package/.docs/reference/harness/harness-class.md +21 -8
  69. package/.docs/reference/index.md +5 -0
  70. package/.docs/reference/memory/observational-memory.md +11 -1
  71. package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
  72. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  73. package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
  74. package/.docs/reference/observability/tracing/configuration.md +6 -3
  75. package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
  76. package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
  77. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
  78. package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
  79. package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
  80. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
  81. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
  82. package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
  83. package/.docs/reference/observability/tracing/instances.md +2 -2
  84. package/.docs/reference/observability/tracing/interfaces.md +37 -2
  85. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
  86. package/.docs/reference/observability/tracing/span-filtering.md +2 -2
  87. package/.docs/reference/processors/prefill-error-handler.md +3 -3
  88. package/.docs/reference/processors/response-cache.md +114 -0
  89. package/.docs/reference/processors/tool-call-filter.md +28 -0
  90. package/.docs/reference/storage/clickhouse.md +8 -8
  91. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  92. package/.docs/reference/storage/cloudflare.md +1 -1
  93. package/.docs/reference/storage/composite.md +1 -1
  94. package/.docs/reference/storage/convex.md +1 -1
  95. package/.docs/reference/storage/dsql.md +428 -0
  96. package/.docs/reference/storage/duckdb.md +3 -3
  97. package/.docs/reference/storage/dynamodb.md +1 -1
  98. package/.docs/reference/storage/lance.md +1 -1
  99. package/.docs/reference/storage/libsql.md +1 -1
  100. package/.docs/reference/storage/postgresql.md +1 -1
  101. package/.docs/reference/storage/upstash.md +1 -1
  102. package/.docs/reference/streaming/ChunkType.md +44 -0
  103. package/.docs/reference/tools/brightdata.md +167 -0
  104. package/.docs/reference/tools/create-tool.md +46 -0
  105. package/.docs/reference/voice/inworld.md +133 -0
  106. package/.docs/reference/workflows/workflow-state-reader.md +113 -0
  107. package/CHANGELOG.md +106 -0
  108. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  # OtelExporter
2
2
 
3
- Sends Tracing data to any OpenTelemetry-compatible observability platform using standardized GenAI semantic conventions.
3
+ Sends traces and logs to any OpenTelemetry-compatible observability platform. Traces use the standardized GenAI semantic conventions; logs carry their original severity and message body and are correlated to traces via both the OTEL log record's native trace context and `mastra.traceId` / `mastra.spanId` attributes.
4
4
 
5
5
  ## Constructor
6
6
 
@@ -13,6 +13,10 @@ new OtelExporter(config: OtelExporterConfig)
13
13
  ```typescript
14
14
  interface OtelExporterConfig {
15
15
  provider?: ProviderConfig
16
+ signals?: {
17
+ traces?: boolean
18
+ logs?: boolean
19
+ }
16
20
  timeout?: number
17
21
  batchSize?: number
18
22
  logLevel?: 'debug' | 'info' | 'warn' | 'error'
@@ -157,14 +161,14 @@ const exporter = new OtelExporter({
157
161
 
158
162
  ## Protocol requirements
159
163
 
160
- Different providers require different OTEL exporter packages:
164
+ Different providers require different OTEL exporter packages. Trace and log export are independent: install only the trace package if you only need traces, or install both the trace and log packages for the chosen protocol if you also want log export. Zipkin does not support OTLP logs.
161
165
 
162
- | Protocol | Required Package | Providers |
163
- | ------------- | ------------------------------------------ | -------------------------- |
164
- | gRPC | `@opentelemetry/exporter-trace-otlp-grpc` | Dash0 |
165
- | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | SigNoz, New Relic, Laminar |
166
- | HTTP/JSON | `@opentelemetry/exporter-trace-otlp-http` | Traceloop, Custom |
167
- | Zipkin | `@opentelemetry/exporter-zipkin` | Zipkin collectors |
166
+ | Protocol | Trace package | Log package |
167
+ | ------------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
168
+ | gRPC | `@opentelemetry/exporter-trace-otlp-grpc` (+ `@grpc/grpc-js`) | `@opentelemetry/exporter-logs-otlp-grpc` (+ `@grpc/grpc-js`) |
169
+ | HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | `@opentelemetry/exporter-logs-otlp-proto` |
170
+ | HTTP/JSON | `@opentelemetry/exporter-trace-otlp-http` | `@opentelemetry/exporter-logs-otlp-http` |
171
+ | Zipkin | `@opentelemetry/exporter-zipkin` | not supported |
168
172
 
169
173
  ## Tags support
170
174
 
@@ -102,6 +102,6 @@ class CustomObservabilityInstance extends BaseObservabilityInstance {
102
102
 
103
103
  ### Exporters
104
104
 
105
- - [DefaultExporter](https://mastra.ai/reference/observability/tracing/exporters/default-exporter): Storage persistence
106
- - [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter): Mastra platform integration
105
+ - [MastraStorageExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter): Storage persistence
106
+ - [MastraPlatformExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter): Mastra platform integration
107
107
  - [ConsoleExporter](https://mastra.ai/reference/observability/tracing/exporters/console-exporter): Debug output
@@ -141,10 +141,18 @@ interface ObservabilityExporter {
141
141
  /** Handle feedback events */
142
142
  onFeedbackEvent?(event: FeedbackEvent): void | Promise<void>
143
143
 
144
+ /** Handle exporter pipeline droppedEvent */
145
+ onDroppedEvent?(event: ObservabilityDropEvent): void | Promise<void>
146
+
144
147
  /** Export tracing events */
145
148
  exportTracingEvent(event: TracingEvent): Promise<void>
146
149
 
147
- /** Add score to a trace (optional) */
150
+ /**
151
+ * @deprecated Implement `onScoreEvent` instead. Eval scores now flow through the
152
+ * unified observability bus as `ScoreEvent`s. This method is preserved on the
153
+ * interface for backwards compatibility with existing exporters; new exporters
154
+ * should not implement it.
155
+ */
148
156
  addScoreToTrace?({
149
157
  traceId,
150
158
  spanId,
@@ -169,7 +177,34 @@ interface ObservabilityExporter {
169
177
  }
170
178
  ```
171
179
 
172
- Event callback payloads use observability event bus envelopes: `TracingEvent` carries span lifecycle events with `exportedSpan`, `LogEvent` wraps `ExportedLog` in `log`, `MetricEvent` wraps `ExportedMetric` in `metric`, `ScoreEvent` wraps `ExportedScore` in `score`, and `FeedbackEvent` wraps `ExportedFeedback` in `feedback`. For Cloud exporter behavior for these callbacks, see [CloudExporter](https://mastra.ai/reference/observability/tracing/exporters/cloud-exporter).
180
+ Event callback payloads use observability event bus envelopes: `TracingEvent` carries span lifecycle events with `exportedSpan`, `LogEvent` wraps `ExportedLog` in `log`, `MetricEvent` wraps `ExportedMetric` in `metric`, `ScoreEvent` wraps `ExportedScore` in `score`, and `FeedbackEvent` wraps `ExportedFeedback` in `feedback`. For Mastra Platform exporter behavior for these callbacks, see [MastraPlatformExporter](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
181
+
182
+ ### `ObservabilityDropEvent`
183
+
184
+ Structured event emitted when the exporter pipeline drops observability events.
185
+
186
+ ```typescript
187
+ type ObservabilityDropSignal = 'tracing' | 'log' | 'metric' | 'score' | 'feedback'
188
+
189
+ type ObservabilityDropReason = 'unsupported-storage' | 'retry-exhausted'
190
+
191
+ interface ObservabilityDropEvent {
192
+ type: 'drop'
193
+ signal: ObservabilityDropSignal
194
+ reason: ObservabilityDropReason
195
+ count: number
196
+ timestamp: Date
197
+ exporterName: string
198
+ storageName?: string
199
+ error?: {
200
+ id?: string
201
+ domain?: string
202
+ message: string
203
+ }
204
+ }
205
+ ```
206
+
207
+ Use `onDroppedEvent` on a custom exporter or bridge to forward these events to external metrics or alerting systems.
173
208
 
174
209
  ### `SpanOutputProcessor`
175
210
 
@@ -2,6 +2,28 @@
2
2
 
3
3
  A SpanOutputProcessor that redacts sensitive information from span fields.
4
4
 
5
+ ## Auto-applied by default
6
+
7
+ `Observability` automatically appends a `SensitiveDataFilter` to every configured instance's `spanOutputProcessors` so secrets are redacted before they reach exporters such as the Mastra cloud exporter. The filter runs last (after any user-provided processors) so that sensitive data introduced or surfaced by upstream processors is still redacted. You do not need to add it manually unless you want to customize its options.
8
+
9
+ To opt out or customize the auto-applied filter, use the `sensitiveDataFilter` option on the [`Observability` registry config](https://mastra.ai/reference/observability/tracing/configuration):
10
+
11
+ ```typescript
12
+ import { Observability } from '@mastra/observability'
13
+
14
+ new Observability({
15
+ configs: {
16
+ /* ... */
17
+ },
18
+ // disable the auto-applied filter
19
+ sensitiveDataFilter: false,
20
+ // or customize it
21
+ // sensitiveDataFilter: { sensitiveFields: ['mySecret'], redactionStyle: 'partial' },
22
+ })
23
+ ```
24
+
25
+ If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values are not modified — add a `SensitiveDataFilter` to their processors yourself if needed.
26
+
5
27
  ## Constructor
6
28
 
7
29
  ```typescript
@@ -11,7 +11,7 @@ The following example demonstrates how to combine `excludeSpanTypes` and `spanFi
11
11
  ```ts
12
12
  import { Mastra } from '@mastra/core'
13
13
  import { SpanType } from '@mastra/core/observability'
14
- import { Observability, DefaultExporter } from '@mastra/observability'
14
+ import { Observability, MastraStorageExporter } from '@mastra/observability'
15
15
  import { LangfuseExporter } from '@mastra/langfuse'
16
16
 
17
17
  export const mastra = new Mastra({
@@ -19,7 +19,7 @@ export const mastra = new Mastra({
19
19
  configs: {
20
20
  default: {
21
21
  serviceName: 'my-app',
22
- exporters: [new DefaultExporter(), new LangfuseExporter()],
22
+ exporters: [new MastraStorageExporter(), new LangfuseExporter()],
23
23
  excludeSpanTypes: [SpanType.MODEL_CHUNK, SpanType.MODEL_STEP],
24
24
  spanFilter: span => {
25
25
  if (span.type === SpanType.TOOL_CALL && span.attributes?.success) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  The `PrefillErrorHandler` is an **error processor** that handles assistant-response prefill errors. This error occurs when a conversation ends with an assistant message and the model rejects the request because it interprets it as prefilling the assistant response.
4
4
 
5
- When the error is detected, the processor appends a hidden `<system-reminder>continue</system-reminder>` user message to the conversation and signals a retry. The reminder is persisted with `metadata.systemReminder = { type: 'anthropic-prefill-processor-retry' }`, which keeps it available for retry reconstruction and raw history while standard UI-facing message conversions hide it.
5
+ When the error is detected, the processor sends a hidden `system-reminder` signal with `continue` as its contents and signals a retry. The reminder is persisted as signal metadata, which keeps it available for retry reconstruction and raw history while standard UI-facing message conversions hide it.
6
6
 
7
7
  Add this processor to `errorProcessors` when you want Mastra to recover from assistant prefill rejections (for example Anthropic's "assistant message prefill" and Qwen/llama.cpp's "assistant response prefill is incompatible with `enable_thinking`" errors).
8
8
 
@@ -10,7 +10,7 @@ Add this processor to `errorProcessors` when you want Mastra to recover from ass
10
10
 
11
11
  1. The LLM API call fails with a known assistant-prefill rejection message
12
12
  2. `PrefillErrorHandler` checks that this is the first retry attempt
13
- 3. It appends a hidden `<system-reminder>continue</system-reminder>` user message to the `messageList`
13
+ 3. It sends a hidden `system-reminder` signal with `continue` as its contents
14
14
  4. It returns `{ retry: true }` to signal the LLM call should be retried with the modified messages
15
15
 
16
16
  The processor now reacts to the API rejection itself instead of re-checking whether the conversation currently ends with an assistant message. This makes it resilient to cases where the provider rejects the request for prefill semantics even if the trailing message shape has already been transformed upstream.
@@ -62,7 +62,7 @@ The `PrefillErrorHandler` takes no constructor parameters.
62
62
 
63
63
  **name** (`'Prefill Error Handler'`): Processor display name.
64
64
 
65
- **processAPIError** (`(args: ProcessAPIErrorArgs) => ProcessAPIErrorResult | void`): Handles known assistant-prefill errors by appending a hidden system reminder continue message and signaling retry. Only triggers on the first retry attempt.
65
+ **processAPIError** (`(args: ProcessAPIErrorArgs) => ProcessAPIErrorResult | void`): Handles known assistant-prefill errors by sending a hidden system reminder signal and signaling retry. Only triggers on the first retry attempt.
66
66
 
67
67
  ## Related
68
68
 
@@ -0,0 +1,114 @@
1
+ # ResponseCache
2
+
3
+ `ResponseCache` is an input processor that caches LLM responses on the request/response boundary inside the agentic loop. It hooks into `processLLMRequest` (cache lookup; short-circuits on hit) and `processLLMResponse` (cache write on completion).
4
+
5
+ The cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model — i.e. _after_ memory has loaded and earlier input processors have transformed the prompt — so two users with different memory contexts produce different cache keys. Each step in an agentic tool loop is independently cached.
6
+
7
+ There is no agent-level option for response caching; register `ResponseCache` explicitly on `inputProcessors`. Per-call overrides flow through `RequestContext` via [`ResponseCache.context()`](#static-helpers) and [`ResponseCache.applyContext()`](#static-helpers).
8
+
9
+ ## Usage example
10
+
11
+ ```typescript
12
+ import { Agent } from '@mastra/core/agent'
13
+ import { InMemoryServerCache } from '@mastra/core/cache'
14
+ import { ResponseCache } from '@mastra/core/processors'
15
+
16
+ const cache = new InMemoryServerCache()
17
+
18
+ const agent = new Agent({
19
+ name: 'Search Agent',
20
+ instructions: 'You answer questions concisely.',
21
+ model: 'openai/gpt-5',
22
+ inputProcessors: [new ResponseCache({ cache, ttl: 600 })],
23
+ })
24
+
25
+ // First call hits the LLM and writes to the cache.
26
+ await agent.generate('What is the capital of France?')
27
+
28
+ // Second identical call replays the cached response.
29
+ await agent.generate('What is the capital of France?')
30
+
31
+ // Force a fresh call but still update the cache.
32
+ await agent.generate('What is the capital of France?', {
33
+ requestContext: ResponseCache.context({ bust: true }),
34
+ })
35
+ ```
36
+
37
+ See [Response caching](https://mastra.ai/docs/agents/response-caching) for the conceptual overview, scoping rules, and recommended deployment patterns.
38
+
39
+ ## Constructor parameters
40
+
41
+ **cache** (`MastraServerCache`): The cache backend. Required. Pass any \`MastraServerCache\` implementation — \`InMemoryServerCache\` for local development, \`RedisCache\` from \`@mastra/redis\` for production, or your own subclass for a custom backend.
42
+
43
+ **ttl** (`number`): Time-to-live (seconds) for entries written by this processor. Defaults to 300 seconds (5 minutes), matching OpenRouter's reference implementation. (Default: `300`)
44
+
45
+ **scope** (`string | null`): Tenant scope appended to the cache key. \`null\` opts out of scoping. When omitted, the processor falls back to the resource id resolved from the request context (\`MASTRA\_RESOURCE\_ID\_KEY\`) for automatic per-user isolation.
46
+
47
+ **key** (`string | (inputs: ResponseCacheKeyInputs) => string | Promise<string>`): Override the auto-derived cache key. Pass a string to pin a key, or a function that receives \`{ agentId, scope, model, prompt, stepNumber }\` and returns a key. If the function throws, the processor falls back to the deterministic hash so the call still benefits from caching.
48
+
49
+ **bust** (`boolean`): Force a cache miss on every call: skip the read but still write on completion. Useful for explicit refresh paths. (Default: `false`)
50
+
51
+ **agentId** (`string`): Logical id used in the cache key namespace. Defaults to \`'mastra-response-cache'\`. Set this to the owning agent's id when you want cache entries scoped per-agent. (Default: `'mastra-response-cache'`)
52
+
53
+ ## Static helpers
54
+
55
+ `ResponseCache` exposes two static helpers for setting per-call overrides on a `RequestContext`. The helpers keep the underlying context key a private implementation detail — prefer them over reading/writing the raw key.
56
+
57
+ ### `ResponseCache.context(options)`
58
+
59
+ Build a fresh `RequestContext` preloaded with per-call response cache overrides.
60
+
61
+ ```typescript
62
+ await agent.stream('hello', {
63
+ requestContext: ResponseCache.context({ key: 'custom', bust: true }),
64
+ })
65
+ ```
66
+
67
+ ### `ResponseCache.applyContext(requestContext, options)`
68
+
69
+ Merge per-call response cache overrides into an existing `RequestContext`. Returns the same context for chaining.
70
+
71
+ ```typescript
72
+ const ctx = new RequestContext()
73
+ ctx.set('caller-meta', { userId: 'u-123' })
74
+ ResponseCache.applyContext(ctx, { bust: true })
75
+ await agent.stream('hello', { requestContext: ctx })
76
+ ```
77
+
78
+ ## ResponseCacheContextOptions
79
+
80
+ The shape passed to `ResponseCache.context()` / `ResponseCache.applyContext()`.
81
+
82
+ **key** (`string | (inputs: ResponseCacheKeyInputs) => string | Promise<string>`): Overrides the auto-derived cache key for this request only.
83
+
84
+ **scope** (`string | null`): Overrides the tenant scope for this request only. \`null\` opts out of scoping.
85
+
86
+ **bust** (`boolean`): Skip the cache read but still write on completion.
87
+
88
+ `cache`, `ttl`, and `agentId` are intentionally not overridable per call — they are instance-level concerns that should not vary per request.
89
+
90
+ ## ResponseCacheKeyInputs
91
+
92
+ The argument passed to a `key` function (constructor or per-call). All fields contribute to the deterministic hash by default.
93
+
94
+ **agentId** (`string`): Logical processor id used to namespace the cache key.
95
+
96
+ **scope** (`string | null | undefined`): Resolved scope for this request, or \`null\` when scoping is disabled.
97
+
98
+ **model** (`{ provider?: string; modelId?: string; specVersion?: string }`): Provider/model identity. Different models produce different responses.
99
+
100
+ **prompt** (`LanguageModelV2Prompt`): The exact prompt the provider would receive, post memory load and post any prompt-modifying input processors.
101
+
102
+ **stepNumber** (`number`): 0-indexed step number within the agentic loop. Greater than zero for tool steps.
103
+
104
+ ## Helper exports
105
+
106
+ - `buildResponseCacheKey(inputs)` — the deterministic hash used by default. Re-export it to override individual fields while preserving the rest of the standard key shape.
107
+ - `DEFAULT_RESPONSE_CACHE_TTL_SECONDS` — the default `ttl` (`300`).
108
+ - `RESPONSE_CACHE_CONTEXT_KEY` — the `RequestContext` key the static helpers write to. Exposed for advanced cases (e.g. clearing the override mid-pipeline); prefer the helpers.
109
+
110
+ ## Related
111
+
112
+ - [Response caching](https://mastra.ai/docs/agents/response-caching)
113
+ - [Processors](https://mastra.ai/docs/agents/processors)
114
+ - [Processor interface](https://mastra.ai/reference/processors/processor-interface)
@@ -19,6 +19,11 @@ const filterSpecific = new ToolCallFilter({
19
19
  const filterAfterRecentTools = new ToolCallFilter({
20
20
  filterAfterToolSteps: 2,
21
21
  })
22
+
23
+ // Preserve compact model-facing output for filtered completed tool results
24
+ const filterWithCompactToolHistory = new ToolCallFilter({
25
+ preserveModelOutput: true,
26
+ })
22
27
  ```
23
28
 
24
29
  ## Constructor parameters
@@ -29,6 +34,8 @@ const filterAfterRecentTools = new ToolCallFilter({
29
34
 
30
35
  **options.filterAfterToolSteps** (`number`): Enables filtering during agent loops and preserves tool calls and results from this many recent tool-producing steps. If undefined, step filtering is disabled
31
36
 
37
+ **options.preserveModelOutput** (`boolean`): Preserves compact model-facing output from completed filtered tool results with providerMetadata.mastra.modelOutput. Raw tool args and raw results are removed
38
+
32
39
  ## Returns
33
40
 
34
41
  **id** (`string`): Processor identifier set to 'tool-call-filter'
@@ -53,6 +60,27 @@ const filter = new ToolCallFilter({
53
60
  })
54
61
  ```
55
62
 
63
+ ## Preserve compact model output
64
+
65
+ Set `preserveModelOutput: true` to retain compact `toModelOutput` history for completed tool results that the filter removes. This keeps the model-facing output as text in the prompt while removing the raw `toolInvocation.args` and raw `toolInvocation.result` payloads.
66
+
67
+ Only completed tool results with `providerMetadata.mastra.modelOutput` are preserved. Tool calls, incomplete results, and results without stored model output are still filtered.
68
+
69
+ ```typescript
70
+ const filter = new ToolCallFilter({
71
+ preserveModelOutput: true,
72
+ })
73
+ ```
74
+
75
+ Combine `preserveModelOutput` with `exclude` to preserve compact output only for filtered tools:
76
+
77
+ ```typescript
78
+ const filter = new ToolCallFilter({
79
+ exclude: ['searchDatabase'],
80
+ preserveModelOutput: true,
81
+ })
82
+ ```
83
+
56
84
  ## Extended usage example
57
85
 
58
86
  ```typescript
@@ -51,7 +51,7 @@ import { Mastra } from '@mastra/core'
51
51
  import { MastraCompositeStore } from '@mastra/core/storage'
52
52
  import { PostgresStore } from '@mastra/pg'
53
53
  import { ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
54
- import { Observability, DefaultExporter } from '@mastra/observability'
54
+ import { Observability, MastraStorageExporter } from '@mastra/observability'
55
55
 
56
56
  const observabilityStore = new ObservabilityStorageClickhouseVNext({
57
57
  url: process.env.CLICKHOUSE_URL!,
@@ -74,14 +74,14 @@ export const mastra = new Mastra({
74
74
  configs: {
75
75
  default: {
76
76
  serviceName: 'mastra',
77
- exporters: [new DefaultExporter()],
77
+ exporters: [new MastraStorageExporter()],
78
78
  },
79
79
  },
80
80
  }),
81
81
  })
82
82
  ```
83
83
 
84
- `DefaultExporter` automatically selects the `insert-only` strategy when ClickHouse is the observability backend, which gives the highest write throughput. See [tracing strategies](https://mastra.ai/docs/observability/tracing/exporters/default) for details.
84
+ `MastraStorageExporter` automatically selects the `insert-only` strategy when ClickHouse is the observability backend, which gives the highest write throughput. See [tracing strategies](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage) for details.
85
85
 
86
86
  ### Observability with the legacy domain
87
87
 
@@ -226,7 +226,7 @@ import { Mastra } from '@mastra/core'
226
226
  import { MastraCompositeStore } from '@mastra/core/storage'
227
227
  import { PostgresStore } from '@mastra/pg'
228
228
  import { ObservabilityStorageClickhouseVNext } from '@mastra/clickhouse'
229
- import { Observability, DefaultExporter } from '@mastra/observability'
229
+ import { Observability, MastraStorageExporter } from '@mastra/observability'
230
230
 
231
231
  export const mastra = new Mastra({
232
232
  storage: new MastraCompositeStore({
@@ -247,7 +247,7 @@ export const mastra = new Mastra({
247
247
  configs: {
248
248
  default: {
249
249
  serviceName: 'mastra',
250
- exporters: [new DefaultExporter()],
250
+ exporters: [new MastraStorageExporter()],
251
251
  },
252
252
  },
253
253
  }),
@@ -287,14 +287,14 @@ In CI/CD pipelines, set `disableInit: true` on `ClickhouseStore` and run `init()
287
287
 
288
288
  ClickHouse is the recommended backend for production observability:
289
289
 
290
- - **Insert-only strategy**: `DefaultExporter` writes completed spans in batches without per-span updates, which is the highest-throughput strategy available.
290
+ - **Insert-only strategy**: `MastraStorageExporter` writes completed spans in batches without per-span updates, which is the highest-throughput strategy available.
291
291
  - **Columnar compression**: Span attributes and log payloads compress well compared to the same data in row-oriented databases.
292
292
 
293
- For the full strategy matrix and production guidance, see the [`DefaultExporter` reference](https://mastra.ai/docs/observability/tracing/exporters/default).
293
+ For the full strategy matrix and production guidance, see the [`MastraStorageExporter` reference](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage).
294
294
 
295
295
  ## Related
296
296
 
297
297
  - [Storage overview](https://mastra.ai/reference/storage/overview)
298
298
  - [Composite storage](https://mastra.ai/reference/storage/composite)
299
- - [`DefaultExporter`](https://mastra.ai/docs/observability/tracing/exporters/default)
299
+ - [`MastraStorageExporter`](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage)
300
300
  - [Observability overview](https://mastra.ai/docs/observability/overview)
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Cloudflare D1 storage implementation provides a serverless SQL database solution using Cloudflare D1, supporting relational operations and transactional consistency.
4
4
 
5
- > **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to D1, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to D1, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
6
6
 
7
7
  > **Row Size Limit:** Cloudflare D1 enforces a **1 MiB maximum row size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
8
8
 
@@ -5,7 +5,7 @@ Mastra provides two Cloudflare storage implementations:
5
5
  - **Cloudflare KV** (`CloudflareKVStorage`): A globally distributed, eventually consistent key-value store
6
6
  - **Cloudflare Durable Objects** (`CloudflareDOStorage`): A strongly consistent, SQLite-based storage using Durable Objects
7
7
 
8
- > **Observability Not Supported:** Cloudflare storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Cloudflare as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
8
+ > **Observability Not Supported:** Cloudflare storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Cloudflare as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
9
9
 
10
10
  ## Installation
11
11
 
@@ -242,4 +242,4 @@ const storage = new MastraCompositeStore({
242
242
 
243
243
  > **Note:** `ObservabilityStorageClickhouseVNext` is the current observability domain implementation. The legacy `ObservabilityStorageClickhouse` class is also exported and remains supported for projects that have not migrated. See the [ClickHouse storage reference](https://mastra.ai/reference/storage/clickhouse) for details.
244
244
 
245
- > **Info:** This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [DefaultExporter documentation](https://mastra.ai/docs/observability/tracing/exporters/default) for the full list of supported providers.
245
+ > **Info:** This approach is also required when using storage providers that don't support observability (like Convex, DynamoDB, or Cloudflare). See the [MastraStorageExporter documentation](https://mastra.ai/docs/observability/tracing/exporters/mastra-storage) for the full list of supported providers.
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Convex storage implementation provides a serverless storage solution using [Convex](https://convex.dev), a full-stack TypeScript development platform with real-time sync and automatic caching.
4
4
 
5
- > **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Convex, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
5
+ > **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to Convex, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
6
6
 
7
7
  > **Record Size Limit:** Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
8
8