@mastra/mcp-docs-server 1.3.7-alpha.1 → 1.3.7-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.
- package/.docs/docs/agents/guardrails.md +2 -2
- package/.docs/docs/auth/fga.md +0 -1
- package/.docs/docs/deployment/workers.md +1 -1
- package/.docs/docs/evals/datasets.md +5 -6
- package/.docs/docs/evals/gates-and-verdicts.md +3 -3
- package/.docs/docs/mastra-platform/deploy.md +8 -1
- package/.docs/docs/mastra-platform/observability.md +25 -19
- package/.docs/docs/mastra-platform/system-environment-variables.md +1 -1
- package/.docs/docs/mastra-platform/trace-intelligence.md +1 -1
- package/.docs/docs/mastra-platform/workspaces.md +2 -2
- package/.docs/docs/memory/multi-user-threads.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +6 -0
- package/.docs/docs/sandbox/computer.md +13 -13
- package/.docs/docs/sandbox/overview.md +5 -5
- package/.docs/docs/server/custom-adapters.md +1 -1
- package/.docs/docs/server/server-adapters.md +1 -1
- package/.docs/docs/studio/auth.md +1 -1
- package/.docs/docs/workflows/control-flow.md +28 -0
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/integrations/databases/clickhouse.md +13 -0
- package/.docs/integrations/observability/langfuse.md +8 -0
- package/.docs/integrations/observability/opentelemetry.md +2 -0
- package/.docs/models/environment-variables.md +2 -1
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/netlify.md +5 -1
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/gateways/vercel.md +3 -10
- package/.docs/models/index.md +3 -2
- package/.docs/models/providers/aixy.md +14 -8
- package/.docs/models/providers/chutes.md +4 -4
- package/.docs/models/providers/cloudferro-sherlock.md +2 -2
- package/.docs/models/providers/edenai.md +10 -4
- package/.docs/models/providers/kenari.md +5 -1
- package/.docs/models/providers/kilo.md +10 -9
- package/.docs/models/providers/llmgateway-providers.md +7 -7
- package/.docs/models/providers/llmgateway.md +6 -5
- package/.docs/models/providers/lowrouter.md +16 -12
- package/.docs/models/providers/meta.md +3 -2
- package/.docs/models/providers/nano-gpt.md +21 -21
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +5 -5
- package/.docs/models/providers/prime.md +136 -0
- package/.docs/models/providers.md +2 -1
- package/.docs/reference/agent-controller/session.md +30 -8
- package/.docs/reference/auth/better-auth.md +1 -1
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/neon.md +2 -2
- package/.docs/reference/cli/mastra.md +15 -15
- package/.docs/reference/datasets/compareExperiments.md +18 -9
- package/.docs/reference/datasets/dataset.md +3 -1
- package/.docs/reference/datasets/finalizeExperiment.md +2 -2
- package/.docs/reference/datasets/listExperiments.md +2 -2
- package/.docs/reference/datasets/submitExperimentResult.md +1 -1
- package/.docs/reference/editor/tools.md +11 -3
- package/.docs/reference/evals/completeness.md +3 -3
- package/.docs/reference/evals/context-precision.md +1 -1
- package/.docs/reference/evals/create-scorer.md +3 -7
- package/.docs/reference/evals/faithfulness.md +6 -4
- package/.docs/reference/evals/filter-run.md +2 -2
- package/.docs/reference/evals/trajectory-accuracy.md +3 -2
- package/.docs/reference/index.md +0 -1
- package/.docs/reference/memory/listThreads.md +1 -1
- package/.docs/reference/migrations/mcp-v2.md +2 -2
- package/.docs/reference/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/reference/migrations/vnext-to-standard-apis.md +1 -1
- package/.docs/reference/observability/feedback.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +11 -1
- package/.docs/reference/observability/tracing/interfaces.md +26 -0
- package/.docs/reference/observability/tracing/spans.md +2 -0
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/prompt-injection-detector.md +2 -2
- package/.docs/reference/processors/provider-history-compat.md +12 -8
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/system-prompt-scrubber.md +3 -3
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- package/.docs/reference/rag/graph-rag.md +1 -1
- package/.docs/reference/server/create-route.md +1 -1
- package/.docs/reference/server/elysia-adapter.md +1 -1
- package/.docs/reference/server/express-adapter.md +1 -1
- package/.docs/reference/server/fastify-adapter.md +1 -1
- package/.docs/reference/server/hono-adapter.md +2 -2
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +1 -1
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/composite.md +34 -0
- package/.docs/reference/storage/overview.md +3 -3
- package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/streaming/workflows/timeTravelStream.md +6 -4
- package/.docs/reference/tools/document-chunker-tool.md +8 -8
- package/.docs/reference/tools/mcp-client.md +1 -1
- package/.docs/reference/tools/mcp-server.md +17 -0
- package/.docs/reference/tools/submit-plan-tool.md +2 -0
- package/.docs/reference/tools/vector-query-tool.md +4 -4
- package/.docs/reference/vectors/astra.md +1 -1
- package/.docs/reference/vectors/azure-ai-search.md +1 -0
- package/.docs/reference/vectors/chroma.md +9 -5
- package/.docs/reference/vectors/convex.md +1 -3
- package/.docs/reference/vectors/couchbase.md +4 -9
- package/.docs/reference/vectors/duckdb.md +1 -1
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +2 -1
- package/.docs/reference/vectors/pg.md +16 -11
- package/.docs/reference/vectors/pinecone.md +8 -4
- package/.docs/reference/vectors/qdrant.md +8 -4
- package/.docs/reference/vectors/s3vectors.md +8 -4
- package/.docs/reference/vectors/turbopuffer.md +12 -6
- package/.docs/reference/vectors/upstash.md +10 -4
- package/.docs/reference/vectors/vectorize.md +7 -3
- package/.docs/reference/vectors/weaviate.md +1 -1
- package/.docs/reference/voice/composite-voice.md +15 -15
- package/.docs/reference/voice/mastra-voice.md +15 -11
- package/.docs/reference/voice/voice.addInstructions.md +1 -1
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.answer.md +1 -1
- package/.docs/reference/voice/voice.close.md +1 -1
- package/.docs/reference/voice/voice.events.md +2 -2
- package/.docs/reference/voice/voice.listen.md +1 -1
- package/.docs/reference/voice/voice.off.md +1 -1
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workflows/dynamic-workflow-definition.md +3 -2
- package/.docs/reference/workflows/run-methods/cancel.md +1 -2
- package/.docs/reference/workflows/run-methods/resume.md +2 -0
- package/.docs/reference/workflows/run-methods/timeTravel.md +27 -0
- package/.docs/reference/workflows/run.md +14 -0
- package/.docs/reference/workflows/workflow-methods/agent.md +1 -1
- package/.docs/reference/workflows/workflow-methods/branch.md +4 -4
- package/.docs/reference/workflows/workflow-methods/classifier.md +1 -1
- package/.docs/reference/workflows/workflow-methods/create-run.md +2 -2
- package/.docs/reference/workflows/workflow-methods/dountil.md +1 -1
- package/.docs/reference/workflows/workflow-methods/dowhile.md +1 -1
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +1 -1
- package/.docs/reference/workspace/filesystem.md +10 -13
- package/.docs/reference/workspace/local-filesystem.md +5 -5
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/process-manager.md +2 -2
- package/.docs/reference/workspace/workspace-class.md +4 -4
- package/package.json +5 -5
- package/.docs/reference/agents/getTools.md +0 -31
|
@@ -60,7 +60,7 @@ const history = await dataset.getItemHistory({ itemId: 'item-id' })
|
|
|
60
60
|
|
|
61
61
|
## Access
|
|
62
62
|
|
|
63
|
-
`Dataset`
|
|
63
|
+
Obtain a `Dataset` through `DatasetsManager`, which resolves the dataset and applies tenancy scope:
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
const dataset = await mastra.datasets.get({ id: 'dataset-id' })
|
|
@@ -68,6 +68,8 @@ const dataset = await mastra.datasets.get({ id: 'dataset-id' })
|
|
|
68
68
|
const dataset = await mastra.datasets.create({ name: 'My dataset' })
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
`Dataset` also has a public constructor (`new Dataset(id, mastra)`) that skips the manager's lookup and tenancy scoping.
|
|
72
|
+
|
|
71
73
|
## Properties
|
|
72
74
|
|
|
73
75
|
For the full dataset record (name, description, schemas, version, timestamps), call [`dataset.getDetails()`](https://mastra.ai/reference/datasets/getDetails).
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**Added in:** `@mastra/core@1.61.0`
|
|
8
8
|
|
|
9
|
-
Finalizes a caller-driven experiment created with [`createExperiment()`](https://mastra.ai/reference/datasets/createExperiment), with or without a target. Mastra computes the final counts server-side from the persisted result rows and marks the experiment `'completed'`. The caller never tracks completion bookkeeping.
|
|
9
|
+
Finalizes a caller-driven experiment created with [`createExperiment()`](https://mastra.ai/reference/datasets/createExperiment), with or without a target. Mastra computes the final counts server-side from the persisted result rows and marks the experiment `'completed'`. An experiment that's already `'failed'` is returned unchanged and stays failed. The caller never tracks completion bookkeeping.
|
|
10
10
|
|
|
11
11
|
Counts are per item, so `succeededCount + failedCount + skippedCount === totalItems` even when items have multiple attempts:
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Counts are per item, so `succeededCount + failedCount + skippedCount === totalIt
|
|
|
16
16
|
|
|
17
17
|
Attempt-level detail remains available through [`listExperimentResults()`](https://mastra.ai/reference/datasets/listExperimentResults).
|
|
18
18
|
|
|
19
|
-
Finalization is idempotent: calling it on an already
|
|
19
|
+
Finalization is idempotent: calling it on an already completed or failed experiment returns the stored record without recomputing.
|
|
20
20
|
|
|
21
21
|
## Usage example
|
|
22
22
|
|
|
@@ -67,9 +67,9 @@ for (const exp of experiments) {
|
|
|
67
67
|
|
|
68
68
|
**result.experiments.datasetVersion** (`number | null`): Dataset version used for the experiment.
|
|
69
69
|
|
|
70
|
-
**result.experiments.targetType** (`'agent' | 'workflow' | 'scorer' | 'processor'`): Type of target used.
|
|
70
|
+
**result.experiments.targetType** (`'agent' | 'workflow' | 'scorer' | 'processor' | null`): Type of target used. null for caller-driven ingestion experiments.
|
|
71
71
|
|
|
72
|
-
**result.experiments.targetId** (`string`): ID of the target used.
|
|
72
|
+
**result.experiments.targetId** (`string | null`): ID of the target used. null for caller-driven ingestion experiments.
|
|
73
73
|
|
|
74
74
|
**result.experiments.status** (`'pending' | 'running' | 'completed' | 'failed'`): Current status of the experiment.
|
|
75
75
|
|
|
@@ -37,7 +37,7 @@ The item must be visible at the experiment's pinned dataset version. Submissions
|
|
|
37
37
|
|
|
38
38
|
**groundTruth** (`unknown`): Expected output. Defaults to the dataset item's ground truth at the pinned version.
|
|
39
39
|
|
|
40
|
-
**error** (`object`): Error details (message, optional stack and code) when the item failed.
|
|
40
|
+
**error** (`object | null`): Error details (message, optional stack and code) when the item failed.
|
|
41
41
|
|
|
42
42
|
**startedAt** (`Date`): When the worker started this item.
|
|
43
43
|
|
|
@@ -78,10 +78,18 @@ Stored HTTP definitions don't accept arbitrary headers. When the reserved `mastr
|
|
|
78
78
|
|
|
79
79
|
MCP tools can be allowlisted at two levels:
|
|
80
80
|
|
|
81
|
-
1. **Server level**: The stored server's `tools` map limits tools for every agent that uses the client.
|
|
82
|
-
2. **Agent level**: The agent's MCP client reference limits the remaining tools for that agent.
|
|
81
|
+
1. **Server level**: The stored server's `tools` map limits tools for every agent that uses the client. Omitting `tools` at this level exposes all of the server's tools.
|
|
82
|
+
2. **Agent level**: The agent's MCP client reference limits the remaining tools for that agent. Omitting `tools` at this level selects no tools.
|
|
83
83
|
|
|
84
|
-
Agent-level tool names can use namespaced or bare names.
|
|
84
|
+
Agent-level tool names can use namespaced or bare names. To select every remaining tool at the agent level, pass an explicit empty `tools` map:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const mcpClients = {
|
|
88
|
+
'docs-client': { tools: {} }, // all tools
|
|
89
|
+
'search-client': { tools: { docs_search: {} } }, // only docs_search
|
|
90
|
+
'billing-client': {}, // no tools
|
|
91
|
+
}
|
|
92
|
+
```
|
|
85
93
|
|
|
86
94
|
### Namespacing
|
|
87
95
|
|
|
@@ -25,7 +25,7 @@ The `.run()` method returns a result in the following shape:
|
|
|
25
25
|
```typescript
|
|
26
26
|
{
|
|
27
27
|
runId: string,
|
|
28
|
-
|
|
28
|
+
preprocessStepResult: {
|
|
29
29
|
inputElements: string[],
|
|
30
30
|
outputElements: string[],
|
|
31
31
|
missingElements: string[],
|
|
@@ -52,9 +52,9 @@ The extraction process includes:
|
|
|
52
52
|
- Special handling of short words (3 characters or less)
|
|
53
53
|
- Deduplication of elements
|
|
54
54
|
|
|
55
|
-
### `
|
|
55
|
+
### `preprocessStepResult`
|
|
56
56
|
|
|
57
|
-
From the `.run()` method, you can get the `
|
|
57
|
+
From the `.run()` method, you can get the `preprocessStepResult` object with the following properties:
|
|
58
58
|
|
|
59
59
|
- **inputElements**: Key elements found in the input (e.g., nouns, verbs, topics, terms).
|
|
60
60
|
- **outputElements**: Key elements found in the output.
|
|
@@ -34,7 +34,7 @@ Either `context` or `contextExtractor` must be provided. If both are provided, `
|
|
|
34
34
|
|
|
35
35
|
## `.run()` returns
|
|
36
36
|
|
|
37
|
-
**score** (`number`): Mean Average Precision score between 0 and scale (default 0-1)
|
|
37
|
+
**score** (`number`): Mean Average Precision score between 0 and scale (default 0-1). Assumes a positive scale.
|
|
38
38
|
|
|
39
39
|
**reason** (`string`): Human-readable explanation of the context precision evaluation
|
|
40
40
|
|
|
@@ -10,7 +10,7 @@ Mastra provides a unified `createScorer` factory that allows you to define custo
|
|
|
10
10
|
|
|
11
11
|
Use the `createScorer` factory to define your scorer with a name, description, and optional judge configuration. Then chain step methods to build your evaluation pipeline. You must provide at least a `generateScore` step.
|
|
12
12
|
|
|
13
|
-
**Prompt object steps** are step configurations expressed as objects with `description` + `createPrompt` (and `outputSchema` for `preprocess`/`analyze`). These steps invoke the judge LLM. **Function steps** are plain functions and never call the judge.
|
|
13
|
+
**Prompt object steps** are step configurations expressed as objects with `description` + `createPrompt` (and `outputSchema` for `preprocess`/`analyze`, but not for `generateScore`). These steps invoke the judge LLM. **Function steps** are plain functions and never call the judge.
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { createScorer } from '@mastra/core/evals'
|
|
@@ -65,7 +65,7 @@ This function returns a scorer builder that you can chain step methods onto. See
|
|
|
65
65
|
|
|
66
66
|
The judge only runs for steps defined as **prompt objects** (`preprocess`, `analyze`, `generateScore`, `generateReason` in prompt mode). If you use function steps only, the judge is never called and there is no LLM output to inspect. In that case, any score/reason must be produced by your functions.
|
|
67
67
|
|
|
68
|
-
When a prompt-object step runs, its structured LLM output is stored in the corresponding result field (`preprocessStepResult
|
|
68
|
+
When a prompt-object step runs, its structured LLM output is stored in the corresponding result field (`preprocessStepResult` or `analyzeStepResult`). For `generateScore`, the judge returns `{ score: number }` and `score` becomes the scorer's score.
|
|
69
69
|
|
|
70
70
|
## Retry judge requests
|
|
71
71
|
|
|
@@ -289,15 +289,11 @@ The method must return a numerical score.
|
|
|
289
289
|
|
|
290
290
|
**description** (`string`): Description of what this scoring step does.
|
|
291
291
|
|
|
292
|
-
**outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for the expected output of the generateScore step.
|
|
293
|
-
|
|
294
292
|
**createPrompt** (`function`): Function: ({ run, results }) => string. Returns the prompt for the LLM.
|
|
295
293
|
|
|
296
294
|
**judge** (`object`): (Optional) LLM judge for this step (can override main judge). See Judge Object section.
|
|
297
295
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
**calculateScore** (`function`): Function: ({ run, results, analyzeStepResult }) => number. Converts the LLM's structured output into a numerical score.
|
|
296
|
+
In prompt object mode, don't set `outputSchema`. Mastra asks the judge for structured output of the form `{ score: number }` and uses `score` as the step result.
|
|
301
297
|
|
|
302
298
|
### `generateReason`
|
|
303
299
|
|
|
@@ -12,9 +12,11 @@ The `createFaithfulnessScorer()` function accepts a single options object with t
|
|
|
12
12
|
|
|
13
13
|
**model** (`LanguageModel`): Configuration for the model used to evaluate faithfulness.
|
|
14
14
|
|
|
15
|
-
**
|
|
15
|
+
**options** (`{ context?: string[]; scale?: number }`): Configuration options for the scorer.
|
|
16
16
|
|
|
17
|
-
**
|
|
17
|
+
**options.context** (`string[]`): Array of context chunks against which the output's claims will be verified. When omitted, the scorer uses the results of tool calls in the run output.
|
|
18
|
+
|
|
19
|
+
**options.scale** (`number`): The maximum score value. The final score will be normalized to this scale.
|
|
18
20
|
|
|
19
21
|
This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but the return value includes LLM-specific fields as documented below.
|
|
20
22
|
|
|
@@ -22,7 +24,7 @@ This function returns an instance of the MastraScorer class. The `.run()` method
|
|
|
22
24
|
|
|
23
25
|
**runId** (`string`): The id of the run (optional).
|
|
24
26
|
|
|
25
|
-
**preprocessStepResult** (`
|
|
27
|
+
**preprocessStepResult** (`object`): Object with the claims extracted from the output: { claims: string\[] }
|
|
26
28
|
|
|
27
29
|
**preprocessPrompt** (`string`): The prompt sent to the LLM for the preprocess step (optional).
|
|
28
30
|
|
|
@@ -64,7 +66,7 @@ Final score: `(supported_claims / total_claims) * scale`
|
|
|
64
66
|
|
|
65
67
|
### Score interpretation
|
|
66
68
|
|
|
67
|
-
A faithfulness score between 0 and 1:
|
|
69
|
+
A faithfulness score between 0 and the configured scale (default 1). With the default scale:
|
|
68
70
|
|
|
69
71
|
- **1.0**: All claims are accurate and directly supported by the context.
|
|
70
72
|
- **0.7 to 0.9**: Most claims are correct, with minor additions or omissions.
|
|
@@ -115,7 +115,7 @@ The `partTypes` option accepts `MastraPartType` values. Each value is prefix-mat
|
|
|
115
115
|
## Filtering behavior
|
|
116
116
|
|
|
117
117
|
- **Part type filtering** applies to both `input.rememberedMessages` and `output` when they contain agent message arrays.
|
|
118
|
-
- **Tool name filtering** only affects messages that contain tool invocations.
|
|
118
|
+
- **Tool name filtering** only affects messages that contain tool invocations. Messages without tool invocations are filtered by `partTypes` only, and pass through when `partTypes` isn't set.
|
|
119
119
|
- **System messages** (`systemMessages`, `taggedSystemMessages`) are never filtered, regardless of `partTypes` or `toolNames`.
|
|
120
120
|
- **Message limits** (`maxRememberedMessages`, `maxOutputMessages`) apply after type and tool filtering, taking the most recent messages.
|
|
121
|
-
- When both `partTypes` and `toolNames` are set, a message must satisfy both filters to be kept.
|
|
121
|
+
- When both `partTypes` and `toolNames` are set, a message with tool invocations must satisfy both filters to be kept.
|
|
@@ -93,13 +93,14 @@ The discriminated union includes these additional step types:
|
|
|
93
93
|
| Step type | Key properties |
|
|
94
94
|
| ---------------------- | ------------------------------------------------------------- |
|
|
95
95
|
| `mcp_tool_call` | `toolArgs`, `toolResult`, `mcpServer`, `success` |
|
|
96
|
+
| `provider_tool_call` | `toolArgs`, `toolResult`, `success` |
|
|
96
97
|
| `model_generation` | `modelId`, `promptTokens`, `completionTokens`, `finishReason` |
|
|
97
98
|
| `agent_run` | `agentId` |
|
|
98
99
|
| `workflow_run` | `workflowId`, `status` |
|
|
99
100
|
| `workflow_conditional` | `conditionCount`, `selectedSteps` |
|
|
100
101
|
| `workflow_parallel` | `branchCount`, `parallelSteps` |
|
|
101
102
|
| `workflow_loop` | `loopType`, `totalIterations` |
|
|
102
|
-
| `workflow_sleep` | `
|
|
103
|
+
| `workflow_sleep` | `sleepDurationMs`, `sleepType` |
|
|
103
104
|
| `workflow_wait_event` | `eventName`, `eventReceived` |
|
|
104
105
|
| `processor_run` | `processorId` |
|
|
105
106
|
|
|
@@ -261,7 +262,7 @@ Only checks that each expected step is present. Order is ignored, and extra step
|
|
|
261
262
|
|
|
262
263
|
## Code-based scoring details
|
|
263
264
|
|
|
264
|
-
- **Continuous scores**: Returns values between 0.0 and 1.0 in
|
|
265
|
+
- **Continuous scores**: Returns values between 0.0 and 1.0 in every ordering mode. In strict mode, the score is the share of expected steps matched in order, minus penalties for extra steps and, when `allowRepeatedSteps` is `false`, repeated steps
|
|
265
266
|
- **Deterministic**: Same input always produces the same output
|
|
266
267
|
- **Fast**: No external API calls
|
|
267
268
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -27,7 +27,6 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
27
27
|
- [.getMetadata()](https://mastra.ai/reference/agents/getMetadata)
|
|
28
28
|
- [.getModel()](https://mastra.ai/reference/agents/getModel)
|
|
29
29
|
- [.getSkill()](https://mastra.ai/reference/agents/getSkill)
|
|
30
|
-
- [.getTools()](https://mastra.ai/reference/agents/getTools)
|
|
31
30
|
- [.getVoice()](https://mastra.ai/reference/agents/getVoice)
|
|
32
31
|
- [.listAgents()](https://mastra.ai/reference/agents/listAgents)
|
|
33
32
|
- [.listScorers()](https://mastra.ai/reference/agents/listScorers)
|
|
@@ -69,7 +69,7 @@ const result = await memory.listThreads({
|
|
|
69
69
|
|
|
70
70
|
**page** (`number`): Page number (0-indexed) to retrieve
|
|
71
71
|
|
|
72
|
-
**perPage** (`number | false`): Maximum number of threads to return per page, or false to fetch all
|
|
72
|
+
**perPage** (`number | false`): Maximum number of threads to return per page, or false to fetch all (Default: `100`)
|
|
73
73
|
|
|
74
74
|
**orderBy** (`{ field: 'createdAt' | 'updatedAt', direction: 'ASC' | 'DESC' }`): Sort configuration with field and direction (defaults to { field: 'createdAt', direction: 'DESC' })
|
|
75
75
|
|
|
@@ -16,12 +16,12 @@ Streamable HTTP still streams responses as Server-Sent Events. What's removed is
|
|
|
16
16
|
|
|
17
17
|
### `@mastra/core` peer range
|
|
18
18
|
|
|
19
|
-
`@mastra/mcp` 2.0 requires `@mastra/core` 1.
|
|
19
|
+
`@mastra/mcp` 2.0 requires `@mastra/core` 1.76 or a later 1.x release, which includes the shared server contract (`mcpVersion`, `MCPToolExecutionResultV2`, `context.mcp.protocolVersion`). Update both packages together.
|
|
20
20
|
|
|
21
21
|
```diff
|
|
22
22
|
- "@mastra/core": "^1.60.0",
|
|
23
23
|
- "@mastra/mcp": "^1.17.0"
|
|
24
|
-
+ "@mastra/core": "^1.
|
|
24
|
+
+ "@mastra/core": "^1.76.0",
|
|
25
25
|
+ "@mastra/mcp": "^2.0.0"
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -81,7 +81,7 @@ To migrate, replace property access with the corresponding getter methods.
|
|
|
81
81
|
- const tools = agent.tools;
|
|
82
82
|
- const instructions = agent.instructions;
|
|
83
83
|
+ const llm = agent.getLLM();
|
|
84
|
-
+ const tools = agent.
|
|
84
|
+
+ const tools = await agent.listTools();
|
|
85
85
|
+ const instructions = agent.getInstructions();
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -153,7 +153,7 @@ The following options are available in the standard `.stream()` and `generate()`
|
|
|
153
153
|
- `errorStrategy` - Determines what happens when the output doesn’t match the schema:
|
|
154
154
|
|
|
155
155
|
- 'warn' - log a warning
|
|
156
|
-
- '
|
|
156
|
+
- 'strict' - throw an error
|
|
157
157
|
- 'fallback' - return a fallback value you provide
|
|
158
158
|
|
|
159
159
|
```typescript
|
|
@@ -345,7 +345,7 @@ Use `FeedbackInput` with `mastra.observability.addFeedback()`, `recordedTrace.ad
|
|
|
345
345
|
|
|
346
346
|
**metadata** (`Record<string, unknown>`): Additional feedback-specific metadata.
|
|
347
347
|
|
|
348
|
-
**experimentId** (`string`):
|
|
348
|
+
**experimentId** (`string`): Deprecated. The experiment is derived from the target trace or span. Read correlationContext.experimentId on the exported event instead.
|
|
349
349
|
|
|
350
350
|
**sourceId** (`string`): ID of the source record this feedback is linked to.
|
|
351
351
|
|
|
@@ -66,10 +66,20 @@ The detailed breakdown metrics (everything except `total_input` and `total_outpu
|
|
|
66
66
|
|
|
67
67
|
### When cost context is attached
|
|
68
68
|
|
|
69
|
-
Cost context is attached to token metrics when the provider reports a valid cost for every completed model step or when the
|
|
69
|
+
Cost context is attached to token metrics when the provider reports a valid cost for every completed model step or when the pricing registry has a matching entry for the provider and model. Mastra sums the per-step provider costs into one query total. If any completed step lacks a valid reported cost, Mastra uses the pricing registry instead of reporting a partial total. If neither source is available, token metrics are still emitted without cost fields.
|
|
70
70
|
|
|
71
71
|
A caller-supplied `costContext` takes precedence over provider-reported costs and pricing registry estimates. Provider-reported totals use `costMetadata.source: 'provider_reported'`, `costMetadata.scope: 'query_total'`, and `costMetadata.reportedStepCount` to identify the source, scope, and number of completed steps included in the total.
|
|
72
72
|
|
|
73
|
+
### Where prices come from
|
|
74
|
+
|
|
75
|
+
The pricing registry uses model prices from [models.dev](https://models.dev). `@mastra/observability` includes a snapshot of these prices, and each new release of the package includes recent prices. Stored cost estimates aren't recalculated when prices change.
|
|
76
|
+
|
|
77
|
+
When you run `mastra dev`, Mastra also refreshes prices from models.dev in the background once a day, and when a model has no price. Cost estimates don't wait for a refresh, so the first call to a newly released model can still have no cost. In other environments, such as production, you can turn on the refresh with `MASTRA_AUTO_REFRESH_PRICING=true`.
|
|
78
|
+
|
|
79
|
+
Refreshed prices are cached in `~/.cache/mastra/pricing-data.json` and reused by later processes. If a refresh fails, Mastra keeps the prices it already has.
|
|
80
|
+
|
|
81
|
+
To use only the bundled snapshot, set `MASTRA_AUTO_REFRESH_PRICING=false`. Setting `MASTRA_OFFLINE=true` also turns off the refresh.
|
|
82
|
+
|
|
73
83
|
### What cost fields may be included
|
|
74
84
|
|
|
75
85
|
| Field | Description |
|
|
@@ -216,6 +216,9 @@ interface Span<TType extends SpanType> {
|
|
|
216
216
|
/** Tags for categorizing traces (only present on root spans) */
|
|
217
217
|
tags?: string[]
|
|
218
218
|
|
|
219
|
+
/** Spans in other traces this span is related to */
|
|
220
|
+
links?: SpanLink[]
|
|
221
|
+
|
|
219
222
|
/** End the span */
|
|
220
223
|
end(options?: EndSpanOptions<TType>): void
|
|
221
224
|
|
|
@@ -778,6 +781,12 @@ interface MCPServerRequestAttributes {
|
|
|
778
781
|
|
|
779
782
|
/** Client implementation version, when the client reported one */
|
|
780
783
|
clientVersion?: string
|
|
784
|
+
|
|
785
|
+
/** W3C `traceparent` the caller sent, when it parses */
|
|
786
|
+
callerTraceparent?: string
|
|
787
|
+
|
|
788
|
+
/** W3C `tracestate` the caller sent with a valid `traceparent`, capped at 512 characters */
|
|
789
|
+
callerTracestate?: string
|
|
781
790
|
}
|
|
782
791
|
```
|
|
783
792
|
|
|
@@ -998,6 +1007,23 @@ interface StartSpanOptions<TType extends SpanType> {
|
|
|
998
1007
|
|
|
999
1008
|
/** Options passed when using a custom sampler strategy */
|
|
1000
1009
|
customSamplerOptions?: CustomSamplerOptions
|
|
1010
|
+
|
|
1011
|
+
/** Spans in other traces this span is related to. Links with invalid IDs are ignored. */
|
|
1012
|
+
links?: SpanLink[]
|
|
1013
|
+
}
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
### `SpanLink`
|
|
1017
|
+
|
|
1018
|
+
A reference to a span in another trace, such as the caller's span when an `MCPServer` serves a request. Unlike a parent, a link doesn't put the two spans in the same trace.
|
|
1019
|
+
|
|
1020
|
+
```typescript
|
|
1021
|
+
interface SpanLink {
|
|
1022
|
+
/** Trace ID of the linked span (1-32 hexadecimal characters) */
|
|
1023
|
+
traceId: string
|
|
1024
|
+
|
|
1025
|
+
/** Span ID of the linked span (1-16 hexadecimal characters) */
|
|
1026
|
+
spanId: string
|
|
1001
1027
|
}
|
|
1002
1028
|
```
|
|
1003
1029
|
|
|
@@ -207,6 +207,8 @@ When tracing is disabled (sampling returns false), NO-OP spans are returned:
|
|
|
207
207
|
class NoOpSpan<TType extends SpanType> extends BaseSpan<TType>
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
+
`NoOpSpan` is exported from `@mastra/observability`. It extends that package's abstract `BaseSpan` class, which implements the `Span` interface. That class is different from the `BaseSpan` interface described on this page.
|
|
211
|
+
|
|
210
212
|
A span that performs no operations. All methods are no-ops:
|
|
211
213
|
|
|
212
214
|
- `id` returns `'no-op'`
|
|
@@ -48,7 +48,7 @@ const processor = new ModerationProcessor({
|
|
|
48
48
|
|
|
49
49
|
**id** (`string`): Processor identifier set to 'moderation'
|
|
50
50
|
|
|
51
|
-
**name** (`string`):
|
|
51
|
+
**name** (`string`): Processor display name, always 'Moderation'
|
|
52
52
|
|
|
53
53
|
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes input messages to moderate content before sending to LLM
|
|
54
54
|
|
|
@@ -48,9 +48,9 @@ const processor = new PromptInjectionDetector({
|
|
|
48
48
|
|
|
49
49
|
**id** (`string`): Processor identifier set to 'prompt-injection-detector'
|
|
50
50
|
|
|
51
|
-
**name** (`string`):
|
|
51
|
+
**name** (`string`): Processor display name, always 'Prompt Injection Detector'
|
|
52
52
|
|
|
53
|
-
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes input messages to detect prompt injection attempts before sending to LLM
|
|
53
|
+
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; requestContext?: RequestContext; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes input messages to detect prompt injection attempts before sending to LLM
|
|
54
54
|
|
|
55
55
|
## Extended usage example
|
|
56
56
|
|
|
@@ -54,14 +54,18 @@ Registering in `errorProcessors` alone, as the example above does, covers both h
|
|
|
54
54
|
|
|
55
55
|
`ProviderHistoryCompat` includes these built-in compatibility rules:
|
|
56
56
|
|
|
57
|
-
| Rule
|
|
58
|
-
|
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `anthropic-strip-
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
57
|
+
| Rule | Provider | Timing | Behavior |
|
|
58
|
+
| ------------------------------------------------ | ---------------------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| `strip-foreign-provider-executed-tools` | Anthropic, OpenAI, Azure OpenAI, Google/Vertex | Preemptive prompt rewrite | Removes provider-executed tool calls and their paired results from the outbound prompt when they came from a different provider family, since the receiving provider can't resolve another provider's tool IDs. Persisted history is left untouched. |
|
|
60
|
+
| `anthropic-tool-id-format` | Anthropic | Preemptive prompt rewrite | Rewrites tool call IDs that contain characters outside `[a-zA-Z0-9_-]` in the outbound prompt, on both the call and its result. A sanitized ID that would collide with one already in the prompt gets a `_2`, `_3`, … suffix. The provider's rejection never fires, and persisted history keeps the original IDs. A reactive fallback covers providers the preemptive check doesn't recognize, such as Vertex-hosted Claude. |
|
|
61
|
+
| `cerebras-strip-reasoning-content` | Cerebras | Preemptive prompt rewrite | Removes assistant `reasoning` parts from the outbound prompt so they're not serialized as unsupported `reasoning_content` fields. |
|
|
62
|
+
| `anthropic-strip-empty-signed-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes assistant `reasoning` parts that carry an Anthropic signature but have empty text, which legacy records can contain. Anthropic signs the exact thinking text, so the mismatched pair would be rejected. |
|
|
63
|
+
| `anthropic-strip-foreign-reasoning-content` | Anthropic | Preemptive prompt rewrite | Removes non-Anthropic assistant `reasoning` parts from the outbound prompt. Anthropic-native thinking history is preserved. |
|
|
64
|
+
| `anthropic-strip-foreign-signed-reasoning` | Anthropic-compatible | Preemptive prompt rewrite | Drops signed thinking from the outbound prompt when its origin turn was stamped with a different provider (for example Kimi For Coding ↔ `anthropic/claude-sonnet-4-6`), since the receiving provider can't verify another provider's signature. Turns emptied of all content by the drop are removed from the prompt. Unstamped history is left untouched. |
|
|
65
|
+
| `azure-system-reminder-transform` | Azure OpenAI | Preemptive prompt rewrite | Renames `<system-reminder>` wrappers in user text and system instructions to `<memory-context>` for the outbound request. Stored history remains unchanged. |
|
|
66
|
+
| `openai-orphan-item-id` | OpenAI, Azure OpenAI (Responses) | Reactive API error recovery | Recovers history that OpenAI rejects with `Item 'msg_…' of type 'message' was provided without its required 'reasoning' item`. Drops the Responses `itemId` from every item-bearing part of an assistant message that carries one but has no `reasoning` part, and retries. The message then replays by value instead of as an unsatisfiable `item_reference`. The repair is applied to the in-memory list for the current turn. |
|
|
67
|
+
| `anthropic-orphaned-thinking-step` | Anthropic | Reactive API error recovery | Recovers history that Anthropic rejects because `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. Removes steps that contain only reasoning when more assistant content follows them, and retries. Covers history saved by older `@mastra/memory` releases ([#22798](https://github.com/mastra-ai/mastra/issues/22798)). |
|
|
68
|
+
| `ensure-user-first-turn` | Amazon Bedrock, Google/Vertex Gemini | Preemptive prompt rewrite | Inserts a minimal user turn (`.`) before a leading assistant turn, because these providers reject conversations whose first non-system turn is the assistant's. This happens when an agent greets first or `lastMessages` cuts into a thread. Runs last, so it sees the prompt after other rules have dropped emptied turns. |
|
|
65
69
|
|
|
66
70
|
Preemptive rules run through `processLLMRequest` after Mastra converts messages to the model prompt format and before the prompt is sent to the provider. These rewrites affect only the current provider call. Persisted history is never changed, so the IDs and content in memory and in the Studio stay exactly as written.
|
|
67
71
|
|
|
@@ -108,7 +108,7 @@ const agent = new Agent({
|
|
|
108
108
|
|
|
109
109
|
**name** (`'Regex Filter'`): Processor display name.
|
|
110
110
|
|
|
111
|
-
**processInput** (`(args: ProcessInputArgs) => ProcessInputResult
|
|
111
|
+
**processInput** (`(args: ProcessInputArgs) => ProcessInputResult | Promise<ProcessInputResult>`): Checks input messages against all configured rules. Blocks, redacts, or warns depending on strategy. Skipped when phase is output. Returns a promise when redaction reporting is pending.
|
|
112
112
|
|
|
113
113
|
**processOutputStream** (`(args: ProcessOutputStreamArgs) => Promise<ChunkType | null | undefined>`): Checks streaming text-delta chunks against all configured rules. Skipped when phase is input.
|
|
114
114
|
|
|
@@ -46,11 +46,11 @@ const processor = new SystemPromptScrubber({
|
|
|
46
46
|
|
|
47
47
|
**id** (`string`): Processor identifier set to 'system-prompt-scrubber'
|
|
48
48
|
|
|
49
|
-
**name** (`string`):
|
|
49
|
+
**name** (`string`): Processor display name, always 'System Prompt Scrubber'
|
|
50
50
|
|
|
51
|
-
**processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never; tracingContext?: TracingContext }) => Promise<ChunkType | null>`): Processes streaming output parts to detect and handle system prompts during streaming
|
|
51
|
+
**processOutputStream** (`(args: { part: ChunkType; streamParts: ChunkType[]; state: Record<string, any>; abort: (reason?: string) => never; requestContext?: RequestContext; tracingContext?: TracingContext }) => Promise<ChunkType | null>`): Processes streaming output parts to detect and handle system prompts during streaming
|
|
52
52
|
|
|
53
|
-
**processOutputResult** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Processes final output results to detect and handle system prompts in non-streaming scenarios
|
|
53
|
+
**processOutputResult** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never; requestContext?: RequestContext; tracingContext?: TracingContext }) => Promise<MastraDBMessage[]>`): Processes final output results to detect and handle system prompts in non-streaming scenarios
|
|
54
54
|
|
|
55
55
|
## Extended usage example
|
|
56
56
|
|
|
@@ -28,7 +28,7 @@ const processor = new TokenLimiterProcessor({
|
|
|
28
28
|
|
|
29
29
|
**options.limit** (`number`): Maximum number of tokens to allow in the response
|
|
30
30
|
|
|
31
|
-
**options.encoding** (`
|
|
31
|
+
**options.encoding** (`unknown`): Deprecated. Accepted for backwards compatibility but ignored. Token counts are estimated with tokenx, so no encoder is needed.
|
|
32
32
|
|
|
33
33
|
**options.strategy** (`'truncate' | 'abort'`): Strategy when token limit is reached: 'truncate' stops emitting chunks, 'abort' calls abort() to stop the stream
|
|
34
34
|
|
|
@@ -40,7 +40,7 @@ const processor = new TokenLimiterProcessor({
|
|
|
40
40
|
|
|
41
41
|
**id** (`string`): Processor identifier set to 'token-limiter'
|
|
42
42
|
|
|
43
|
-
**name** (`string`):
|
|
43
|
+
**name** (`string`): Processor display name set to 'Token Limiter'
|
|
44
44
|
|
|
45
45
|
**processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Trims stored history to fit within the token limit before the agentic loop starts in 'memory-only' trim mode, prioritizing recent messages while preserving system messages and the current turn
|
|
46
46
|
|
|
@@ -83,7 +83,7 @@ Returns an array of `RankedNode` objects, where each node contains:
|
|
|
83
83
|
|
|
84
84
|
**content** (`string`): Text content of the document chunk
|
|
85
85
|
|
|
86
|
-
**metadata** (`Record<string, any>`): Additional metadata associated with the chunk
|
|
86
|
+
**metadata** (`Record<string, any>`): Additional metadata associated with the chunk, when present
|
|
87
87
|
|
|
88
88
|
**score** (`number`): Combined relevance score from graph traversal
|
|
89
89
|
|
|
@@ -50,7 +50,7 @@ function createRoute<TPath, TQuery, TBody, TResponse, TResponseType>(
|
|
|
50
50
|
|
|
51
51
|
**deprecated** (`boolean`): Mark route as deprecated
|
|
52
52
|
|
|
53
|
-
**onValidationError** (`(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`): Custom validation error handler for this route. Overrides the server-level onValidationError hook. Return { status, body } to customize the response, or undefined to use the default.
|
|
53
|
+
**onValidationError** (`(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined | void`): Custom validation error handler for this route. Overrides the server-level onValidationError hook. Return { status, body } to customize the response, or return nothing (undefined) to use the default.
|
|
54
54
|
|
|
55
55
|
## Handler parameters
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ console.log('Server running on http://localhost:3000')
|
|
|
61
61
|
|
|
62
62
|
**mastra** (`Mastra`): Mastra instance
|
|
63
63
|
|
|
64
|
-
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
64
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `'/api'`)
|
|
65
65
|
|
|
66
66
|
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
67
67
|
|
|
@@ -60,7 +60,7 @@ Express requires `express.json()` middleware for JSON body parsing. Add it befor
|
|
|
60
60
|
|
|
61
61
|
**mastra** (`Mastra`): Mastra instance
|
|
62
62
|
|
|
63
|
-
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
63
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `'/api'`)
|
|
64
64
|
|
|
65
65
|
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
66
66
|
|
|
@@ -63,7 +63,7 @@ app.listen({ port: 3000 }, (err, address) => {
|
|
|
63
63
|
|
|
64
64
|
**mastra** (`Mastra`): Mastra instance
|
|
65
65
|
|
|
66
|
-
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
66
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `'/api'`)
|
|
67
67
|
|
|
68
68
|
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
69
69
|
|
|
@@ -57,7 +57,7 @@ export default app
|
|
|
57
57
|
|
|
58
58
|
**mastra** (`Mastra`): Mastra instance
|
|
59
59
|
|
|
60
|
-
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
60
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `'/api'`)
|
|
61
61
|
|
|
62
62
|
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
63
63
|
|
|
@@ -142,7 +142,7 @@ Available context keys:
|
|
|
142
142
|
| `mastra` | Mastra instance |
|
|
143
143
|
| `requestContext` | Request context map |
|
|
144
144
|
| `abortSignal` | Request cancellation signal |
|
|
145
|
-
| `
|
|
145
|
+
| `registeredTools` | Tools registered with the adapter |
|
|
146
146
|
| `taskStore` | Task store for A2A operations |
|
|
147
147
|
| `customRouteAuthConfig` | Per-route auth overrides |
|
|
148
148
|
| `user` | Authenticated user (if auth configured) |
|
|
@@ -62,7 +62,7 @@ app.listen(3000, () => {
|
|
|
62
62
|
|
|
63
63
|
**mastra** (`Mastra`): Mastra instance
|
|
64
64
|
|
|
65
|
-
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `''`)
|
|
65
|
+
**prefix** (`string`): Route path prefix (e.g., /api/v2) (Default: `'/api'`)
|
|
66
66
|
|
|
67
67
|
**openapiPath** (`string`): Path to serve OpenAPI spec (e.g., /openapi.json) (Default: `''`)
|
|
68
68
|
|
|
@@ -89,7 +89,7 @@ By default, Mastra routes mount under `/api`. Use `prefix` to change it.
|
|
|
89
89
|
|
|
90
90
|
**customRouteAuthConfig** (`Map<string, boolean>`): Per-route auth overrides. Keys are METHOD:PATH. Custom routes from server.apiRoutes (registerApiRoute()) are added automatically based on their requiresAuth setting.
|
|
91
91
|
|
|
92
|
-
**tools** (`
|
|
92
|
+
**tools** (`ToolsInput`): Additional tools to register. Accepts Mastra tools, Vercel AI SDK tools, provider-defined tools, and web search tools.
|
|
93
93
|
|
|
94
94
|
**taskStore** (`InMemoryTaskStore`): Task store for A2A (Agent-to-Agent) operations
|
|
95
95
|
|
|
@@ -416,7 +416,7 @@ On authenticated servers, the read routes require the `stored-workflows:read` pe
|
|
|
416
416
|
| `PATCH` | `/api/datasets/:datasetId/experiments/:experimentId` | Update an experiment's name, description or metadata |
|
|
417
417
|
| `DELETE` | `/api/datasets/:datasetId/experiments/:experimentId` | Delete an experiment that belongs to the dataset |
|
|
418
418
|
| `GET` | `/api/datasets/:datasetId/experiments/:experimentId/results` | List experiment results |
|
|
419
|
-
| `POST` | `/api/datasets/:datasetId/compare` | Compare two experiments
|
|
419
|
+
| `POST` | `/api/datasets/:datasetId/compare` | Compare two to ten experiments |
|
|
420
420
|
|
|
421
421
|
### Delete an experiment
|
|
422
422
|
|