@mastra/mcp-docs-server 1.1.2-alpha.0 → 1.1.3-alpha.0
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/agents/processors.md +52 -0
- package/.docs/docs/observability/datasets/overview.md +188 -0
- package/.docs/docs/observability/datasets/running-experiments.md +266 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +7 -4
- package/.docs/docs/server/server-adapters.md +5 -4
- package/.docs/guides/deployment/amazon-ec2.md +47 -24
- package/.docs/guides/deployment/netlify.md +5 -5
- package/.docs/guides/deployment/vercel.md +3 -3
- package/.docs/guides/getting-started/next-js.md +4 -4
- package/.docs/models/gateways/openrouter.md +5 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +3 -1
- package/.docs/models/providers/alibaba.md +3 -1
- package/.docs/models/providers/cerebras.md +1 -1
- package/.docs/models/providers/chutes.md +7 -4
- package/.docs/models/providers/cloudflare-ai-gateway.md +17 -119
- package/.docs/models/providers/fireworks-ai.md +2 -1
- package/.docs/models/providers/firmware.md +2 -7
- package/.docs/models/providers/huggingface.md +4 -1
- package/.docs/models/providers/kilo.md +333 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +71 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +8 -7
- package/.docs/models/providers/minimax-cn.md +8 -7
- package/.docs/models/providers/minimax-coding-plan.md +8 -7
- package/.docs/models/providers/minimax.md +8 -7
- package/.docs/models/providers/nano-gpt.md +5 -1
- package/.docs/models/providers/nebius.md +2 -2
- package/.docs/models/providers/novita-ai.md +2 -1
- package/.docs/models/providers/nvidia.md +3 -2
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/opencode.md +4 -1
- package/.docs/models/providers/poe.md +1 -1
- package/.docs/models/providers/siliconflow-cn.md +3 -8
- package/.docs/models/providers/siliconflow.md +4 -9
- package/.docs/models/providers/stepfun.md +73 -0
- package/.docs/models/providers/togetherai.md +7 -5
- package/.docs/models/providers/vivgrid.md +7 -4
- package/.docs/models/providers/zai-coding-plan.md +13 -12
- package/.docs/models/providers/zenmux.md +5 -2
- package/.docs/models/providers.md +3 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/configuration.md +3 -4
- package/.docs/reference/datasets/addItem.md +35 -0
- package/.docs/reference/datasets/addItems.md +33 -0
- package/.docs/reference/datasets/compareExperiments.md +48 -0
- package/.docs/reference/datasets/create.md +49 -0
- package/.docs/reference/datasets/dataset.md +78 -0
- package/.docs/reference/datasets/datasets-manager.md +84 -0
- package/.docs/reference/datasets/delete.md +23 -0
- package/.docs/reference/datasets/deleteExperiment.md +25 -0
- package/.docs/reference/datasets/deleteItem.md +25 -0
- package/.docs/reference/datasets/deleteItems.md +27 -0
- package/.docs/reference/datasets/get.md +29 -0
- package/.docs/reference/datasets/getDetails.md +45 -0
- package/.docs/reference/datasets/getExperiment.md +28 -0
- package/.docs/reference/datasets/getItem.md +31 -0
- package/.docs/reference/datasets/getItemHistory.md +29 -0
- package/.docs/reference/datasets/list.md +29 -0
- package/.docs/reference/datasets/listExperimentResults.md +37 -0
- package/.docs/reference/datasets/listExperiments.md +31 -0
- package/.docs/reference/datasets/listItems.md +44 -0
- package/.docs/reference/datasets/listVersions.md +31 -0
- package/.docs/reference/datasets/startExperiment.md +60 -0
- package/.docs/reference/datasets/startExperimentAsync.md +41 -0
- package/.docs/reference/datasets/update.md +46 -0
- package/.docs/reference/datasets/updateItem.md +36 -0
- package/.docs/reference/index.md +24 -0
- package/.docs/reference/memory/observational-memory.md +36 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +1 -1
- package/.docs/reference/processors/processor-interface.md +4 -0
- package/.docs/reference/server/koa-adapter.md +38 -0
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/workspace/e2b-sandbox.md +0 -11
- package/CHANGELOG.md +14 -0
- package/package.json +6 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# dataset.listVersions()
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.4.0`
|
|
4
|
+
|
|
5
|
+
Lists all versions of the dataset with pagination.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
|
|
12
|
+
const mastra = new Mastra({ /* storage config */ });
|
|
13
|
+
|
|
14
|
+
const dataset = await mastra.datasets.get({ id: "dataset-id" });
|
|
15
|
+
|
|
16
|
+
const { versions, pagination } = await dataset.listVersions({ page: 0, perPage: 10 });
|
|
17
|
+
|
|
18
|
+
for (const version of versions) {
|
|
19
|
+
console.log(`Version ${version.version} created at ${version.createdAt}`);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
|
|
25
|
+
**page?:** (`number`): Page number. Defaults to \`0\`.
|
|
26
|
+
|
|
27
|
+
**perPage?:** (`number`): Number of versions per page. Defaults to \`20\`.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
**result:** (`Promise<object>`): objectversions:DatasetVersion\[]Array of version records.DatasetVersionid:stringUnique identifier of the version record.datasetId:stringID of the parent dataset.version:numberVersion number.createdAt:DateWhen this version was created.pagination:objectPagination metadata.objecttotal:numberTotal number of versions.page:numberCurrent page number.perPage:number | falseVersions per page, or \`false\` if unpaginated.hasMore:booleanWhether more pages are available.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# dataset.startExperiment()
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.4.0`
|
|
4
|
+
|
|
5
|
+
Runs an experiment on the dataset and waits for completion. Executes all items against a target (agent, workflow, or scorer) with optional scoring.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
|
|
12
|
+
const mastra = new Mastra({ /* storage config */ });
|
|
13
|
+
|
|
14
|
+
const dataset = await mastra.datasets.get({ id: "dataset-id" });
|
|
15
|
+
|
|
16
|
+
// Run against a registered agent with scorers
|
|
17
|
+
const summary = await dataset.startExperiment({
|
|
18
|
+
targetType: "agent",
|
|
19
|
+
targetId: "my-agent",
|
|
20
|
+
scorers: ["accuracy", "relevancy"],
|
|
21
|
+
maxConcurrency: 10,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(`${summary.succeededCount}/${summary.totalItems} succeeded`);
|
|
25
|
+
console.log(`Status: ${summary.status}`);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Parameters
|
|
29
|
+
|
|
30
|
+
**targetType?:** (`'agent' | 'workflow' | 'scorer'`): Type of registered target to run items against. Use with \`targetId\`.
|
|
31
|
+
|
|
32
|
+
**targetId?:** (`string`): ID of the registered target. Use with \`targetType\`.
|
|
33
|
+
|
|
34
|
+
**scorers?:** (`(MastraScorer | string)[]`): Scorers to evaluate each result. Pass \`MastraScorer\` instances or registered scorer IDs.
|
|
35
|
+
|
|
36
|
+
**name?:** (`string`): Display name for the experiment.
|
|
37
|
+
|
|
38
|
+
**description?:** (`string`): Description of the experiment.
|
|
39
|
+
|
|
40
|
+
**metadata?:** (`Record<string, unknown>`): Arbitrary metadata for the experiment.
|
|
41
|
+
|
|
42
|
+
**version?:** (`number`): Pin to a specific dataset version. Defaults to the latest version.
|
|
43
|
+
|
|
44
|
+
**maxConcurrency?:** (`number`): Maximum concurrent item executions. Defaults to \`5\`.
|
|
45
|
+
|
|
46
|
+
**signal?:** (`AbortSignal`): AbortSignal for cancelling the experiment.
|
|
47
|
+
|
|
48
|
+
**itemTimeout?:** (`number`): Per-item execution timeout in milliseconds.
|
|
49
|
+
|
|
50
|
+
**maxRetries?:** (`number`): Maximum retries per item on failure. Defaults to \`0\` (no retries). Abort errors are never retried.
|
|
51
|
+
|
|
52
|
+
## Returns
|
|
53
|
+
|
|
54
|
+
**result:** (`Promise<ExperimentSummary>`): ExperimentSummaryexperimentId:stringUnique ID of the experiment.status:'pending' | 'running' | 'completed' | 'failed'Final status of the experiment.totalItems:numberTotal number of items in the dataset.succeededCount:numberNumber of items that succeeded.failedCount:numberNumber of items that failed.skippedCount:numberNumber of items skipped (e.g., due to abort).completedWithErrors:boolean\`true\` if the run completed but some items failed.startedAt:DateWhen the experiment started.completedAt:DateWhen the experiment completed.results:ItemWithScores\[]All item results with their scores.ItemWithScoresitemId:stringID of the dataset item.itemVersion:numberDataset version of the item when executed.input:unknownInput data passed to the target.output:unknown | nullOutput from the target, or \`null\` if failed.groundTruth:unknown | nullExpected output from the dataset item.error:{ message: string; stack?: string; code?: string } | nullStructured error if execution failed.startedAt:DateWhen item execution started.completedAt:DateWhen item execution completed.retryCount:numberNumber of retry attempts.scores:ScorerResult\[]Results from all scorers for this item.ScorerResultscorerId:stringID of the scorer.scorerName:stringDisplay name of the scorer.score:number | nullComputed score, or \`null\` if the scorer failed.reason:string | nullReason/explanation for the score.error:string | nullError message if the scorer failed.
|
|
55
|
+
|
|
56
|
+
## Related
|
|
57
|
+
|
|
58
|
+
- [dataset.startExperimentAsync()](https://mastra.ai/reference/datasets/startExperimentAsync)
|
|
59
|
+
- [dataset.listExperiments()](https://mastra.ai/reference/datasets/listExperiments)
|
|
60
|
+
- [DatasetsManager.compareExperiments()](https://mastra.ai/reference/datasets/compareExperiments)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# dataset.startExperimentAsync()
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.4.0`
|
|
4
|
+
|
|
5
|
+
Starts an experiment asynchronously (fire-and-forget). Returns immediately with the experiment ID and a `'pending'` status. The experiment runs in the background.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
|
|
12
|
+
const mastra = new Mastra({ /* storage config */ });
|
|
13
|
+
|
|
14
|
+
const dataset = await mastra.datasets.get({ id: "dataset-id" });
|
|
15
|
+
|
|
16
|
+
// Start experiment without waiting
|
|
17
|
+
const { experimentId, status } = await dataset.startExperimentAsync({
|
|
18
|
+
targetType: "agent",
|
|
19
|
+
targetId: "my-agent",
|
|
20
|
+
scorers: ["accuracy"],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
console.log(`Experiment ${experimentId} started with status: ${status}`);
|
|
24
|
+
|
|
25
|
+
// Check progress later
|
|
26
|
+
const experiment = await dataset.getExperiment({ experimentId });
|
|
27
|
+
console.log(`Current status: ${experiment.status}`);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Parameters
|
|
31
|
+
|
|
32
|
+
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment).
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
**result:** (`Promise<object>`): objectexperimentId:stringUnique ID of the created experiment.status:'pending'Always \`'pending'\` since the experiment hasn't started executing yet.
|
|
37
|
+
|
|
38
|
+
## Related
|
|
39
|
+
|
|
40
|
+
- [dataset.startExperiment()](https://mastra.ai/reference/datasets/startExperiment)
|
|
41
|
+
- [dataset.getExperiment()](https://mastra.ai/reference/datasets/getExperiment)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# dataset.update()
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.4.0`
|
|
4
|
+
|
|
5
|
+
Updates dataset metadata, name, description, and/or schemas. Zod schemas are automatically converted to JSON Schema.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
|
|
13
|
+
const mastra = new Mastra({ /* storage config */ });
|
|
14
|
+
|
|
15
|
+
const dataset = await mastra.datasets.get({ id: "dataset-id" });
|
|
16
|
+
|
|
17
|
+
// Update with plain metadata
|
|
18
|
+
const updated = await dataset.update({
|
|
19
|
+
name: "Updated QA pairs",
|
|
20
|
+
description: "Revised evaluation set",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Update with Zod schema (auto-converted to JSON Schema)
|
|
24
|
+
const updated2 = await dataset.update({
|
|
25
|
+
inputSchema: z.object({
|
|
26
|
+
question: z.string(),
|
|
27
|
+
context: z.string().optional(),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Parameters
|
|
33
|
+
|
|
34
|
+
**name?:** (`string`): New display name.
|
|
35
|
+
|
|
36
|
+
**description?:** (`string`): New description.
|
|
37
|
+
|
|
38
|
+
**metadata?:** (`Record<string, unknown>`): Updated metadata.
|
|
39
|
+
|
|
40
|
+
**inputSchema?:** (`unknown`): JSON Schema or Zod schema for item inputs.
|
|
41
|
+
|
|
42
|
+
**groundTruthSchema?:** (`unknown`): JSON Schema or Zod schema for item ground truths.
|
|
43
|
+
|
|
44
|
+
## Returns
|
|
45
|
+
|
|
46
|
+
**result:** (`Promise<DatasetRecord>`): The updated dataset record. See dataset.getDetails() for the full shape.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# dataset.updateItem()
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.4.0`
|
|
4
|
+
|
|
5
|
+
Updates an existing item in the dataset. Only the provided fields are updated. Updating an item creates a new version.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
|
|
12
|
+
const mastra = new Mastra({ /* storage config */ });
|
|
13
|
+
|
|
14
|
+
const dataset = await mastra.datasets.get({ id: "dataset-id" });
|
|
15
|
+
|
|
16
|
+
const updated = await dataset.updateItem({
|
|
17
|
+
itemId: "item-id",
|
|
18
|
+
input: { question: "What is TypeScript?" },
|
|
19
|
+
groundTruth: { answer: "A typed superset of JavaScript" },
|
|
20
|
+
metadata: { reviewed: true },
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
**itemId:** (`string`): ID of the item to update.
|
|
27
|
+
|
|
28
|
+
**input?:** (`unknown`): Updated input data.
|
|
29
|
+
|
|
30
|
+
**groundTruth?:** (`unknown`): Updated ground truth.
|
|
31
|
+
|
|
32
|
+
**metadata?:** (`Record<string, unknown>`): Updated metadata.
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
**result:** (`Promise<DatasetItem>`): The updated dataset item. See dataset.addItem() for the item shape.
|
package/.docs/reference/index.md
CHANGED
|
@@ -119,6 +119,30 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
119
119
|
- [Instances](https://mastra.ai/reference/observability/tracing/instances)
|
|
120
120
|
- [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
|
|
121
121
|
- [Spans](https://mastra.ai/reference/observability/tracing/spans)
|
|
122
|
+
- [Dataset Class](https://mastra.ai/reference/datasets/dataset)
|
|
123
|
+
- [DatasetsManager Class](https://mastra.ai/reference/datasets/datasets-manager)
|
|
124
|
+
- [.addItem()](https://mastra.ai/reference/datasets/addItem)
|
|
125
|
+
- [.addItems()](https://mastra.ai/reference/datasets/addItems)
|
|
126
|
+
- [.compareExperiments()](https://mastra.ai/reference/datasets/compareExperiments)
|
|
127
|
+
- [.create()](https://mastra.ai/reference/datasets/create)
|
|
128
|
+
- [.delete()](https://mastra.ai/reference/datasets/delete)
|
|
129
|
+
- [.deleteExperiment()](https://mastra.ai/reference/datasets/deleteExperiment)
|
|
130
|
+
- [.deleteItem()](https://mastra.ai/reference/datasets/deleteItem)
|
|
131
|
+
- [.deleteItems()](https://mastra.ai/reference/datasets/deleteItems)
|
|
132
|
+
- [.get()](https://mastra.ai/reference/datasets/get)
|
|
133
|
+
- [.getDetails()](https://mastra.ai/reference/datasets/getDetails)
|
|
134
|
+
- [.getExperiment()](https://mastra.ai/reference/datasets/getExperiment)
|
|
135
|
+
- [.getItem()](https://mastra.ai/reference/datasets/getItem)
|
|
136
|
+
- [.getItemHistory()](https://mastra.ai/reference/datasets/getItemHistory)
|
|
137
|
+
- [.list()](https://mastra.ai/reference/datasets/list)
|
|
138
|
+
- [.listExperiments()](https://mastra.ai/reference/datasets/listExperiments)
|
|
139
|
+
- [.listExperimentResults()](https://mastra.ai/reference/datasets/listExperimentResults)
|
|
140
|
+
- [.listItems()](https://mastra.ai/reference/datasets/listItems)
|
|
141
|
+
- [.listVersions()](https://mastra.ai/reference/datasets/listVersions)
|
|
142
|
+
- [.startExperiment()](https://mastra.ai/reference/datasets/startExperiment)
|
|
143
|
+
- [.startExperimentAsync()](https://mastra.ai/reference/datasets/startExperimentAsync)
|
|
144
|
+
- [.update()](https://mastra.ai/reference/datasets/update)
|
|
145
|
+
- [.updateItem()](https://mastra.ai/reference/datasets/updateItem)
|
|
122
146
|
- [BatchPartsProcessor](https://mastra.ai/reference/processors/batch-parts-processor)
|
|
123
147
|
- [LanguageDetector](https://mastra.ai/reference/processors/language-detector)
|
|
124
148
|
- [MessageHistory](https://mastra.ai/reference/processors/message-history-processor)
|
|
@@ -42,6 +42,8 @@ The `observationalMemory` option accepts `true`, a configuration object, or `fal
|
|
|
42
42
|
|
|
43
43
|
**model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Observer agent. Cannot be set if a top-level \`model\` is also provided. If neither this nor the top-level \`model\` is set, falls back to \`reflection.model\`.
|
|
44
44
|
|
|
45
|
+
**instruction?:** (`string`): Custom instruction appended to the Observer's system prompt. Use this to customize what the Observer focuses on, such as domain-specific preferences or priorities.
|
|
46
|
+
|
|
45
47
|
**messageTokens?:** (`number`): Token count of unobserved messages that triggers observation. When unobserved message tokens exceed this threshold, the Observer agent is called. (Default: `30000`)
|
|
46
48
|
|
|
47
49
|
**maxTokensPerBatch?:** (`number`): Maximum tokens per batch when observing multiple threads in resource scope. Threads are chunked into batches of this size and processed in parallel. Lower values mean more parallelism but more API calls. (Default: `10000`)
|
|
@@ -58,6 +60,8 @@ The `observationalMemory` option accepts `true`, a configuration object, or `fal
|
|
|
58
60
|
|
|
59
61
|
**model?:** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for the Reflector agent. Cannot be set if a top-level \`model\` is also provided. If neither this nor the top-level \`model\` is set, falls back to \`observation.model\`.
|
|
60
62
|
|
|
63
|
+
**instruction?:** (`string`): Custom instruction appended to the Reflector's system prompt. Use this to customize how the Reflector consolidates observations, such as prioritizing certain types of information.
|
|
64
|
+
|
|
61
65
|
**observationTokens?:** (`number`): Token count of observations that triggers reflection. When observation tokens exceed this threshold, the Reflector agent is called to condense them. (Default: `40000`)
|
|
62
66
|
|
|
63
67
|
**modelSettings?:** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent. (Default: `{ temperature: 0, maxOutputTokens: 100_000 }`)
|
|
@@ -175,6 +179,38 @@ export const agent = new Agent({
|
|
|
175
179
|
});
|
|
176
180
|
```
|
|
177
181
|
|
|
182
|
+
### Custom instructions
|
|
183
|
+
|
|
184
|
+
Customize what the Observer and Reflector focus on by providing custom instructions:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { Memory } from "@mastra/memory";
|
|
188
|
+
import { Agent } from "@mastra/core/agent";
|
|
189
|
+
|
|
190
|
+
export const agent = new Agent({
|
|
191
|
+
name: "health-assistant",
|
|
192
|
+
instructions: "You are a health and wellness assistant.",
|
|
193
|
+
model: "openai/gpt-5-mini",
|
|
194
|
+
memory: new Memory({
|
|
195
|
+
options: {
|
|
196
|
+
observationalMemory: {
|
|
197
|
+
model: "google/gemini-2.5-flash",
|
|
198
|
+
observation: {
|
|
199
|
+
// Focus observations on health-related preferences and goals
|
|
200
|
+
instruction:
|
|
201
|
+
"Prioritize capturing user health goals, dietary restrictions, exercise preferences, and medical considerations. Avoid capturing general chit-chat.",
|
|
202
|
+
},
|
|
203
|
+
reflection: {
|
|
204
|
+
// Guide reflection to consolidate health patterns
|
|
205
|
+
instruction:
|
|
206
|
+
"When consolidating, group related health information together. Preserve specific metrics, dates, and medical details.",
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
}),
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
178
214
|
### Async buffering
|
|
179
215
|
|
|
180
216
|
Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows — when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
|
|
@@ -38,7 +38,7 @@ Extends `BaseExporterConfig`, which includes:
|
|
|
38
38
|
|
|
39
39
|
The exporter reads these environment variables if not provided in config:
|
|
40
40
|
|
|
41
|
-
- `MASTRA_CLOUD_ACCESS_TOKEN` -
|
|
41
|
+
- `MASTRA_CLOUD_ACCESS_TOKEN` - Project-scoped access token for authentication (generate in your Mastra Cloud project under **Project Settings → Access Tokens**)
|
|
42
42
|
- `MASTRA_CLOUD_TRACES_ENDPOINT` - Custom endpoint (defaults to `https://api.mastra.ai/ai/spans/publish`)
|
|
43
43
|
|
|
44
44
|
## Properties
|
|
@@ -246,6 +246,8 @@ processOutputStream?(args: ProcessOutputStreamArgs): Promise<ChunkType | null |
|
|
|
246
246
|
|
|
247
247
|
**requestContext?:** (`RequestContext`): Request-scoped context with execution metadata.
|
|
248
248
|
|
|
249
|
+
**writer?:** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks back to the client. Call writer.custom() to emit data-\* typed chunks. Available during streaming.
|
|
250
|
+
|
|
249
251
|
#### Return value
|
|
250
252
|
|
|
251
253
|
- Return the `ChunkType` to emit it (possibly modified)
|
|
@@ -273,6 +275,8 @@ processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
|
273
275
|
|
|
274
276
|
**requestContext?:** (`RequestContext`): Request-scoped context with execution metadata.
|
|
275
277
|
|
|
278
|
+
**writer?:** (`ProcessorStreamWriter`): Stream writer for emitting custom data chunks back to the client. Call writer.custom() to emit data-\* typed chunks. Available during streaming.
|
|
279
|
+
|
|
276
280
|
***
|
|
277
281
|
|
|
278
282
|
### processOutputStep
|
|
@@ -74,6 +74,44 @@ app.listen(3000, () => {
|
|
|
74
74
|
|
|
75
75
|
**mcpOptions?:** (`MCPOptions`): MCP transport options. Set \`serverless: true\` for stateless environments like Cloudflare Workers or Vercel Edge.
|
|
76
76
|
|
|
77
|
+
## Error handling
|
|
78
|
+
|
|
79
|
+
The Koa adapter propagates errors from route handlers up through Koa's middleware chain, following Koa's standard error handling pattern. This means you can use regular Koa error-handling middleware:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const app = new Koa();
|
|
83
|
+
app.use(bodyParser());
|
|
84
|
+
|
|
85
|
+
// Your error middleware catches errors from Mastra route handlers
|
|
86
|
+
app.use(async (ctx, next) => {
|
|
87
|
+
try {
|
|
88
|
+
await next();
|
|
89
|
+
} catch (err) {
|
|
90
|
+
ctx.status = err.status || 500;
|
|
91
|
+
ctx.body = { error: err.message };
|
|
92
|
+
// Log, report to Sentry, etc.
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const server = new MastraServer({ app, mastra });
|
|
97
|
+
await server.init();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The [`server.onError`](https://mastra.ai/reference/configuration) hook is also supported. When configured, it is called before the error propagates to middleware, and its response is used directly:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const mastra = new Mastra({
|
|
104
|
+
server: {
|
|
105
|
+
onError: (err, c) => {
|
|
106
|
+
console.error('Unhandled error:', err);
|
|
107
|
+
return c.json({ error: err.message }, 500);
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
When `init()` is used, a global error-handling middleware is also registered as a safety net. Errors that reach this middleware are emitted via `ctx.app.emit('error', err, ctx)` following the standard Koa convention.
|
|
114
|
+
|
|
77
115
|
## Manual initialization
|
|
78
116
|
|
|
79
117
|
For custom middleware ordering, call each method separately instead of `init()`. See [manual initialization](https://mastra.ai/docs/server/server-adapters) for details.
|
|
@@ -20,7 +20,7 @@ const stream = await agent.stream("message for agent");
|
|
|
20
20
|
|
|
21
21
|
**maxSteps?:** (`number`): Maximum number of steps to run during execution.
|
|
22
22
|
|
|
23
|
-
**scorers?:** (`MastraScorers | Record<string, { scorer: MastraScorer['name']; sampling?: ScoringSamplingConfig }>`): scorer:stringName of the scorer to use.sampling?:ScoringSamplingConfigSampling configuration for the scorer.
|
|
23
|
+
**scorers?:** (`MastraScorers | Record<string, { scorer: MastraScorer['name']; sampling?: ScoringSamplingConfig }>`): scorer:stringName of the scorer to use.sampling?:ScoringSamplingConfigSampling configuration for the scorer.type:'none' | 'ratio'Type of sampling strategy. Use 'none' to disable sampling or 'ratio' for percentage-based sampling.rate?:numberSampling rate (0-1). Required when type is 'ratio'.
|
|
24
24
|
|
|
25
25
|
**tracingContext?:** (`TracingContext`): Tracing context for span hierarchy and metadata.
|
|
26
26
|
|
|
@@ -84,7 +84,7 @@ export const weatherTool = createTool({
|
|
|
84
84
|
|
|
85
85
|
**requestContextSchema?:** (`Zod schema`): A Zod schema for validating request context values. When provided, the context is validated before execute() runs, returning an error object if validation fails.
|
|
86
86
|
|
|
87
|
-
**execute:** (`function`): input:z.infer\<TInput>The validated input data based on inputSchemacontext?:ToolExecutionContextOptional execution context containing
|
|
87
|
+
**execute:** (`function`): input:z.infer\<TInput>The validated input data based on inputSchemacontext?:ToolExecutionContextOptional execution context containing metadataRequestContextTracingContextAbortSignalAgentToolExecutionContextWorkflowToolExecutionContextMCPToolExecutionContext
|
|
88
88
|
|
|
89
89
|
**onInputStart?:** (`function`): Optional callback invoked when the tool call input streaming begins. Receives \`toolCallId\`, \`messages\`, and \`abortSignal\`.
|
|
90
90
|
|
|
@@ -43,8 +43,6 @@ const agent = new Agent({
|
|
|
43
43
|
|
|
44
44
|
**env?:** (`Record<string, string>`): Environment variables to set in the sandbox
|
|
45
45
|
|
|
46
|
-
**runtimes?:** (`SandboxRuntime[]`): Supported runtimes (Default: `['node', 'python', 'bash']`)
|
|
47
|
-
|
|
48
46
|
**id?:** (`string`): Unique identifier for this sandbox instance (Default: `Auto-generated`)
|
|
49
47
|
|
|
50
48
|
**domain?:** (`string`): Domain for self-hosted E2B. Falls back to E2B\_DOMAIN env var.
|
|
@@ -146,15 +144,6 @@ Unmount a previously mounted filesystem.
|
|
|
146
144
|
await sandbox.unmount('/mnt/data');
|
|
147
145
|
```
|
|
148
146
|
|
|
149
|
-
### `getMounts()`
|
|
150
|
-
|
|
151
|
-
Get a list of currently mounted filesystems.
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
const mounts = await sandbox.getMounts();
|
|
155
|
-
// [{ path: '/mnt/data', filesystem: 's3' }]
|
|
156
|
-
```
|
|
157
|
-
|
|
158
147
|
### `getInfo()`
|
|
159
148
|
|
|
160
149
|
Get sandbox status and resource information.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.1.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`252580a`](https://github.com/mastra-ai/mastra/commit/252580a71feb0e46d0ccab04a70a79ff6a2ee0ab), [`f8e819f`](https://github.com/mastra-ai/mastra/commit/f8e819fabdfdc43d2da546a3ad81ba23685f603d), [`5c75261`](https://github.com/mastra-ai/mastra/commit/5c7526120d936757d4ffb7b82232e1641ebd45cb), [`e27d832`](https://github.com/mastra-ai/mastra/commit/e27d83281b5e166fd63a13969689e928d8605944), [`e37ef84`](https://github.com/mastra-ai/mastra/commit/e37ef8404043c94ca0c8e35ecdedb093b8087878), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`10cf521`](https://github.com/mastra-ai/mastra/commit/10cf52183344743a0d7babe24cd24fd78870c354), [`efdb682`](https://github.com/mastra-ai/mastra/commit/efdb682887f6522149769383908f9790c188ab88), [`0dee7a0`](https://github.com/mastra-ai/mastra/commit/0dee7a0ff4c2507e6eb6e6ee5f9738877ebd4ad1), [`04c2c8e`](https://github.com/mastra-ai/mastra/commit/04c2c8e888984364194131aecb490a3d6e920e61), [`02dc07a`](https://github.com/mastra-ai/mastra/commit/02dc07acc4ad42d93335825e3308f5b42266eba2), [`bb7262b`](https://github.com/mastra-ai/mastra/commit/bb7262b7c0ca76320d985b40510b6ffbbb936582), [`cf1c6e7`](https://github.com/mastra-ai/mastra/commit/cf1c6e789b131f55638fed52183a89d5078b4876), [`5ffadfe`](https://github.com/mastra-ai/mastra/commit/5ffadfefb1468ac2612b20bb84d24c39de6961c0), [`1e1339c`](https://github.com/mastra-ai/mastra/commit/1e1339cc276e571a48cfff5014487877086bfe68), [`d03df73`](https://github.com/mastra-ai/mastra/commit/d03df73f8fe9496064a33e1c3b74ba0479bf9ee6), [`79b8f45`](https://github.com/mastra-ai/mastra/commit/79b8f45a6767e1a5c3d56cd3c5b1214326b81661), [`9bbf08e`](https://github.com/mastra-ai/mastra/commit/9bbf08e3c20731c79dea13a765895b9fcf29cbf1), [`0a25952`](https://github.com/mastra-ai/mastra/commit/0a259526b5e1ac11e6efa53db1f140272962af2d), [`ffa5468`](https://github.com/mastra-ai/mastra/commit/ffa546857fc4821753979b3a34e13b4d76fbbcd4), [`3264a04`](https://github.com/mastra-ai/mastra/commit/3264a04e30340c3c5447433300a035ea0878df85), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`088d9ba`](https://github.com/mastra-ai/mastra/commit/088d9ba2577518703c52b0dccd617178d9ee6b0d), [`74fbebd`](https://github.com/mastra-ai/mastra/commit/74fbebd918a03832a2864965a8bea59bf617d3a2), [`aea6217`](https://github.com/mastra-ai/mastra/commit/aea621790bfb2291431b08da0cc5e6e150303ae7), [`b6a855e`](https://github.com/mastra-ai/mastra/commit/b6a855edc056e088279075506442ba1d6fa6def9), [`ae408ea`](https://github.com/mastra-ai/mastra/commit/ae408ea7128f0d2710b78d8623185198e7cb19c1), [`17e942e`](https://github.com/mastra-ai/mastra/commit/17e942eee2ba44985b1f807e6208cdde672f82f9), [`2015cf9`](https://github.com/mastra-ai/mastra/commit/2015cf921649f44c3f5bcd32a2c052335f8e49b4), [`7ef454e`](https://github.com/mastra-ai/mastra/commit/7ef454eaf9dcec6de60021c8f42192052dd490d6), [`2be1d99`](https://github.com/mastra-ai/mastra/commit/2be1d99564ce79acc4846071082bff353035a87a), [`2708fa1`](https://github.com/mastra-ai/mastra/commit/2708fa1055ac91c03e08b598869f6b8fb51fa37f), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ec53e89`](https://github.com/mastra-ai/mastra/commit/ec53e8939c76c638991e21af762e51378eff7543), [`9b5a8cb`](https://github.com/mastra-ai/mastra/commit/9b5a8cb13e120811b0bf14140ada314f1c067894), [`607e66b`](https://github.com/mastra-ai/mastra/commit/607e66b02dc7f531ee37799f3456aa2dc0ca7ac5), [`a215d06`](https://github.com/mastra-ai/mastra/commit/a215d06758dcf590eabfe0b7afd4ae39bdbf082c), [`6909c74`](https://github.com/mastra-ai/mastra/commit/6909c74a7781e0447d475e9dbc1dc871b700f426), [`192438f`](https://github.com/mastra-ai/mastra/commit/192438f8a90c4f375e955f8ff179bf8dc6821a83)]:
|
|
8
|
+
- @mastra/core@1.5.0-alpha.0
|
|
9
|
+
|
|
10
|
+
## 1.1.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b373564`](https://github.com/mastra-ai/mastra/commit/b37356491d43b4d53067f10cb669abaf2502f218), [`927c2af`](https://github.com/mastra-ai/mastra/commit/927c2af9792286c122e04409efce0f3c804f777f), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`877b02c`](https://github.com/mastra-ai/mastra/commit/877b02cdbb15e199184c7f2b8f217be8d3ebada7), [`7567222`](https://github.com/mastra-ai/mastra/commit/7567222b1366f0d39980594792dd9d5060bfe2ab), [`af71458`](https://github.com/mastra-ai/mastra/commit/af71458e3b566f09c11d0e5a0a836dc818e7a24a), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3cbf121`](https://github.com/mastra-ai/mastra/commit/3cbf121f55418141924754a83102aade89835947)]:
|
|
15
|
+
- @mastra/core@1.4.0
|
|
16
|
+
|
|
3
17
|
## 1.1.2-alpha.0
|
|
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.1.
|
|
3
|
+
"version": "1.1.3-alpha.0",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"jsdom": "^26.1.0",
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^3.25.76",
|
|
32
|
-
"@mastra/core": "1.
|
|
32
|
+
"@mastra/core": "1.5.0-alpha.0",
|
|
33
33
|
"@mastra/mcp": "^1.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@wong2/mcp-cli": "^1.13.0",
|
|
42
42
|
"cross-env": "^10.1.0",
|
|
43
43
|
"eslint": "^9.37.0",
|
|
44
|
-
"hono": "^4.11.
|
|
44
|
+
"hono": "^4.11.9",
|
|
45
45
|
"tsup": "^8.5.1",
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
48
|
"vitest": "4.0.16",
|
|
49
|
-
"@mastra/core": "1.
|
|
50
|
-
"@internal/lint": "0.0.
|
|
51
|
-
"@internal/types-builder": "0.0.
|
|
49
|
+
"@mastra/core": "1.5.0-alpha.0",
|
|
50
|
+
"@internal/lint": "0.0.59",
|
|
51
|
+
"@internal/types-builder": "0.0.34"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|