@mastra/mcp-docs-server 1.2.18-alpha.3 → 1.2.18-alpha.6
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.
- package/.docs/docs/datasets/running-experiments.md +86 -1
- package/.docs/docs/mastra-platform/deploy.md +3 -1
- package/.docs/docs/mastra-platform/workspaces.md +6 -3
- package/.docs/docs/sandbox/filesystem.md +120 -139
- package/.docs/docs/sandbox/lsp.md +195 -143
- package/.docs/docs/sandbox/overview.md +103 -69
- package/.docs/docs/sandbox/search.md +172 -153
- package/.docs/docs/sandbox/skills.md +94 -151
- package/.docs/integrations/deploy/render.md +136 -89
- package/.docs/integrations/observability/arize.md +8 -6
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/edenai.md +2 -3
- package/.docs/models/providers/empiriolabs.md +1 -1
- package/.docs/models/providers/kilo.md +2 -2
- package/.docs/models/providers/llmgateway.md +2 -1
- package/.docs/models/providers/nano-gpt.md +3 -1
- package/.docs/models/providers/ofox.md +1 -1
- package/.docs/models/providers/opencode.md +65 -65
- package/.docs/reference/cli/mastra.md +2 -2
- package/.docs/reference/client-js/datasets.md +146 -0
- package/.docs/reference/configuration.md +58 -0
- package/.docs/reference/datasets/createExperiment.md +76 -0
- package/.docs/reference/datasets/finalizeExperiment.md +43 -0
- package/.docs/reference/datasets/runExperimentItem.md +55 -0
- package/.docs/reference/datasets/submitExperimentResult.md +56 -0
- package/.docs/reference/index.md +5 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +2 -0
- package/.docs/reference/pubsub/redis-streams.md +11 -1
- package/.docs/reference/rag/metadata-filters.md +16 -8
- package/.docs/reference/rag/retrieval.md +113 -5
- package/.docs/reference/server/routes.md +111 -0
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
package/.docs/reference/index.md
CHANGED
|
@@ -68,6 +68,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
68
68
|
- [mastra](https://mastra.ai/reference/cli/mastra)
|
|
69
69
|
- [Agents API](https://mastra.ai/reference/client-js/agents)
|
|
70
70
|
- [Conversations API](https://mastra.ai/reference/client-js/conversations)
|
|
71
|
+
- [Datasets API](https://mastra.ai/reference/client-js/datasets)
|
|
71
72
|
- [Error Handling](https://mastra.ai/reference/client-js/error-handling)
|
|
72
73
|
- [Logs API](https://mastra.ai/reference/client-js/logs)
|
|
73
74
|
- [Mastra Client SDK](https://mastra.ai/reference/client-js/mastra-client)
|
|
@@ -166,10 +167,12 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
166
167
|
- [.addItems()](https://mastra.ai/reference/datasets/addItems)
|
|
167
168
|
- [.compareExperiments()](https://mastra.ai/reference/datasets/compareExperiments)
|
|
168
169
|
- [.create()](https://mastra.ai/reference/datasets/create)
|
|
170
|
+
- [.createExperiment()](https://mastra.ai/reference/datasets/createExperiment)
|
|
169
171
|
- [.delete()](https://mastra.ai/reference/datasets/delete)
|
|
170
172
|
- [.deleteExperiment()](https://mastra.ai/reference/datasets/deleteExperiment)
|
|
171
173
|
- [.deleteItem()](https://mastra.ai/reference/datasets/deleteItem)
|
|
172
174
|
- [.deleteItems()](https://mastra.ai/reference/datasets/deleteItems)
|
|
175
|
+
- [.finalizeExperiment()](https://mastra.ai/reference/datasets/finalizeExperiment)
|
|
173
176
|
- [.get()](https://mastra.ai/reference/datasets/get)
|
|
174
177
|
- [.getDetails()](https://mastra.ai/reference/datasets/getDetails)
|
|
175
178
|
- [.getExperiment()](https://mastra.ai/reference/datasets/getExperiment)
|
|
@@ -180,8 +183,10 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
180
183
|
- [.listExperiments()](https://mastra.ai/reference/datasets/listExperiments)
|
|
181
184
|
- [.listItems()](https://mastra.ai/reference/datasets/listItems)
|
|
182
185
|
- [.listVersions()](https://mastra.ai/reference/datasets/listVersions)
|
|
186
|
+
- [.runExperimentItem()](https://mastra.ai/reference/datasets/runExperimentItem)
|
|
183
187
|
- [.startExperiment()](https://mastra.ai/reference/datasets/startExperiment)
|
|
184
188
|
- [.startExperimentAsync()](https://mastra.ai/reference/datasets/startExperimentAsync)
|
|
189
|
+
- [.submitExperimentResult()](https://mastra.ai/reference/datasets/submitExperimentResult)
|
|
185
190
|
- [.update()](https://mastra.ai/reference/datasets/update)
|
|
186
191
|
- [.updateItem()](https://mastra.ai/reference/datasets/updateItem)
|
|
187
192
|
- [config.ts](https://mastra.ai/reference/file-based-agents/config)
|
|
@@ -17,6 +17,7 @@ interface LangfuseExporterConfig extends BaseExporterConfig {
|
|
|
17
17
|
publicKey?: string
|
|
18
18
|
secretKey?: string
|
|
19
19
|
baseUrl?: string
|
|
20
|
+
additionalHeaders?: Record<string, string>
|
|
20
21
|
realtime?: boolean
|
|
21
22
|
flushAt?: number
|
|
22
23
|
flushInterval?: number
|
|
@@ -78,6 +79,7 @@ const exporter = new LangfuseExporter({
|
|
|
78
79
|
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
|
|
79
80
|
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
|
80
81
|
baseUrl: 'https://cloud.langfuse.com',
|
|
82
|
+
additionalHeaders: { 'x-custom-header': 'custom-value' },
|
|
81
83
|
realtime: true,
|
|
82
84
|
})
|
|
83
85
|
```
|
|
@@ -135,4 +135,14 @@ When a subscriber calls `nack`, the event is republished with an incremented `de
|
|
|
135
135
|
|
|
136
136
|
Lease keys are namespaced under the same `keyPrefix` as topics, as `<keyPrefix>:lease:<key>`. All operations are atomic: `acquireLease` uses `SET NX PX` and refreshes its own TTL idempotently, while `releaseLease`, `renewLease`, and `transferLease` use Lua scripts that check ownership before mutating, so a concurrent renewal from another owner is never clobbered.
|
|
137
137
|
|
|
138
|
-
You don't call these methods directly. Configuring `RedisStreamsPubSub` as the `pubsub` backend is enough for the runtime to detect and use the capability. See [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) for the full method contract.
|
|
138
|
+
You don't call these methods directly. Configuring `RedisStreamsPubSub` as the `pubsub` backend is enough for the runtime to detect and use the capability. See [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) for the full method contract.
|
|
139
|
+
|
|
140
|
+
## Managed provisioning
|
|
141
|
+
|
|
142
|
+
When you deploy a project that reads `REDIS_URL` from the environment, the Mastra CLI's `deploy` preflight offers to attach a managed Redis on the Mastra platform in one step.
|
|
143
|
+
|
|
144
|
+
If you accept, `mastra deploy` provisions the database and waits for it to reach the ready state before injecting `REDIS_URL` into the deploy so `new RedisStreamsPubSub({ url: process.env.REDIS_URL })` connects without extra setup.
|
|
145
|
+
|
|
146
|
+
The prompt is shown only when three conditions hold: `REDIS_URL` is referenced by user code, the environment's value is missing or points to a localhost address, and the run is interactive (a terminal without the `--yes` flag). Non-interactive runs (CI, `--yes`) report the issue with a copy-pasteable `mastra env db create --kind redis` command instead of silently creating infrastructure.
|
|
147
|
+
|
|
148
|
+
You can also provision a managed Redis up front with `mastra env db create --kind redis`. Once attached, the platform meters CPU seconds and memory GB-hours and shows them on the project's Database Usage page.
|
|
@@ -46,7 +46,7 @@ const results = await store.query({
|
|
|
46
46
|
|
|
47
47
|
### Custom Operators
|
|
48
48
|
|
|
49
|
-
`$contains`Text contains substring{ description: { $contains: "sale" } }Supported by: Upstash, libSQL, PgVector, OracleDB`$regex`Regular expression match{ name: { $regex: "^test" } }Supported by: Qdrant, PgVector, Upstash, MongoDB, OracleDB`$size`Array length check{ tags: { $size: 3 } }Supported by: Astra, libSQL, PgVector, MongoDB, OracleDB`$geo`Geospatial query{ location: { $geo: { type: "radius", ... } } }Supported by: Qdrant`$datetime`Datetime range query{ created: { $datetime: { range: { gt: "2024-01-01" } } } }Supported by: Qdrant`$hasId`Vector ID existence check{ $hasId: \["id1", "id2"] }Supported by: Qdrant`$hasVector`Vector existence check{ $hasVector: true }Supported by: Qdrant
|
|
49
|
+
`$contains`Text contains substring{ description: { $contains: "sale" } }Supported by: Upstash, libSQL, PgVector, OracleDB`$regex`Regular expression match{ name: { $regex: "^test" } }Supported by: Qdrant, PgVector, Upstash, MongoDB, OracleDB`$size`Array length check{ tags: { $size: { $gt: 2 } } } — MongoDB requires an integer instead: { tags: { $size: 3 } }Supported by: Astra, libSQL, PgVector, MongoDB, OracleDB`$geo`Geospatial query{ location: { $geo: { type: "radius", ... } } }Supported by: Qdrant`$datetime`Datetime range query{ created: { $datetime: { range: { gt: "2024-01-01" } } } }Supported by: Qdrant`$hasId`Vector ID existence check{ $hasId: \["id1", "id2"] }Supported by: Qdrant`$hasVector`Vector existence check{ $hasVector: true }Supported by: Qdrant
|
|
50
50
|
|
|
51
51
|
## Common rules and restrictions
|
|
52
52
|
|
|
@@ -186,13 +186,21 @@ const results = await store.query({
|
|
|
186
186
|
|
|
187
187
|
### MongoDB
|
|
188
188
|
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
- Supports
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
- Requires MongoDB Atlas or a deployment with MongoDB Vector Search enabled. The store queries with the `$vectorSearch` aggregation stage.
|
|
190
|
+
- Uses MongoDB query syntax directly for metadata filters, including nested fields and arrays in metadata.
|
|
191
|
+
- Supports the comparison, array, logical, and element operators in the tables above, plus `$regex` and `$size`. `$size` takes an integer, as in `{ tags: { $size: 3 } }`.
|
|
192
|
+
- Use `filter` to match fields in the metadata object and `documentFilter` to match the original document text. You can combine them in a single query.
|
|
193
|
+
- Declare the metadata fields you filter on in `filterFields` when you create the index. Mastra passes filters that use only declared fields and the operators MongoDB Vector Search accepts (`$and`, `$or`, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin`) directly to `$vectorSearch`:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
await store.createIndex({
|
|
197
|
+
indexName: 'my_index',
|
|
198
|
+
dimension: 1536,
|
|
199
|
+
filterFields: ['category', 'price'],
|
|
200
|
+
})
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
- Filters that reference an undeclared field or use another operator take a fallback path: Mastra pre-filters the collection and passes the matching document IDs to `$vectorSearch`. This works only while the ID set fits within MongoDB's 16 MB BSON document limit. On large collections the query fails once that limit is exceeded, so declare your filter fields for selective queries over large data sets.
|
|
196
204
|
|
|
197
205
|
### Couchbase
|
|
198
206
|
|
|
@@ -77,9 +77,19 @@ For detailed information about available operators and syntax, see the [Metadata
|
|
|
77
77
|
|
|
78
78
|
Basic filtering examples:
|
|
79
79
|
|
|
80
|
+
**MongoDB**:
|
|
81
|
+
|
|
80
82
|
```ts
|
|
83
|
+
import { MongoDBVector } from '@mastra/mongodb'
|
|
84
|
+
|
|
85
|
+
const mongoVector = new MongoDBVector({
|
|
86
|
+
id: 'mongodb-vector',
|
|
87
|
+
uri: process.env.MONGODB_URI,
|
|
88
|
+
dbName: process.env.MONGODB_DB_NAME,
|
|
89
|
+
})
|
|
90
|
+
|
|
81
91
|
// Simple equality filter
|
|
82
|
-
const
|
|
92
|
+
const equalityResults = await mongoVector.query({
|
|
83
93
|
indexName: 'embeddings',
|
|
84
94
|
queryVector: embedding,
|
|
85
95
|
topK: 10,
|
|
@@ -89,7 +99,7 @@ const results = await pgVector.query({
|
|
|
89
99
|
})
|
|
90
100
|
|
|
91
101
|
// Numeric comparison
|
|
92
|
-
const
|
|
102
|
+
const priceResults = await mongoVector.query({
|
|
93
103
|
indexName: 'embeddings',
|
|
94
104
|
queryVector: embedding,
|
|
95
105
|
topK: 10,
|
|
@@ -99,7 +109,7 @@ const results = await pgVector.query({
|
|
|
99
109
|
})
|
|
100
110
|
|
|
101
111
|
// Multiple conditions
|
|
102
|
-
const
|
|
112
|
+
const compoundResults = await mongoVector.query({
|
|
103
113
|
indexName: 'embeddings',
|
|
104
114
|
queryVector: embedding,
|
|
105
115
|
topK: 10,
|
|
@@ -111,7 +121,7 @@ const results = await pgVector.query({
|
|
|
111
121
|
})
|
|
112
122
|
|
|
113
123
|
// Array operations
|
|
114
|
-
const
|
|
124
|
+
const tagResults = await mongoVector.query({
|
|
115
125
|
indexName: 'embeddings',
|
|
116
126
|
queryVector: embedding,
|
|
117
127
|
topK: 10,
|
|
@@ -121,7 +131,64 @@ const results = await pgVector.query({
|
|
|
121
131
|
})
|
|
122
132
|
|
|
123
133
|
// Logical operators
|
|
124
|
-
const
|
|
134
|
+
const categoryResults = await mongoVector.query({
|
|
135
|
+
indexName: 'embeddings',
|
|
136
|
+
queryVector: embedding,
|
|
137
|
+
topK: 10,
|
|
138
|
+
filter: {
|
|
139
|
+
$or: [{ category: 'electronics' }, { category: 'accessories' }],
|
|
140
|
+
$and: [{ price: { $gt: 50 } }, { price: { $lt: 200 } }],
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**pgVector**:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
// Simple equality filter
|
|
149
|
+
const equalityResults = await pgVector.query({
|
|
150
|
+
indexName: 'embeddings',
|
|
151
|
+
queryVector: embedding,
|
|
152
|
+
topK: 10,
|
|
153
|
+
filter: {
|
|
154
|
+
source: 'article1.txt',
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// Numeric comparison
|
|
159
|
+
const priceResults = await pgVector.query({
|
|
160
|
+
indexName: 'embeddings',
|
|
161
|
+
queryVector: embedding,
|
|
162
|
+
topK: 10,
|
|
163
|
+
filter: {
|
|
164
|
+
price: { $gt: 100 },
|
|
165
|
+
},
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
// Multiple conditions
|
|
169
|
+
const compoundResults = await pgVector.query({
|
|
170
|
+
indexName: 'embeddings',
|
|
171
|
+
queryVector: embedding,
|
|
172
|
+
topK: 10,
|
|
173
|
+
filter: {
|
|
174
|
+
category: 'electronics',
|
|
175
|
+
price: { $lt: 1000 },
|
|
176
|
+
inStock: true,
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
// Array operations
|
|
181
|
+
const tagResults = await pgVector.query({
|
|
182
|
+
indexName: 'embeddings',
|
|
183
|
+
queryVector: embedding,
|
|
184
|
+
topK: 10,
|
|
185
|
+
filter: {
|
|
186
|
+
tags: { $in: ['sale', 'new'] },
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// Logical operators
|
|
191
|
+
const categoryResults = await pgVector.query({
|
|
125
192
|
indexName: 'embeddings',
|
|
126
193
|
queryVector: embedding,
|
|
127
194
|
topK: 10,
|
|
@@ -141,6 +208,47 @@ Common use cases for metadata filtering:
|
|
|
141
208
|
- Combine multiple conditions for precise querying
|
|
142
209
|
- Filter by document attributes (e.g., language, author)
|
|
143
210
|
|
|
211
|
+
### Where the filter is applied
|
|
212
|
+
|
|
213
|
+
Vector stores differ in _when_ they apply a metadata filter, which affects how filtered queries scale.
|
|
214
|
+
|
|
215
|
+
MongoDB can evaluate the filter inside the vector index itself. This keeps the query on a single round trip to `$vectorSearch`, so it avoids the pre-filter pass that collects matching document IDs and the 16 MB BSON limit that pass is subject to. Declaring the fields you filter on in `filterFields` when you create the index is what enables it:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
// Declare the metadata fields you want to filter on
|
|
219
|
+
await mongoVector.createIndex({
|
|
220
|
+
indexName: 'embeddings',
|
|
221
|
+
dimension: 1536,
|
|
222
|
+
filterFields: ['source', 'price', 'category', 'inStock', 'tags'],
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
// createIndex() returns before the index finishes building
|
|
226
|
+
await mongoVector.waitForIndexReady({ indexName: 'embeddings' })
|
|
227
|
+
|
|
228
|
+
// The filter is applied during the index search
|
|
229
|
+
const results = await mongoVector.query({
|
|
230
|
+
indexName: 'embeddings',
|
|
231
|
+
queryVector: embedding,
|
|
232
|
+
topK: 10,
|
|
233
|
+
filter: { source: 'article1.txt' },
|
|
234
|
+
})
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Mastra passes the filter to the index only when every field it references is declared in `filterFields` and every operator is one the index accepts: `$and`, `$or`, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, and `$nin`. A filter that uses an undeclared field or any other operator takes a fallback path: Mastra matches the collection first and passes the matching document IDs into the vector search. That fallback holds only while the ID set fits within MongoDB's 16 MB BSON document limit. On large collections the query fails once that limit is exceeded, so declare your filter fields when you expect selective filters over large data sets.
|
|
238
|
+
|
|
239
|
+
pgVector applies the filter as an ordinary query condition:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
const results = await pgVector.query({
|
|
243
|
+
indexName: 'embeddings',
|
|
244
|
+
queryVector: embedding,
|
|
245
|
+
topK: 10,
|
|
246
|
+
filter: { source: 'article1.txt' },
|
|
247
|
+
})
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Postgres vector indexes (HNSW and IVFFlat) can't restrict that search to rows matching a condition. When a filter is present, pgVector instead compares the query vector against every matching row and returns the closest `topK`. Results are exact, but the work grows with the number of rows the filter matches. Indexing the metadata column speeds up row retrieval. The distance comparisons still happen per row.
|
|
251
|
+
|
|
144
252
|
### Vector Query Tool
|
|
145
253
|
|
|
146
254
|
Sometimes you want to give your agent the ability to query a vector database directly. The Vector Query Tool allows your agent to be in charge of retrieval decisions, combining semantic search with optional filtering and reranking based on the agent's understanding of the user's needs.
|
|
@@ -368,6 +368,117 @@ On authenticated servers, the read routes require the `stored-workflows:read` pe
|
|
|
368
368
|
}
|
|
369
369
|
```
|
|
370
370
|
|
|
371
|
+
## Datasets and experiments
|
|
372
|
+
|
|
373
|
+
| Method | Path | Description |
|
|
374
|
+
| -------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
375
|
+
| `GET` | `/api/datasets` | List datasets |
|
|
376
|
+
| `POST` | `/api/datasets` | Create a dataset |
|
|
377
|
+
| `GET` | `/api/datasets/:datasetId` | Get dataset by ID |
|
|
378
|
+
| `PATCH` | `/api/datasets/:datasetId` | Update a dataset |
|
|
379
|
+
| `DELETE` | `/api/datasets/:datasetId` | Delete a dataset |
|
|
380
|
+
| `GET` | `/api/datasets/:datasetId/items` | List dataset items |
|
|
381
|
+
| `POST` | `/api/datasets/:datasetId/items` | Add a dataset item |
|
|
382
|
+
| `GET` | `/api/experiments` | List experiments across datasets |
|
|
383
|
+
| `GET` | `/api/datasets/:datasetId/experiments` | List experiments for a dataset |
|
|
384
|
+
| `POST` | `/api/datasets/:datasetId/experiments` | Trigger an experiment, or create one without starting it (`start: false`) |
|
|
385
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/items/:itemId/run` | Execute one experiment item server-side |
|
|
386
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/results` | Submit an externally computed item result |
|
|
387
|
+
| `POST` | `/api/datasets/:datasetId/experiments/:experimentId/finalize` | Finalize a caller-driven experiment |
|
|
388
|
+
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId` | Get experiment by ID |
|
|
389
|
+
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId/results` | List experiment results |
|
|
390
|
+
| `POST` | `/api/datasets/:datasetId/compare` | Compare two experiments |
|
|
391
|
+
|
|
392
|
+
### Caller-driven experiment routes
|
|
393
|
+
|
|
394
|
+
Use these routes when your own orchestrator (for example a Temporal workflow) owns the experiment loop and Mastra acts as the system of record. Item runs, result submission, and finalization are safe to retry. Creation is safe to retry only when the request includes a caller-supplied `id`; without one, each retry creates a new experiment. Item runs and result submissions upsert on `(experimentId, itemId, attempt)`. Finalize returns the stored record if the experiment is already completed.
|
|
395
|
+
|
|
396
|
+
#### Create experiment request body
|
|
397
|
+
|
|
398
|
+
Post to `/api/datasets/:datasetId/experiments` with `start: false` to create the experiment without running it. Include `targetType` and `targetId` when Mastra should execute items via the run-item route. Omit both for pure ingestion via the results route.
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
{
|
|
402
|
+
start?: boolean; // false creates the experiment without running it. Defaults to true.
|
|
403
|
+
id?: string; // Caller-supplied experiment id (e.g. a workflow run id) for idempotent creates
|
|
404
|
+
targetType?: 'agent' | 'workflow' | 'scorer'; // Provide with targetId, or omit both
|
|
405
|
+
targetId?: string;
|
|
406
|
+
scorerIds?: string[]; // Run-level scorer ids, resolved server-side. Requires a target when start is false.
|
|
407
|
+
name?: string;
|
|
408
|
+
description?: string;
|
|
409
|
+
metadata?: Record<string, unknown>;
|
|
410
|
+
version?: number; // Pin to a specific dataset version (defaults to latest)
|
|
411
|
+
provenance?: {
|
|
412
|
+
source?: string;
|
|
413
|
+
sourceId?: string;
|
|
414
|
+
sourceVersion?: string;
|
|
415
|
+
metadata?: Record<string, unknown>;
|
|
416
|
+
};
|
|
417
|
+
grouping?: { // Stable grouping dimensions for comparisons and repeated trials
|
|
418
|
+
experimentSetId?: string;
|
|
419
|
+
comparisonId?: string;
|
|
420
|
+
variantId?: string;
|
|
421
|
+
trialIndex?: number;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Returns `{ experimentId, status, totalItems, datasetVersion }` when `start` is `false`.
|
|
427
|
+
|
|
428
|
+
#### Run experiment item request body
|
|
429
|
+
|
|
430
|
+
`POST /api/datasets/:datasetId/experiments/:experimentId/items/:itemId/run` executes the experiment's target against one item and runs the resolved scorers, then upserts the result. Requires an experiment created with a target.
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
{
|
|
434
|
+
attempt?: number; // Zero-based repetition index. Defaults to 0.
|
|
435
|
+
requestContext?: Record<string, unknown>; // Merged with the item's own request context (item wins)
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Returns `{ result, scores }` with the persisted result row and the scores produced for the item.
|
|
440
|
+
|
|
441
|
+
#### Submit experiment result request body
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
{
|
|
445
|
+
itemId: string; // Dataset item this result belongs to
|
|
446
|
+
attempt?: number; // Zero-based repetition index. Defaults to 0.
|
|
447
|
+
input?: unknown; // Defaults to the dataset item input
|
|
448
|
+
output?: unknown; // Output produced by the external runner
|
|
449
|
+
groundTruth?: unknown; // Defaults to the dataset item groundTruth
|
|
450
|
+
error?: { // Failure info when the item run failed
|
|
451
|
+
message: string;
|
|
452
|
+
stack?: string;
|
|
453
|
+
code?: string;
|
|
454
|
+
} | null;
|
|
455
|
+
startedAt?: string; // ISO date
|
|
456
|
+
completedAt?: string; // ISO date
|
|
457
|
+
traceId?: string;
|
|
458
|
+
scores?: Array<{ // Externally computed scores, persisted keyed by runId = experimentId
|
|
459
|
+
scorerId: string;
|
|
460
|
+
scorerName?: string;
|
|
461
|
+
score: number;
|
|
462
|
+
reason?: string;
|
|
463
|
+
metadata?: Record<string, unknown>;
|
|
464
|
+
}>;
|
|
465
|
+
}
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Returns the persisted experiment result row.
|
|
469
|
+
|
|
470
|
+
#### Finalize experiment
|
|
471
|
+
|
|
472
|
+
`POST /api/datasets/:datasetId/experiments/:experimentId/finalize` takes no body. The server computes per-item counts from the persisted result rows and marks the experiment `completed`: `succeededCount` (at least one attempt without an error), `failedCount` (every attempt errored), and `skippedCount` (never submitted). Returns the updated experiment record.
|
|
473
|
+
|
|
474
|
+
#### Caller-driven experiment error responses
|
|
475
|
+
|
|
476
|
+
| Status | Condition |
|
|
477
|
+
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
478
|
+
| `400` | Result submitted to an experiment that has a target (`EXPERIMENT_HAS_TARGET`), item run requested on a target-less experiment (`EXPERIMENT_HAS_NO_TARGET`), `targetType` and `targetId` weren't provided together (`EXPERIMENT_INVALID_TARGET`), or the dataset has no items at the pinned version (`EXPERIMENT_NO_ITEMS`) |
|
|
479
|
+
| `404` | Dataset, experiment, dataset item, or target not found (`EXPERIMENT_TARGET_NOT_FOUND`) |
|
|
480
|
+
| `409` | Caller-supplied experiment `id` already exists for a different dataset or target (`EXPERIMENT_ID_CONFLICT`), or a call arrived after finalization (`EXPERIMENT_ALREADY_FINALIZED`) |
|
|
481
|
+
|
|
371
482
|
## MCP
|
|
372
483
|
|
|
373
484
|
| Method | Path | Description |
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.18-alpha.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`9267e9b`](https://github.com/mastra-ai/mastra/commit/9267e9b3d9c2fcf16936050495a787054c2431ab), [`acc3471`](https://github.com/mastra-ai/mastra/commit/acc3471de5f3fde8027ee4e355af292b2bc1bc30), [`b6a771e`](https://github.com/mastra-ai/mastra/commit/b6a771ef23d203ddb348efca8065eff65def8191), [`9267e9b`](https://github.com/mastra-ai/mastra/commit/9267e9b3d9c2fcf16936050495a787054c2431ab), [`26d4016`](https://github.com/mastra-ai/mastra/commit/26d40160ff7f7d8bf95fee2039a52cbc83863533), [`9267e9b`](https://github.com/mastra-ai/mastra/commit/9267e9b3d9c2fcf16936050495a787054c2431ab), [`9267e9b`](https://github.com/mastra-ai/mastra/commit/9267e9b3d9c2fcf16936050495a787054c2431ab), [`57c5103`](https://github.com/mastra-ai/mastra/commit/57c51035a2a36e3df3c4f32f46bb789a66ed5946)]:
|
|
8
|
+
- @mastra/core@1.61.0-alpha.3
|
|
9
|
+
|
|
10
|
+
## 1.2.18-alpha.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`480e491`](https://github.com/mastra-ai/mastra/commit/480e491588bd6a7a1c9ee4407590ad625dd33952), [`3bb88dd`](https://github.com/mastra-ai/mastra/commit/3bb88ddf07fb98f3cd16d3bff94e51cd3b45d011), [`d378d75`](https://github.com/mastra-ai/mastra/commit/d378d7511f71309ed61a8f6b93cd0361dc6cb70f), [`cad4208`](https://github.com/mastra-ai/mastra/commit/cad42082e6aa1776168a94914f523334be45d929), [`d378d75`](https://github.com/mastra-ai/mastra/commit/d378d7511f71309ed61a8f6b93cd0361dc6cb70f)]:
|
|
15
|
+
- @mastra/core@1.61.0-alpha.2
|
|
16
|
+
|
|
3
17
|
## 1.2.18-alpha.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.18-alpha.
|
|
3
|
+
"version": "1.2.18-alpha.6",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/core": "1.61.0-alpha.
|
|
31
|
+
"@mastra/core": "1.61.0-alpha.3",
|
|
32
32
|
"@mastra/mcp": "^1.17.1-alpha.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"vitest": "4.1.10",
|
|
48
48
|
"@internal/lint": "0.0.124",
|
|
49
49
|
"@internal/types-builder": "0.0.99",
|
|
50
|
-
"@mastra/core": "1.61.0-alpha.
|
|
50
|
+
"@mastra/core": "1.61.0-alpha.3"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|