@mastra/mcp-docs-server 1.2.25-alpha.1 → 1.2.25-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ const result = await mastraClient.queryTraces({
24
24
  op: 'and',
25
25
  args: [
26
26
  { op: 'eq', left: { path: 'scorerId' }, right: { literal: 'factuality' } },
27
+ { op: 'eq', left: { path: 'scorerVersion' }, right: { literal: '2.1.0' } },
27
28
  { op: 'lt', left: { path: 'score' }, right: { literal: 0.6 } },
28
29
  ],
29
30
  },
@@ -34,7 +35,7 @@ const result = await mastraClient.queryTraces({
34
35
  })
35
36
  ```
36
37
 
37
- A `some` clause matches when one related record satisfies its complete nested predicate. In this example, `scorerId` and `score` must match on the same score record. A `none` clause matches when no related record satisfies its complete nested predicate.
38
+ A `some` clause matches when one related record satisfies its complete nested predicate. In this example, `scorerId`, `scorerVersion`, and `score` must match on the same score record. A `none` clause uses anti-existence semantics: it matches when no related record satisfies its complete nested predicate. A trace with no related scores therefore matches `scores.none`.
38
39
 
39
40
  Span clauses examine the current root span and current child spans. The root `timeRange` applies only to the selected current root's `startedAt`. Related spans and scores can participate even when their own timestamps are outside that range. Related records correlate only through a matching non-null `traceId`.
40
41
 
@@ -99,17 +100,176 @@ Hono and Fastify enforce the request-body limit before JSON parsing. Express and
99
100
 
100
101
  ## Fields and operators
101
102
 
102
- | Predicate context | Fields | Operators |
103
- | ----------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
104
- | Trace | `traceId`, `threadId`, `resourceId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
105
- | Trace | `startedAt`, `endedAt` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
106
- | Span | `spanType` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
107
- | Span | `error` | `exists`, `notExists` |
108
- | Score | `scorerId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
109
- | Score | `score` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
103
+ | Predicate context | Fields | Operators |
104
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
105
+ | Trace | `traceId`, `threadId`, `resourceId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
106
+ | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
107
+ | Trace | `startedAt`, `endedAt` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
108
+ | Span | `name`, `spanType`, `model`, `provider`, `status`, `entityType`, `entityId`, `entityName`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
109
+ | Span | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
110
+ | Span | `error` | `exists`, `notExists` |
111
+ | Score | `scorerId`, `scorerVersion`, `scoreSource`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
112
+ | Score | `score`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
113
+ | Score | `spanId` | `exists`, `notExists` |
110
114
 
111
115
  Compose predicates with `{ op: 'and', args: [...] }`, `{ op: 'or', args: [...] }`, and `{ op: 'not', arg: ... }`. Comparison predicates place a field reference on the left and a literal on the right. Membership predicates use a field reference in `value` and a homogeneous literal array in `set`.
112
116
 
117
+ String comparisons are case-sensitive, and literals are never coerced. Canonical string fields compare exact stored values. Metadata string values are trimmed before comparison, as described below. Numeric predicates, including `score` and `durationMs`, require numbers, while timestamp predicates require ISO timestamp strings. A missing value satisfies neither positive nor ordered predicates, although it does satisfy the negative operators `ne` and `notIn`. Combine a negative predicate with `exists` when the field must also be present.
118
+
119
+ ### Filter by span properties
120
+
121
+ Every condition inside one `spans.some` or `spans.none` clause applies to the same current span. For example, this predicate finds a failed tool span whose name is `medication_lookup`; a matching name on one span and an error on another don't satisfy it:
122
+
123
+ ```typescript
124
+ const failedMedicationLookup = {
125
+ spans: {
126
+ some: {
127
+ op: 'and',
128
+ args: [
129
+ { op: 'eq', left: { path: 'name' }, right: { literal: 'medication_lookup' } },
130
+ { op: 'eq', left: { path: 'spanType' }, right: { literal: 'tool_call' } },
131
+ { op: 'exists', path: 'error' },
132
+ ],
133
+ },
134
+ },
135
+ }
136
+ ```
137
+
138
+ Use `status` for the derived `success` or `error` outcome. Use `error` when you only need to test whether error details are present.
139
+
140
+ `durationMs` is the span's elapsed time in milliseconds. Span `startedAt` and `endedAt` conditions filter related spans independently of the top-level root `timeRange`:
141
+
142
+ ```typescript
143
+ const slowModelCalls = {
144
+ spans: {
145
+ some: {
146
+ op: 'and',
147
+ args: [
148
+ { op: 'eq', left: { path: 'spanType' }, right: { literal: 'model_generation' } },
149
+ { op: 'gt', left: { path: 'durationMs' }, right: { literal: 5000 } },
150
+ {
151
+ op: 'gte',
152
+ left: { path: 'startedAt' },
153
+ right: { literal: '2026-07-15T00:00:00.000Z' },
154
+ },
155
+ ],
156
+ },
157
+ },
158
+ }
159
+ ```
160
+
161
+ `model` and `provider` read the canonical `attributes.model` and `attributes.provider` span attributes. Only stored string values are queryable; missing, null, and non-string values count as missing.
162
+
163
+ ```typescript
164
+ const selectedModel = {
165
+ spans: {
166
+ some: {
167
+ op: 'and',
168
+ args: [
169
+ {
170
+ op: 'eq',
171
+ left: { path: 'model' },
172
+ right: { literal: 'claude-sonnet-4-6' },
173
+ },
174
+ { op: 'eq', left: { path: 'provider' }, right: { literal: 'anthropic' } },
175
+ ],
176
+ },
177
+ },
178
+ }
179
+ ```
180
+
181
+ Use generic entity fields for tool and retrieval identity. The version fields let one clause qualify the same span by its entity lineage:
182
+
183
+ ```typescript
184
+ const versionedRetrieval = {
185
+ spans: {
186
+ some: {
187
+ op: 'and',
188
+ args: [
189
+ { op: 'eq', left: { path: 'entityType' }, right: { literal: 'rag_ingestion' } },
190
+ { op: 'eq', left: { path: 'entityId' }, right: { literal: 'medication-index' } },
191
+ { op: 'eq', left: { path: 'entityVersionId' }, right: { literal: 'index-v3' } },
192
+ { op: 'eq', left: { path: 'rootEntityVersionId' }, right: { literal: 'agent-v2' } },
193
+ ],
194
+ },
195
+ },
196
+ }
197
+ ```
198
+
199
+ ### Filter by score time
200
+
201
+ Score timestamps are independent of the required top-level trace `timeRange`. The top-level range selects trace candidates by trace start time. A nested `timestamp` predicate limits related score records:
202
+
203
+ ```typescript
204
+ const query = {
205
+ timeRange: {
206
+ from: '2026-08-01T00:00:00.000Z',
207
+ to: '2026-08-08T00:00:00.000Z',
208
+ },
209
+ where: {
210
+ scores: {
211
+ some: {
212
+ op: 'and',
213
+ args: [
214
+ { op: 'eq', left: { path: 'scoreSource' }, right: { literal: 'automated' } },
215
+ {
216
+ op: 'gte',
217
+ left: { path: 'timestamp' },
218
+ right: { literal: '2026-07-15T00:00:00.000Z' },
219
+ },
220
+ {
221
+ op: 'lt',
222
+ left: { path: 'timestamp' },
223
+ right: { literal: '2026-08-01T00:00:00.000Z' },
224
+ },
225
+ ],
226
+ },
227
+ },
228
+ },
229
+ }
230
+ ```
231
+
232
+ ### Filter by span anchoring
233
+
234
+ Use `spanId` only to test whether a score targets a span. The predicate doesn't join the score to a matching span predicate:
235
+
236
+ ```typescript
237
+ // At least one score targets a span.
238
+ const anchoredToSpanWhere = { scores: { some: { op: 'exists', path: 'spanId' } } }
239
+
240
+ // At least one score applies to the trace rather than a span.
241
+ const traceLevelScoreWhere = { scores: { some: { op: 'notExists', path: 'spanId' } } }
242
+ ```
243
+
244
+ The deprecated `source` field and `scorerName` aren't available as score predicate fields. Use the canonical `scoreSource` and `scorerId` fields.
245
+
246
+ ### Filter by metadata
247
+
248
+ Use `metadata.<key>` paths for custom dimensions stored on the current root span. Metadata predicates compare trimmed, non-empty string values exactly and case-sensitively. Leading and trailing whitespace in a stored string value is ignored. Values empty after trimming count as missing. Null, numeric, boolean, object, and array values also count as missing.
249
+
250
+ ```typescript
251
+ const messageTrace = {
252
+ op: 'and',
253
+ args: [
254
+ { op: 'eq', left: { path: 'metadata.messageId' }, right: { literal: 'message-123' } },
255
+ { op: 'in', value: { path: 'metadata.actorRole' }, set: ['assistant', 'tool'] },
256
+ { op: 'exists', path: 'metadata.protocolVersion' },
257
+ {
258
+ op: 'or',
259
+ args: [
260
+ { op: 'eq', left: { path: 'metadata.temporalRunId' }, right: { literal: 'run-456' } },
261
+ { op: 'eq', left: { path: 'metadata.externalTraceId' }, right: { literal: 'trace-789' } },
262
+ ],
263
+ },
264
+ { op: 'not', arg: { op: 'exists', path: 'metadata.parentMessageId' } },
265
+ ],
266
+ }
267
+ ```
268
+
269
+ The key must name one top-level property. Empty keys and nested paths are rejected. Metadata keys aren't trimmed, so leading and trailing whitespace remains part of the exact key identity. When metadata duplicates a canonical trace field, such as `resourceId`, `threadId`, or `environment`, prefer the canonical field because it uses the dedicated storage column. The `metadata.<key>` form remains available when you specifically need the value from the metadata object. Metadata and canonical values may differ.
270
+
271
+ Metadata fields aren't available for grouping or field discovery.
272
+
113
273
  ## Responses
114
274
 
115
275
  An ungrouped query returns only lightweight completed traces:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.2.25-alpha.1",
3
+ "version": "1.2.25-alpha.5",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "jsdom": "^26.1.0",
28
28
  "local-pkg": "^1.1.2",
29
29
  "zod": "^4.4.3",
30
- "@mastra/core": "1.66.0-alpha.0",
30
+ "@mastra/core": "1.66.0-alpha.2",
31
31
  "@mastra/mcp": "^1.17.3"
32
32
  },
33
33
  "devDependencies": {
@@ -45,7 +45,7 @@
45
45
  "typescript": "^7.0.2",
46
46
  "vitest": "4.1.10",
47
47
  "@internal/lint": "0.0.131",
48
- "@mastra/core": "1.66.0-alpha.0",
48
+ "@mastra/core": "1.66.0-alpha.2",
49
49
  "@internal/types-builder": "0.0.106"
50
50
  },
51
51
  "homepage": "https://mastra.ai",