@mastra/mcp-docs-server 1.2.19-alpha.3 → 1.2.19

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 (107) hide show
  1. package/.docs/docs/channels.md +28 -1
  2. package/.docs/docs/deployment/cloud-providers.md +1 -0
  3. package/.docs/docs/deployment/mastra-server.md +19 -0
  4. package/.docs/docs/deployment/overview.md +1 -0
  5. package/.docs/docs/deployment/workers.md +2 -2
  6. package/.docs/docs/evals/overview.md +33 -1
  7. package/.docs/docs/harness/durable-agents.md +1 -1
  8. package/.docs/docs/mastra-platform/api.md +54 -0
  9. package/.docs/docs/mastra-platform/deploy.md +101 -0
  10. package/.docs/docs/mastra-platform/observability.md +3 -1
  11. package/.docs/docs/mastra-platform/server.md +6 -11
  12. package/.docs/docs/mastra-platform/studio.md +8 -10
  13. package/.docs/docs/memory/semantic-recall.md +19 -0
  14. package/.docs/docs/observability/feedback.md +14 -0
  15. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +19 -14
  16. package/.docs/docs/observability/metrics/overview.md +31 -44
  17. package/.docs/docs/sandbox/overview.md +43 -0
  18. package/.docs/docs/server/middleware.md +30 -0
  19. package/.docs/docs/server/server-adapters.md +109 -34
  20. package/.docs/docs/storage.md +2 -0
  21. package/.docs/docs/subagents.md +6 -6
  22. package/.docs/integrations/channels/github.md +56 -9
  23. package/.docs/integrations/channels/imessage.md +150 -8
  24. package/.docs/integrations/databases/elasticsearch.md +156 -0
  25. package/.docs/integrations/databases/libsql.md +16 -0
  26. package/.docs/integrations/databases/mongodb.md +1 -1
  27. package/.docs/integrations/databases/postgresql.md +26 -0
  28. package/.docs/integrations/databases/valkey.md +99 -0
  29. package/.docs/integrations/deploy/kubernetes-helm.md +332 -0
  30. package/.docs/integrations/deploy/kubernetes.md +1 -1
  31. package/.docs/integrations/deploy/render.md +47 -61
  32. package/.docs/integrations/sandboxes/daytona.md +52 -0
  33. package/.docs/integrations/sandboxes/e2b-desktop.md +128 -0
  34. package/.docs/integrations/sandboxes/e2b.md +6 -0
  35. package/.docs/integrations/sandboxes/vercel.md +2 -2
  36. package/.docs/integrations/tools/parallel.md +240 -0
  37. package/.docs/integrations.md +5 -0
  38. package/.docs/models/environment-variables.md +9 -0
  39. package/.docs/models/gateways/merge-gateway.md +2 -1
  40. package/.docs/models/gateways/netlify.md +12 -6
  41. package/.docs/models/gateways/openrouter.md +9 -11
  42. package/.docs/models/gateways/vercel.md +7 -6
  43. package/.docs/models/index.md +1 -1
  44. package/.docs/models/providers/agentrouter.md +17 -34
  45. package/.docs/models/providers/agnes.md +75 -0
  46. package/.docs/models/providers/aixy.md +73 -0
  47. package/.docs/models/providers/aki-io.md +14 -13
  48. package/.docs/models/providers/chutes.md +2 -2
  49. package/.docs/models/providers/cline-pass.md +4 -2
  50. package/.docs/models/providers/crof.md +3 -8
  51. package/.docs/models/providers/crossmodel.md +56 -55
  52. package/.docs/models/providers/deepseek.md +9 -10
  53. package/.docs/models/providers/digitalocean.md +1 -1
  54. package/.docs/models/providers/edenai.md +14 -13
  55. package/.docs/models/providers/evroc.md +3 -2
  56. package/.docs/models/providers/gmicloud.md +6 -4
  57. package/.docs/models/providers/huggingface.md +2 -1
  58. package/.docs/models/providers/hyper.md +6 -6
  59. package/.docs/models/providers/inceptron.md +2 -2
  60. package/.docs/models/providers/iteracompute.md +73 -0
  61. package/.docs/models/providers/kilo.md +31 -28
  62. package/.docs/models/providers/llmgateway-providers.md +20 -9
  63. package/.docs/models/providers/llmgateway.md +3 -5
  64. package/.docs/models/providers/llmtech.md +73 -0
  65. package/.docs/models/providers/nano-gpt.md +24 -13
  66. package/.docs/models/providers/neosmith.md +104 -0
  67. package/.docs/models/providers/nvidia.md +3 -1
  68. package/.docs/models/providers/ofox.md +114 -110
  69. package/.docs/models/providers/openai.md +2 -2
  70. package/.docs/models/providers/opencode-go.md +26 -24
  71. package/.docs/models/providers/opencode.md +1 -1
  72. package/.docs/models/providers/opper.md +112 -0
  73. package/.docs/models/providers/pendra.md +78 -0
  74. package/.docs/models/providers/requesty.md +1 -1
  75. package/.docs/models/providers/scaleway.md +2 -1
  76. package/.docs/models/providers/standardcompute.md +73 -0
  77. package/.docs/models/providers/vivgrid.md +2 -1
  78. package/.docs/models/providers/wandb.md +2 -1
  79. package/.docs/models/providers/zai.md +2 -1
  80. package/.docs/models/providers.md +9 -0
  81. package/.docs/reference/agents/channels.md +1 -1
  82. package/.docs/reference/ai-sdk/handle-chat-stream.md +11 -0
  83. package/.docs/reference/ai-sdk/with-sse-heartbeat.md +47 -0
  84. package/.docs/reference/cli/mastra.md +10 -4
  85. package/.docs/reference/client-js/observability.md +1 -1
  86. package/.docs/reference/index.md +5 -0
  87. package/.docs/reference/observability/feedback.md +4 -0
  88. package/.docs/reference/observability/metrics/automatic-metrics.md +1 -1
  89. package/.docs/reference/observability/metrics/queries.md +462 -0
  90. package/.docs/reference/pubsub/valkey-streams.md +84 -0
  91. package/.docs/reference/rag/vector-databases.md +4 -4
  92. package/.docs/reference/server/elysia-adapter.md +184 -0
  93. package/.docs/reference/server/express-adapter.md +6 -8
  94. package/.docs/reference/server/hono-adapter.md +19 -6
  95. package/.docs/reference/storage/turso.md +88 -0
  96. package/.docs/reference/streaming/ChunkType.md +29 -1
  97. package/.docs/reference/streaming/agents/stream.md +1 -3
  98. package/.docs/reference/tools/mcp-client.md +41 -9
  99. package/.docs/reference/vectors/mongodb.md +11 -11
  100. package/.docs/reference/vectors/pg.md +2 -0
  101. package/.docs/reference/workspace/local-sandbox.md +2 -0
  102. package/.docs/reference/workspace/platform-sandbox.md +3 -1
  103. package/.docs/reference/workspace/sandbox.md +143 -3
  104. package/.docs/reference/workspace/workspace-class.md +13 -1
  105. package/CHANGELOG.md +88 -0
  106. package/package.json +6 -6
  107. package/.docs/docs/observability/metrics/querying.md +0 -314
@@ -0,0 +1,462 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Metric queries
4
+
5
+ Metric queries read raw and aggregated metric data from the observability storage domain. For exporter and storage setup, see the [Metrics overview](https://mastra.ai/docs/observability/metrics/overview). For automatic metric names and labels, see the [Automatic metrics reference](https://mastra.ai/reference/observability/metrics/automatic-metrics).
6
+
7
+ ## Access
8
+
9
+ ### Observability store
10
+
11
+ Use the storage domain for in-process queries:
12
+
13
+ ```typescript
14
+ const observability = await mastra.getStorage()?.getStore('observability')
15
+
16
+ if (!observability) {
17
+ throw new Error('Observability storage is not configured')
18
+ }
19
+
20
+ const result = await observability.getMetricAggregate({
21
+ name: ['mastra_agent_duration_ms'],
22
+ aggregation: 'avg',
23
+ filters: {
24
+ timestamp: { start: new Date(Date.now() - 60 * 60 * 1000) },
25
+ },
26
+ })
27
+ ```
28
+
29
+ `getStore('observability')` returns `undefined` when the storage configuration doesn't provide the observability domain.
30
+
31
+ ### Client SDK
32
+
33
+ `@mastra/client-js` exposes the analytics and metric discovery methods on `MastraClient`:
34
+
35
+ ```typescript
36
+ import { MastraClient } from '@mastra/client-js'
37
+
38
+ const client = new MastraClient({
39
+ baseUrl: 'http://localhost:4111',
40
+ })
41
+
42
+ const result = await client.getMetricAggregate({
43
+ name: ['mastra_agent_duration_ms'],
44
+ aggregation: 'avg',
45
+ })
46
+ ```
47
+
48
+ The client doesn't expose a raw `listMetrics()` method. Use the observability store or the `GET /api/observability/metrics` route to list raw metric records.
49
+
50
+ ## Shared values
51
+
52
+ ### Aggregations
53
+
54
+ The aggregate, breakdown, and time-series methods accept these `aggregation` values:
55
+
56
+ | Value | Result |
57
+ | ---------------- | ---------------------------------------------------------------------------------------------------- |
58
+ | `sum` | Sum of metric values |
59
+ | `avg` | Average metric value |
60
+ | `min` | Minimum metric value |
61
+ | `max` | Maximum metric value |
62
+ | `count` | Number of matching metric records |
63
+ | `count_distinct` | Approximate or exact number of distinct values in `distinctColumn`, depending on the storage backend |
64
+ | `last` | Most recent matching metric value |
65
+
66
+ When `aggregation` is `count_distinct`, `distinctColumn` is required. Supported columns are:
67
+
68
+ ```text
69
+ entityType
70
+ entityName
71
+ parentEntityType
72
+ parentEntityName
73
+ rootEntityType
74
+ rootEntityName
75
+ name
76
+ provider
77
+ model
78
+ environment
79
+ executionSource
80
+ serviceName
81
+ threadId
82
+ resourceId
83
+ ```
84
+
85
+ ### Intervals
86
+
87
+ Time-series and percentile queries accept `1m`, `5m`, `15m`, `1h`, or `1d`.
88
+
89
+ ### Filters
90
+
91
+ All metric operations accept the same optional `filters` object. Raw list requests pass these fields as query parameters. Analytics methods pass them in the JSON request body.
92
+
93
+ | Field | Type | Description |
94
+ | ----------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
95
+ | `timestamp` | `{ start?: Date; end?: Date; startExclusive?: boolean; endExclusive?: boolean }` | Timestamp range. Boundaries are inclusive unless their corresponding exclusive flag is `true`. HTTP requests use ISO date strings. |
96
+ | `traceId` | `string` | Exact trace ID |
97
+ | `traceIds` | `string[]` | One to 1,000 trace IDs |
98
+ | `spanId` | `string` | Exact span ID |
99
+ | `entityType` | `EntityType` | Entity type |
100
+ | `entityName` | `string` | Entity name |
101
+ | `entityVersionId` | `string` | Entity version ID |
102
+ | `parentEntityType` | `EntityType` | Parent entity type |
103
+ | `parentEntityName` | `string` | Parent entity name |
104
+ | `parentEntityVersionId` | `string` | Parent entity version ID |
105
+ | `rootEntityType` | `EntityType` | Root entity type |
106
+ | `rootEntityName` | `string` | Root entity name |
107
+ | `rootEntityVersionId` | `string` | Root entity version ID |
108
+ | `userId` | `string` | User ID |
109
+ | `organizationId` | `string` | Organization ID |
110
+ | `experimentId` | `string` | Experiment or evaluation run ID |
111
+ | `serviceName` | `string` | Service name |
112
+ | `environment` | `string` | Environment name |
113
+ | `resourceId` | `string` | Resource ID |
114
+ | `runId` | `string` | Run ID |
115
+ | `sessionId` | `string` | Session ID |
116
+ | `threadId` | `string` | Thread ID |
117
+ | `requestId` | `string` | Request ID |
118
+ | `executionSource` | `string` | Execution source |
119
+ | `tags` | `string[]` | Records must contain all specified tags |
120
+ | `name` | `string[]` | One or more metric names |
121
+ | `provider` | `string` | Model provider |
122
+ | `model` | `string` | Model ID |
123
+ | `costUnit` | `string` | Cost unit |
124
+ | `labels` | `Record<string, string>` | Exact matches for all specified metric label key-value pairs |
125
+ | `source` | `string` | Deprecated. Use `executionSource`. |
126
+
127
+ ## Analytics methods
128
+
129
+ ### `getMetricAggregate(args)`
130
+
131
+ Returns one value across all matching records. The observability store and `MastraClient` expose this method.
132
+
133
+ #### Arguments
134
+
135
+ | Field | Type | Required | Description |
136
+ | ---------------- | -------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------ |
137
+ | `name` | `string[]` | Yes | One or more metric names |
138
+ | `aggregation` | `AggregationType` | Yes | Aggregation to apply |
139
+ | `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
140
+ | `filters` | `MetricsFilter` | No | Shared metric filters |
141
+ | `comparePeriod` | `'previous_period' \| 'previous_day' \| 'previous_week'` | No | Adds comparison-period values. `previous_period` uses the duration of `filters.timestamp`. |
142
+
143
+ #### Returns
144
+
145
+ ```typescript
146
+ {
147
+ value: number | null
148
+ previousValue?: number | null
149
+ changePercent?: number | null
150
+ estimatedCost?: number | null
151
+ costUnit?: string | null
152
+ previousEstimatedCost?: number | null
153
+ costChangePercent?: number | null
154
+ }
155
+ ```
156
+
157
+ `costUnit` is `null` when the matching records don't have one shared unit. Cost fields are optional and may be `null` when the records don't include cost context.
158
+
159
+ ```typescript
160
+ const result = await observability.getMetricAggregate({
161
+ name: ['mastra_model_total_input_tokens', 'mastra_model_total_output_tokens'],
162
+ aggregation: 'sum',
163
+ filters: {
164
+ timestamp: {
165
+ start: new Date('2026-08-24T00:00:00Z'),
166
+ end: new Date('2026-08-25T00:00:00Z'),
167
+ },
168
+ },
169
+ comparePeriod: 'previous_period',
170
+ })
171
+ ```
172
+
173
+ **HTTP:** `POST /api/observability/metrics/aggregate`
174
+
175
+ ### `getMetricBreakdown(args)`
176
+
177
+ Groups matching records by one or more dimensions and aggregates each group. The observability store and `MastraClient` expose this method.
178
+
179
+ #### Arguments
180
+
181
+ | Field | Type | Required | Description |
182
+ | ---------------- | ---------------------- | -------------------- | ----------------------------------------------------------------------------------- |
183
+ | `name` | `string[]` | Yes | One or more metric names |
184
+ | `groupBy` | `string[]` | Yes | One or more fields to group by |
185
+ | `aggregation` | `AggregationType` | Yes | Aggregation for each group |
186
+ | `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
187
+ | `filters` | `MetricsFilter` | No | Shared metric filters |
188
+ | `limit` | `number` | No | Positive integer up to 1,000. Required for high-cardinality groupings. |
189
+ | `orderDirection` | `'ASC' \| 'DESC'` | No | Sort direction for the aggregated value. Storage implementations default to `DESC`. |
190
+
191
+ #### Returns
192
+
193
+ ```typescript
194
+ {
195
+ groups: Array<{
196
+ dimensions: Record<string, string | null>
197
+ value: number
198
+ estimatedCost?: number | null
199
+ costUnit?: string | null
200
+ }>
201
+ }
202
+ ```
203
+
204
+ ```typescript
205
+ const result = await client.getMetricBreakdown({
206
+ name: ['mastra_model_total_input_tokens'],
207
+ groupBy: ['entityName'],
208
+ aggregation: 'sum',
209
+ limit: 10,
210
+ orderDirection: 'DESC',
211
+ })
212
+ ```
213
+
214
+ **HTTP:** `POST /api/observability/metrics/breakdown`
215
+
216
+ ### `getMetricTimeSeries(args)`
217
+
218
+ Buckets matching values by time interval, with optional grouping. The observability store and `MastraClient` expose this method.
219
+
220
+ #### Arguments
221
+
222
+ | Field | Type | Required | Description |
223
+ | ---------------- | ---------------------- | -------------------- | ------------------------------------------- |
224
+ | `name` | `string[]` | Yes | One or more metric names |
225
+ | `interval` | `AggregationInterval` | Yes | Time bucket interval |
226
+ | `aggregation` | `AggregationType` | Yes | Aggregation for each bucket |
227
+ | `distinctColumn` | `MetricDistinctColumn` | For `count_distinct` | Column whose distinct values are counted |
228
+ | `filters` | `MetricsFilter` | No | Shared metric filters |
229
+ | `groupBy` | `string[]` | No | Fields used to split the result into series |
230
+
231
+ #### Returns
232
+
233
+ ```typescript
234
+ {
235
+ series: Array<{
236
+ name: string
237
+ costUnit?: string | null
238
+ points: Array<{
239
+ timestamp: Date
240
+ value: number
241
+ estimatedCost?: number | null
242
+ }>
243
+ }>
244
+ }
245
+ ```
246
+
247
+ ```typescript
248
+ const result = await client.getMetricTimeSeries({
249
+ name: ['mastra_model_total_input_tokens'],
250
+ interval: '1h',
251
+ aggregation: 'sum',
252
+ filters: {
253
+ timestamp: { start: new Date(Date.now() - 24 * 60 * 60 * 1000) },
254
+ },
255
+ })
256
+ ```
257
+
258
+ **HTTP:** `POST /api/observability/metrics/timeseries`
259
+
260
+ ### `getMetricPercentiles(args)`
261
+
262
+ Calculates percentile values in time buckets. The observability store and `MastraClient` expose this method.
263
+
264
+ #### Arguments
265
+
266
+ | Field | Type | Required | Description |
267
+ | ------------- | --------------------- | -------- | --------------------------------------- |
268
+ | `name` | `string` | Yes | One metric name |
269
+ | `percentiles` | `number[]` | Yes | One or more values from `0` through `1` |
270
+ | `interval` | `AggregationInterval` | Yes | Time bucket interval |
271
+ | `filters` | `MetricsFilter` | No | Shared metric filters |
272
+
273
+ #### Returns
274
+
275
+ ```typescript
276
+ {
277
+ series: Array<{
278
+ percentile: number
279
+ points: Array<{
280
+ timestamp: Date
281
+ value: number
282
+ }>
283
+ }>
284
+ }
285
+ ```
286
+
287
+ ```typescript
288
+ const result = await client.getMetricPercentiles({
289
+ name: 'mastra_agent_duration_ms',
290
+ percentiles: [0.5, 0.95, 0.99],
291
+ interval: '1h',
292
+ })
293
+ ```
294
+
295
+ **HTTP:** `POST /api/observability/metrics/percentiles`
296
+
297
+ ## Raw metric records
298
+
299
+ ### `listMetrics(args)`
300
+
301
+ Returns stored metric observations without aggregating them. This method is available on the observability store. The HTTP route accepts the same fields as query parameters.
302
+
303
+ #### Arguments
304
+
305
+ Page mode is the default:
306
+
307
+ ```typescript
308
+ {
309
+ mode?: 'page'
310
+ filters?: MetricsFilter
311
+ pagination?: {
312
+ page?: number // Default: 0
313
+ perPage?: number // Default: 10; maximum: 100
314
+ }
315
+ orderBy?: {
316
+ field?: 'timestamp' // Default: 'timestamp'
317
+ direction?: 'ASC' | 'DESC' // Default: 'DESC'
318
+ }
319
+ }
320
+ ```
321
+
322
+ Delta mode supports incremental polling:
323
+
324
+ ```typescript
325
+ {
326
+ mode: 'delta'
327
+ filters?: MetricsFilter
328
+ after?: string
329
+ limit?: number // Default: 10; maximum: 100
330
+ }
331
+ ```
332
+
333
+ `pagination` and `orderBy` aren't allowed in delta mode. `after` and `limit` aren't allowed in page mode. A backend that doesn't support delta polling returns an unsupported-operation error.
334
+
335
+ #### Returns
336
+
337
+ ```typescript
338
+ {
339
+ metrics: MetricRecord[]
340
+ pagination?: {
341
+ total: number
342
+ page: number
343
+ perPage: number | false
344
+ hasMore: boolean
345
+ }
346
+ delta?: {
347
+ limit: number
348
+ hasMore: boolean
349
+ }
350
+ deltaCursor?: string
351
+ }
352
+ ```
353
+
354
+ A `MetricRecord` has this shape:
355
+
356
+ ```typescript
357
+ {
358
+ metricId?: string | null
359
+ timestamp: Date
360
+ name: string
361
+ value: number
362
+ traceId?: string | null
363
+ spanId?: string | null
364
+ entityType?: EntityType | null
365
+ entityId?: string | null
366
+ entityName?: string | null
367
+ parentEntityType?: EntityType | null
368
+ parentEntityId?: string | null
369
+ parentEntityName?: string | null
370
+ rootEntityType?: EntityType | null
371
+ rootEntityId?: string | null
372
+ rootEntityName?: string | null
373
+ userId?: string | null
374
+ organizationId?: string | null
375
+ resourceId?: string | null
376
+ runId?: string | null
377
+ sessionId?: string | null
378
+ threadId?: string | null
379
+ requestId?: string | null
380
+ environment?: string | null
381
+ serviceName?: string | null
382
+ scope?: Record<string, unknown> | null
383
+ entityVersionId?: string | null
384
+ parentEntityVersionId?: string | null
385
+ rootEntityVersionId?: string | null
386
+ experimentId?: string | null
387
+ executionSource?: string | null
388
+ tags?: string[] | null
389
+ source?: string | null // Deprecated
390
+ provider?: string | null
391
+ model?: string | null
392
+ estimatedCost?: number | null
393
+ costUnit?: string | null
394
+ costMetadata?: Record<string, unknown> | null
395
+ labels: Record<string, string>
396
+ metadata?: Record<string, unknown> | null
397
+ }
398
+ ```
399
+
400
+ **HTTP:** `GET /api/observability/metrics`
401
+
402
+ ## Metric discovery
403
+
404
+ The observability store and `MastraClient` expose the metric discovery methods. HTTP requests pass arguments as query parameters.
405
+
406
+ | Method | Arguments | Returns | HTTP route |
407
+ | ---------------------------- | --------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------ |
408
+ | `getMetricNames(args?)` | `{ prefix?: string; limit?: number }` | `{ names: string[] }` | `GET /api/observability/discovery/metric-names` |
409
+ | `getMetricLabelKeys(args)` | `{ metricName: string }` | `{ keys: string[] }` | `GET /api/observability/discovery/metric-label-keys` |
410
+ | `getMetricLabelValues(args)` | `{ metricName: string; labelKey: string; prefix?: string; limit?: number }` | `{ values: string[] }` | `GET /api/observability/discovery/metric-label-values` |
411
+
412
+ `limit` must be a positive integer when provided.
413
+
414
+ ```typescript
415
+ const { names } = await client.getMetricNames({ prefix: 'mastra_model_' })
416
+ const { keys } = await client.getMetricLabelKeys({ metricName: names[0] })
417
+ const { values } = await client.getMetricLabelValues({
418
+ metricName: names[0],
419
+ labelKey: keys[0],
420
+ limit: 20,
421
+ })
422
+ ```
423
+
424
+ The observability discovery API also exposes shared dimensions used by traces, logs, and metrics:
425
+
426
+ | Store or client method | Arguments | HTTP route |
427
+ | ----------------------- | ----------------------------------------- | ------------------------------------------------ |
428
+ | `getEntityTypes()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/entity-types` |
429
+ | `getEntityNames(args?)` | `{ entityType?: EntityType }` | `GET /api/observability/discovery/entity-names` |
430
+ | `getServiceNames()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/service-names` |
431
+ | `getEnvironments()` | None in `MastraClient`; `{}` in the store | `GET /api/observability/discovery/environments` |
432
+ | `getTags(args?)` | `{ entityType?: EntityType }` | `GET /api/observability/discovery/tags` |
433
+
434
+ ## HTTP routes
435
+
436
+ | Method | Route | Input |
437
+ | ------ | -------------------------------------------------- | ---------------- |
438
+ | `GET` | `/api/observability/metrics` | Query parameters |
439
+ | `POST` | `/api/observability/metrics/aggregate` | JSON body |
440
+ | `POST` | `/api/observability/metrics/breakdown` | JSON body |
441
+ | `POST` | `/api/observability/metrics/timeseries` | JSON body |
442
+ | `POST` | `/api/observability/metrics/percentiles` | JSON body |
443
+ | `GET` | `/api/observability/discovery/metric-names` | Query parameters |
444
+ | `GET` | `/api/observability/discovery/metric-label-keys` | Query parameters |
445
+ | `GET` | `/api/observability/discovery/metric-label-values` | Query parameters |
446
+ | `GET` | `/api/observability/discovery/entity-types` | None |
447
+ | `GET` | `/api/observability/discovery/entity-names` | Query parameters |
448
+ | `GET` | `/api/observability/discovery/service-names` | None |
449
+ | `GET` | `/api/observability/discovery/environments` | None |
450
+ | `GET` | `/api/observability/discovery/tags` | Query parameters |
451
+
452
+ All routes require a configured observability domain. The aggregate, breakdown, time-series, and percentile routes require the `observability:read` permission when runtime authorization is enabled.
453
+
454
+ ## Unsupported backends
455
+
456
+ The base observability storage implementation throws `*_NOT_IMPLEMENTED` errors for raw listing, analytics, and discovery methods. A configured observability domain can therefore exist while its backend doesn't implement metric queries.
457
+
458
+ DuckDB, ClickHouse, Postgres v-next observability storage, and in-memory observability storage implement metric queries. Google Cloud Spanner implements them only when `disableMetrics` is `false`. Metrics are disabled by default. Other storage adapters may support tracing without supporting metrics.
459
+
460
+ ## CLI
461
+
462
+ The `mastra api metric` commands cover aggregate, breakdown, time-series, percentile, metric-name, label-key, and label-value queries. See the [`mastra api metric` CLI reference](https://mastra.ai/reference/cli/mastra) for commands, targeting, authentication, and schema inspection.
@@ -0,0 +1,84 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # ValkeyStreamsPubSub
4
+
5
+ `ValkeyStreamsPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) and [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) implementation backed by Valkey Streams through [Valkey GLIDE](https://github.com/valkey-io/valkey-glide). It provides persistent cross-process delivery, consumer groups, redelivery, topic cleanup, and distributed leasing.
6
+
7
+ Use it for Valkey deployments. Use [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) for Redis deployments that use the official `redis` client. Both integrations implement the same Mastra behavior, with independent tests running against Valkey and Redis.
8
+
9
+ ## Installation
10
+
11
+ **npm**:
12
+
13
+ ```bash
14
+ npm install @mastra/valkey-streams
15
+ ```
16
+
17
+ **pnpm**:
18
+
19
+ ```bash
20
+ pnpm add @mastra/valkey-streams
21
+ ```
22
+
23
+ **Yarn**:
24
+
25
+ ```bash
26
+ yarn add @mastra/valkey-streams
27
+ ```
28
+
29
+ **Bun**:
30
+
31
+ ```bash
32
+ bun add @mastra/valkey-streams
33
+ ```
34
+
35
+ ## Usage example
36
+
37
+ ```typescript
38
+ import { Mastra } from '@mastra/core'
39
+ import { ValkeyStreamsPubSub } from '@mastra/valkey-streams'
40
+
41
+ export const mastra = new Mastra({
42
+ pubsub: new ValkeyStreamsPubSub({
43
+ url: 'valkey://localhost:6379',
44
+ }),
45
+ })
46
+ ```
47
+
48
+ ## Constructor parameters
49
+
50
+ **url** (`string`): Valkey connection URL. Falls back to valkeyOptions.url. (Default: `valkey://localhost:6379`)
51
+
52
+ **valkeyOptions** (`ValkeyClientOptions`): GLIDE connection options, including native client configuration.
53
+
54
+ **keyPrefix** (`string`): Prefix for stream keys. (Default: `mastra:topic`)
55
+
56
+ **blockMs** (`number`): How long each read blocks while waiting for events. (Default: `1000`)
57
+
58
+ **maxStreamLength** (`number`): Approximate maximum entries retained per stream. Set to 0 to disable trimming. (Default: `10000`)
59
+
60
+ **streamIdleTtlMs** (`number`): Sliding idle expiry refreshed on stream writes. Set to 0 to disable. (Default: `0`)
61
+
62
+ **reclaimIntervalMs** (`number`): Interval for reclaiming unacknowledged events. Set to 0 to disable. (Default: `30000`)
63
+
64
+ **reclaimIdleMs** (`number`): Minimum idle time before an event can be reclaimed. (Default: `60000`)
65
+
66
+ **maxDeliveryAttempts** (`number`): Maximum nack redeliveries. Pass Infinity to disable the cap. (Default: `5`)
67
+
68
+ **logger** (`{ debug?: Function; warn?: Function }`): Optional diagnostic logger.
69
+
70
+ ## Delivery behavior
71
+
72
+ `ValkeyStreamsPubSub` supports pull delivery and doesn't support numeric replay offsets. Grouped subscribers compete for events through a shared consumer group. Subscribers without a group receive fan-out delivery through private consumer groups.
73
+
74
+ Use `startFrom: "latest"` to skip retained entries when a group is first created. The default, `"earliest"`, reads retained entries first.
75
+
76
+ ## Cleanup and shutdown
77
+
78
+ `clearTopic(topic)` deletes a topic stream and its consumer groups. `flush()` waits for in-flight publishes, and `close()` stops subscriptions and closes GLIDE connections.
79
+
80
+ ```typescript
81
+ await pubsub.clearTopic('workflow.events.run-123')
82
+ await pubsub.flush()
83
+ await pubsub.close()
84
+ ```
@@ -27,9 +27,9 @@ await store.upsert({
27
27
  })
28
28
  ```
29
29
 
30
- ### Using MongoDB Atlas Vector Search
30
+ ### Using MongoDB Vector Search
31
31
 
32
- For detailed setup instructions and best practices, see the [official MongoDB Atlas Vector Search documentation](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/?utm_campaign=devrel\&utm_source=third-party-content\&utm_medium=cta\&utm_content=mastra-docs).
32
+ MongoDB Vector Search is a good solution for teams who want to consolidate vector search, full-text search, and operational data in a single database to minimize infrastructure complexity and maintain production-grade performance. For detailed setup instructions and best practices, see the [official MongoDB Vector Search documentation](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/?utm_campaign=devrel\&utm_source=third-party-content\&utm_medium=cta\&utm_content=mastra-docs).
33
33
 
34
34
  ### Using VoyageAI with MongoDB
35
35
 
@@ -37,7 +37,7 @@ MongoDB works seamlessly with VoyageAI's embedding models, which are optimized f
37
37
 
38
38
  ### Hybrid Search (Vector + Full-Text)
39
39
 
40
- MongoDB supports hybrid search that fuses vector similarity with BM25 full-text search using server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and enabled on Atlas 8.0.x). This is useful when you want to combine semantic and keyword-based retrieval:
40
+ MongoDB supports hybrid search that fuses vector similarity with BM25 full-text search using server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and enabled on MongoDB Atlas 8.0.x). This is useful when you want to combine semantic and keyword-based retrieval:
41
41
 
42
42
  ```ts
43
43
  await store.createSearchIndex({ indexName: 'myCollection', fields: ['text'] })
@@ -420,7 +420,7 @@ Each vector database enforces specific naming conventions for indexes and collec
420
420
 
421
421
  **MongoDB**:
422
422
 
423
- Collection (index) names must:
423
+ Collection and index names must:
424
424
 
425
425
  - Start with a letter or underscore
426
426
  - Be up to 120 bytes long