@mastra/mcp-docs-server 1.2.4-alpha.6 → 1.2.4-alpha.9

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.
@@ -21,7 +21,7 @@ Recording tools are disabled by default. Enable them only for agents that need t
21
21
 
22
22
  ## Enable recording
23
23
 
24
- Pass `recording.outputDir` to `AgentBrowser` or `StagehandBrowser`. The browser provider adds the `browser_record` and `browser_record_caption` tools to the agent's toolset.
24
+ Pass a `recording` object to `AgentBrowser` or `StagehandBrowser`. The only required field is `outputDir`. You can also set `maxDurationMs`, `maxWidth`, and `maxHeight` as defaults for every recording started by this browser.
25
25
 
26
26
  The following example enables recording for `AgentBrowser`:
27
27
 
@@ -33,6 +33,9 @@ export const browser = new AgentBrowser({
33
33
  headless: false,
34
34
  recording: {
35
35
  outputDir: join(process.cwd(), 'browser-recordings'),
36
+ maxDurationMs: 60_000,
37
+ maxWidth: 1280,
38
+ maxHeight: 720,
36
39
  },
37
40
  })
38
41
  ```
@@ -47,10 +50,15 @@ export const browser = new StagehandBrowser({
47
50
  headless: false,
48
51
  recording: {
49
52
  outputDir: join(process.cwd(), 'browser-recordings'),
53
+ maxDurationMs: 60_000,
54
+ maxWidth: 1280,
55
+ maxHeight: 720,
50
56
  },
51
57
  })
52
58
  ```
53
59
 
60
+ The agent can still override these defaults per-recording by passing `maxDurationMs`, `maxWidth`, or `maxHeight` to the `browser_record` tool at start time.
61
+
54
62
  ## Recording tools
55
63
 
56
64
  Enabling recording adds these tools:
@@ -148,7 +148,15 @@ const { items: matches } = await dataset.listItems({
148
148
  search: 'Hello',
149
149
  })
150
150
 
151
- // List items at a specific version
151
+ // Search and pagination can be combined with a specific version
152
+ const { items: v2Matches } = await dataset.listItems({
153
+ version: 2,
154
+ search: 'Hello',
155
+ page: 0,
156
+ perPage: 50,
157
+ })
158
+
159
+ // Version-only snapshot returns a bare DatasetItem[]
152
160
  const v2Items = await dataset.listItems({ version: 2 })
153
161
  ```
154
162
 
@@ -118,6 +118,7 @@ List of required environment variables for each model provider and gateway suppo
118
118
  | [The Grid AI](https://mastra.ai/models/providers/the-grid-ai) | `the-grid-ai/*` | `THEGRIDAI_API_KEY` |
119
119
  | [Tinfoil](https://mastra.ai/models/providers/tinfoil) | `tinfoil/*` | `TINFOIL_API_KEY` |
120
120
  | [Together AI](https://mastra.ai/models/providers/togetherai) | `togetherai/*` | `TOGETHER_API_KEY` |
121
+ | [TrustedRouter](https://mastra.ai/models/providers/trustedrouter) | `trustedrouter/*` | `TRUSTEDROUTER_API_KEY` |
121
122
  | [Umans AI](https://mastra.ai/models/providers/umans-ai) | `umans-ai/*` | `UMANS_AI_API_KEY` |
122
123
  | [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan) | `umans-ai-coding-plan/*` | `UMANS_AI_CODING_PLAN_API_KEY` |
123
124
  | [Upstage](https://mastra.ai/models/providers/upstage) | `upstage/*` | `UPSTAGE_API_KEY` |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![OpenRouter logo](https://models.dev/logos/openrouter.svg)OpenRouter
4
4
 
5
- OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 337 models through Mastra's model router.
5
+ OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 339 models through Mastra's model router.
6
6
 
7
7
  Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
8
8
 
@@ -283,6 +283,8 @@ ANTHROPIC_API_KEY=ant-...
283
283
  | `perplexity/sonar-reasoning-pro` |
284
284
  | `poolside/laguna-m.1` |
285
285
  | `poolside/laguna-m.1:free` |
286
+ | `poolside/laguna-xs-2.1` |
287
+ | `poolside/laguna-xs-2.1:free` |
286
288
  | `poolside/laguna-xs.2` |
287
289
  | `poolside/laguna-xs.2:free` |
288
290
  | `qwen/qwen-2.5-72b-instruct` |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Model Providers
4
4
 
5
- Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4500 models from 136 providers through a single API.
5
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4520 models from 137 providers through a single API.
6
6
 
7
7
  ## Features
8
8
 
@@ -52,7 +52,7 @@ for await (const chunk of stream) {
52
52
  | `llmgateway/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
53
53
  | `llmgateway/claude-sonnet-4-5-20250929` | 200K | | | | | | $3 | $15 |
54
54
  | `llmgateway/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
55
- | `llmgateway/claude-sonnet-5` | 1.0M | | | | | | $3 | $15 |
55
+ | `llmgateway/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
56
56
  | `llmgateway/codestral-2508` | 256K | | | | | | $0.30 | $0.90 |
57
57
  | `llmgateway/custom` | 128K | | | | | | — | — |
58
58
  | `llmgateway/deepseek-v3.1` | 128K | | | | | | $0.56 | $2 |
@@ -89,7 +89,7 @@ for await (const chunk of stream) {
89
89
  | `novita-ai/moonshotai/kimi-k2-instruct` | 131K | | | | | | $0.57 | $2 |
90
90
  | `novita-ai/moonshotai/kimi-k2-thinking` | 262K | | | | | | $0.60 | $3 |
91
91
  | `novita-ai/moonshotai/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
92
- | `novita-ai/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
92
+ | `novita-ai/moonshotai/kimi-k2.6` | 262K | | | | | | $0.80 | $3 |
93
93
  | `novita-ai/nousresearch/hermes-2-pro-llama-3-8b` | 8K | | | | | | $0.14 | $0.14 |
94
94
  | `novita-ai/openai/gpt-oss-120b` | 131K | | | | | | $0.05 | $0.25 |
95
95
  | `novita-ai/openai/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.15 |
@@ -106,7 +106,7 @@ for await (const chunk of stream) {
106
106
  | `novita-ai/qwen/qwen3-4b-fp8` | 128K | | | | | | $0.03 | $0.03 |
107
107
  | `novita-ai/qwen/qwen3-8b-fp8` | 128K | | | | | | $0.04 | $0.14 |
108
108
  | `novita-ai/qwen/qwen3-coder-30b-a3b-instruct` | 160K | | | | | | $0.07 | $0.27 |
109
- | `novita-ai/qwen/qwen3-coder-480b-a35b-instruct` | 262K | | | | | | $0.30 | $1 |
109
+ | `novita-ai/qwen/qwen3-coder-480b-a35b-instruct` | 262K | | | | | | $0.38 | $2 |
110
110
  | `novita-ai/qwen/qwen3-coder-next` | 262K | | | | | | $0.20 | $2 |
111
111
  | `novita-ai/qwen/qwen3-max` | 262K | | | | | | $2 | $8 |
112
112
  | `novita-ai/qwen/qwen3-next-80b-a3b-instruct` | 131K | | | | | | $0.15 | $2 |
@@ -129,7 +129,7 @@ for await (const chunk of stream) {
129
129
  | `novita-ai/sao10K/l31-70b-euryale-v2.2` | 8K | | | | | | $1 | $1 |
130
130
  | `novita-ai/xiaomimimo/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 |
131
131
  | `novita-ai/xiaomimimo/mimo-v2-pro` | 1.0M | | | | | | $2 | $6 |
132
- | `novita-ai/xiaomimimo/mimo-v2.5-pro` | 1.0M | | | | | | $2 | $6 |
132
+ | `novita-ai/xiaomimimo/mimo-v2.5-pro` | 1.0M | | | | | | $0.52 | $1 |
133
133
  | `novita-ai/zai-org/autoglm-phone-9b-multilingual` | 66K | | | | | | $0.04 | $0.14 |
134
134
  | `novita-ai/zai-org/glm-4.5` | 131K | | | | | | $0.60 | $2 |
135
135
  | `novita-ai/zai-org/glm-4.5-air` | 131K | | | | | | $0.13 | $0.85 |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![StepFun AI logo](https://models.dev/logos/stepfun-ai.svg)StepFun AI
4
4
 
5
- Access 2 StepFun AI models through Mastra's model router. Authentication is handled automatically using the `STEPFUN_API_KEY` environment variable.
5
+ Access 8 StepFun AI models through Mastra's model router. Authentication is handled automatically using the `STEPFUN_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [StepFun AI documentation](https://platform.stepfun.ai/docs/en/step-plan/integrations/open-code).
8
8
 
@@ -17,7 +17,7 @@ const agent = new Agent({
17
17
  id: "my-agent",
18
18
  name: "My Agent",
19
19
  instructions: "You are a helpful assistant",
20
- model: "stepfun-ai/step-3.5-flash"
20
+ model: "stepfun-ai/step-1-32k"
21
21
  });
22
22
 
23
23
  // Generate a response
@@ -36,8 +36,14 @@ for await (const chunk of stream) {
36
36
 
37
37
  | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
38
  | -------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `stepfun-ai/step-1-32k` | 33K | | | | | | $2 | $10 |
40
+ | `stepfun-ai/step-2-16k` | 16K | | | | | | $5 | $16 |
39
41
  | `stepfun-ai/step-3.5-flash` | 256K | | | | | | $0.10 | $0.30 |
40
42
  | `stepfun-ai/step-3.5-flash-2603` | 256K | | | | | | $0.10 | $0.30 |
43
+ | `stepfun-ai/step-3.7-flash` | 256K | | | | | | $0.20 | $1 |
44
+ | `stepfun-ai/step-tts-2` | — | | | | | | — | — |
45
+ | `stepfun-ai/stepaudio-2.5-asr` | — | | | | | | — | — |
46
+ | `stepfun-ai/stepaudio-2.5-tts` | — | | | | | | — | — |
41
47
 
42
48
  ## Advanced configuration
43
49
 
@@ -49,7 +55,7 @@ const agent = new Agent({
49
55
  name: "custom-agent",
50
56
  model: {
51
57
  url: "https://api.stepfun.ai/step_plan/v1",
52
- id: "stepfun-ai/step-3.5-flash",
58
+ id: "stepfun-ai/step-1-32k",
53
59
  apiKey: process.env.STEPFUN_API_KEY,
54
60
  headers: {
55
61
  "X-Custom-Header": "value"
@@ -67,8 +73,8 @@ const agent = new Agent({
67
73
  model: ({ requestContext }) => {
68
74
  const useAdvanced = requestContext.task === "complex";
69
75
  return useAdvanced
70
- ? "stepfun-ai/step-3.5-flash-2603"
71
- : "stepfun-ai/step-3.5-flash";
76
+ ? "stepfun-ai/stepaudio-2.5-tts"
77
+ : "stepfun-ai/step-1-32k";
72
78
  }
73
79
  });
74
80
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![StepFun logo](https://models.dev/logos/stepfun.svg)StepFun
4
4
 
5
- Access 5 StepFun models through Mastra's model router. Authentication is handled automatically using the `STEPFUN_API_KEY` environment variable.
5
+ Access 8 StepFun models through Mastra's model router. Authentication is handled automatically using the `STEPFUN_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [StepFun documentation](https://platform.stepfun.com/docs/zh/overview/concept).
8
8
 
@@ -41,6 +41,9 @@ for await (const chunk of stream) {
41
41
  | `stepfun/step-3.5-flash` | 256K | | | | | | $0.10 | $0.30 |
42
42
  | `stepfun/step-3.5-flash-2603` | 256K | | | | | | $0.10 | $0.30 |
43
43
  | `stepfun/step-3.7-flash` | 256K | | | | | | $0.20 | $1 |
44
+ | `stepfun/step-tts-2` | — | | | | | | — | — |
45
+ | `stepfun/stepaudio-2.5-asr` | — | | | | | | — | — |
46
+ | `stepfun/stepaudio-2.5-tts` | — | | | | | | — | — |
44
47
 
45
48
  ## Advanced configuration
46
49
 
@@ -70,7 +73,7 @@ const agent = new Agent({
70
73
  model: ({ requestContext }) => {
71
74
  const useAdvanced = requestContext.task === "complex";
72
75
  return useAdvanced
73
- ? "stepfun/step-3.7-flash"
76
+ ? "stepfun/stepaudio-2.5-tts"
74
77
  : "stepfun/step-1-32k";
75
78
  }
76
79
  });
@@ -40,7 +40,7 @@ for await (const chunk of stream) {
40
40
  | `togetherai/google/gemma-3n-E4B-it` | 33K | | | | | | $0.06 | $0.12 |
41
41
  | `togetherai/google/gemma-4-31B-it` | 262K | | | | | | $0.39 | $0.97 |
42
42
  | `togetherai/LiquidAI/LFM2-24B-A2B` | 33K | | | | | | $0.03 | $0.12 |
43
- | `togetherai/meta-llama/Llama-3.3-70B-Instruct-Turbo` | 131K | | | | | | $0.88 | $0.88 |
43
+ | `togetherai/meta-llama/Llama-3.3-70B-Instruct-Turbo` | 131K | | | | | | $1 | $1 |
44
44
  | `togetherai/meta-llama/Meta-Llama-3-8B-Instruct-Lite` | 8K | | | | | | $0.14 | $0.14 |
45
45
  | `togetherai/MiniMaxAI/MiniMax-M2.7` | 203K | | | | | | $0.30 | $1 |
46
46
  | `togetherai/MiniMaxAI/MiniMax-M3` | 524K | | | | | | $0.30 | $1 |
@@ -0,0 +1,79 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # ![TrustedRouter logo](https://models.dev/logos/trustedrouter.svg)TrustedRouter
4
+
5
+ Access 7 TrustedRouter models through Mastra's model router. Authentication is handled automatically using the `TRUSTEDROUTER_API_KEY` environment variable.
6
+
7
+ Learn more in the [TrustedRouter documentation](https://trustedrouter.com/docs).
8
+
9
+ ```bash
10
+ TRUSTEDROUTER_API_KEY=your-api-key
11
+ ```
12
+
13
+ ```typescript
14
+ import { Agent } from "@mastra/core/agent";
15
+
16
+ const agent = new Agent({
17
+ id: "my-agent",
18
+ name: "My Agent",
19
+ instructions: "You are a helpful assistant",
20
+ model: "trustedrouter/auto"
21
+ });
22
+
23
+ // Generate a response
24
+ const response = await agent.generate("Hello!");
25
+
26
+ // Stream a response
27
+ const stream = await agent.stream("Tell me a story");
28
+ for await (const chunk of stream) {
29
+ console.log(chunk);
30
+ }
31
+ ```
32
+
33
+ > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [TrustedRouter documentation](https://trustedrouter.com/docs) for details.
34
+
35
+ ## Models
36
+
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | -------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `trustedrouter/auto` | 1.0M | | | | | | — | — |
40
+ | `trustedrouter/cheap` | 1.0M | | | | | | — | — |
41
+ | `trustedrouter/e2e` | 1.0M | | | | | | — | — |
42
+ | `trustedrouter/fast` | 1.0M | | | | | | — | — |
43
+ | `trustedrouter/synth` | 1.0M | | | | | | — | — |
44
+ | `trustedrouter/synth-code` | 1.0M | | | | | | — | — |
45
+ | `trustedrouter/zdr` | 1.0M | | | | | | — | — |
46
+
47
+ ## Advanced configuration
48
+
49
+ ### Custom headers
50
+
51
+ ```typescript
52
+ const agent = new Agent({
53
+ id: "custom-agent",
54
+ name: "custom-agent",
55
+ model: {
56
+ url: "https://api.trustedrouter.com/v1",
57
+ id: "trustedrouter/auto",
58
+ apiKey: process.env.TRUSTEDROUTER_API_KEY,
59
+ headers: {
60
+ "X-Custom-Header": "value"
61
+ }
62
+ }
63
+ });
64
+ ```
65
+
66
+ ### Dynamic model selection
67
+
68
+ ```typescript
69
+ const agent = new Agent({
70
+ id: "dynamic-agent",
71
+ name: "Dynamic Agent",
72
+ model: ({ requestContext }) => {
73
+ const useAdvanced = requestContext.task === "complex";
74
+ return useAdvanced
75
+ ? "trustedrouter/zdr"
76
+ : "trustedrouter/auto";
77
+ }
78
+ });
79
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![ZenMux logo](https://models.dev/logos/zenmux.svg)ZenMux
4
4
 
5
- Access 112 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
5
+ Access 114 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
8
8
 
@@ -49,6 +49,8 @@ for await (const chunk of stream) {
49
49
  | `zenmux/anthropic/claude-sonnet-4` | 1.0M | | | | | | $3 | $15 |
50
50
  | `zenmux/anthropic/claude-sonnet-4.5` | 1.0M | | | | | | $3 | $15 |
51
51
  | `zenmux/anthropic/claude-sonnet-4.6` | 1.0M | | | | | | $3 | $15 |
52
+ | `zenmux/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
53
+ | `zenmux/anthropic/claude-sonnet-5-free` | 1.0M | | | | | | — | — |
52
54
  | `zenmux/baidu/ernie-5.0-thinking-preview` | 128K | | | | | | $0.84 | $3 |
53
55
  | `zenmux/deepseek/deepseek-chat` | 128K | | | | | | $0.28 | $0.42 |
54
56
  | `zenmux/deepseek/deepseek-v3.2` | 128K | | | | | | $0.28 | $0.43 |
@@ -117,6 +117,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
117
117
  - [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
118
118
  - [Tinfoil](https://mastra.ai/models/providers/tinfoil)
119
119
  - [Together AI](https://mastra.ai/models/providers/togetherai)
120
+ - [TrustedRouter](https://mastra.ai/models/providers/trustedrouter)
120
121
  - [Umans AI](https://mastra.ai/models/providers/umans-ai)
121
122
  - [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan)
122
123
  - [Upstage](https://mastra.ai/models/providers/upstage)
@@ -46,7 +46,7 @@ then interact with elements using their refs (e.g., @e5).`,
46
46
 
47
47
  **screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
48
48
 
49
- **recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset.
49
+ **recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset. You can also set maxDurationMs, maxWidth, and maxHeight as defaults for every recording.
50
50
 
51
51
  **excludeTools** (`BrowserToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
52
52
 
@@ -63,7 +63,7 @@ Use stagehand_extract to get data from pages.`,
63
63
 
64
64
  **screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
65
65
 
66
- **recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset.
66
+ **recording** (`BrowserRecordingOptions`): Alpha option for adding browser recording tools. Provide outputDir to add browser\_record and browser\_record\_caption to the toolset. You can also set maxDurationMs, maxWidth, and maxHeight as defaults for every recording.
67
67
 
68
68
  **excludeTools** (`StagehandToolName[]`): Tool names to exclude from the browser toolset. Use this to disable specific tools for models that do not support certain capabilities, such as vision.
69
69
 
@@ -2,22 +2,55 @@
2
2
 
3
3
  # Mastra.getAgentById()
4
4
 
5
- The `.getAgentById()` method is used to retrieve an agent by its ID. The method accepts a single `string` parameter for the agent's ID.
5
+ The `.getAgentById()` method retrieves a registered agent by its `id`. It first searches registered agents by `agent.id`. If no agent matches, it falls back to [`Mastra.getAgent()`](https://mastra.ai/reference/core/getAgent) and treats the provided value as the agent registry key.
6
+
7
+ Use `mastra.getAgentById(id)` to retrieve the code-defined agent. Use `await mastra.getAgentById(id, version)` to retrieve a versioned agent.
6
8
 
7
9
  ## Usage example
8
10
 
11
+ The following example registers an agent, retrieves it by ID, and uses the returned agent.
12
+
9
13
  ```typescript
10
- mastra.getAgentById('test-agent-123')
14
+ import { Agent } from '@mastra/core/agent'
15
+ import { Mastra } from '@mastra/core/mastra'
16
+
17
+ const supportAgent = new Agent({
18
+ id: 'support-agent-id',
19
+ name: 'Support Agent',
20
+ instructions: 'Answer support questions clearly and concisely.',
21
+ model: 'openai/gpt-5.5',
22
+ })
23
+
24
+ export const mastra = new Mastra({
25
+ agents: {
26
+ supportAgent,
27
+ },
28
+ })
29
+
30
+ const agent = mastra.getAgentById('support-agent-id')
31
+
32
+ const response = await agent.generate('How can I reset my password?')
11
33
  ```
12
34
 
13
35
  ## Parameters
14
36
 
15
- **id** (`string`): The ID of the agent to retrieve. The method will first search for an agent with this ID, and if not found, will attempt to use it as a name to call getAgent().
37
+ **id** (`string`): The ID of the agent to retrieve. Mastra first searches registered agents by \`agent.id\`. If none match, it uses this value as the agent registry key and calls \`getAgent()\`.
38
+
39
+ **version** (`{ versionId: string } | { status?: 'draft' | 'published' }`): Optional version selector for retrieving a versioned agent. When provided, the method returns a promise.
40
+
41
+ **version.versionId** (`string`): The ID of a specific agent version to retrieve.
42
+
43
+ **version.status** (`'draft' | 'published'`): Select the latest agent version with this publication status.
16
44
 
17
45
  ## Returns
18
46
 
19
- **agent** (`Agent`): The agent instance with the specified ID. Throws an error if the agent is not found.
47
+ **agent** (`TAgents[TAgentName]`): The agent instance with the specified ID when \`version\` is omitted.
48
+
49
+ **agent** (`Promise<TAgents[TAgentName]>`): A promise that resolves to the versioned agent instance when \`version\` is provided.
50
+
51
+ Throws a `MastraError` when no agent is found by ID or registry key.
20
52
 
21
53
  ## Related
22
54
 
55
+ - [Mastra.getAgent()](https://mastra.ai/reference/core/getAgent)
23
56
  - [Agents overview](https://mastra.ai/docs/agents/overview)
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/core@1.4.0`
6
6
 
7
- Lists all datasets with pagination.
7
+ Lists datasets with pagination and optional filters. Filters are applied at the storage layer, so callers don't need to post-filter results.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -20,6 +20,18 @@ const { datasets, pagination } = await mastra.datasets.list({ page: 0, perPage:
20
20
  for (const ds of datasets) {
21
21
  console.log(`${ds.id}: ${ds.name} (v${ds.version})`)
22
22
  }
23
+
24
+ // Filter by target type and name (case-insensitive substring)
25
+ const filtered = await mastra.datasets.list({
26
+ page: 0,
27
+ perPage: 20,
28
+ filters: { targetType: 'agent', name: 'qa' },
29
+ })
30
+
31
+ // Filter by any-overlap match on target IDs
32
+ const forAgents = await mastra.datasets.list({
33
+ filters: { targetIds: ['agent-a', 'agent-b'] },
34
+ })
23
35
  ```
24
36
 
25
37
  ## Parameters
@@ -28,6 +40,22 @@ for (const ds of datasets) {
28
40
 
29
41
  **perPage** (`number`): Number of datasets per page. Defaults to \`20\`.
30
42
 
43
+ **filters** (`object`): Optional filters applied at the storage layer.
44
+
45
+ **filters.organizationId** (`string`): Tenancy filter: restrict to datasets in this organization.
46
+
47
+ **filters.projectId** (`string`): Tenancy filter: restrict to datasets in this project.
48
+
49
+ **filters.candidateKey** (`string`): Restrict to datasets belonging to this candidate key.
50
+
51
+ **filters.candidateId** (`string`): Restrict to datasets belonging to this candidate ID.
52
+
53
+ **filters.targetType** (`'agent' | 'workflow' | 'scorer' | 'processor'`): Restrict to datasets targeting this component type.
54
+
55
+ **filters.targetIds** (`string[]`): Restrict to datasets whose \`targetIds\` intersect this list (any-overlap match). Empty array is treated as no filter.
56
+
57
+ **filters.name** (`string`): Case-insensitive substring match on dataset \`name\`. Empty string is treated as no filter.
58
+
31
59
  ## Returns
32
60
 
33
61
  **result** (`Promise<object>`): Paginated dataset list.
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/core@1.4.0`
6
6
 
7
- Lists individual item results for a specific experiment with pagination.
7
+ Lists individual item results for a specific experiment with optional filters and pagination. Filters are applied at the storage layer.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -23,6 +23,18 @@ const { results, pagination } = await dataset.listExperimentResults({
23
23
  perPage: 50,
24
24
  })
25
25
 
26
+ // Restrict to results that still need review
27
+ const { results: pending } = await dataset.listExperimentResults({
28
+ experimentId: 'exp-id',
29
+ status: 'needs-review',
30
+ })
31
+
32
+ // Restrict to results tied to a specific trace
33
+ const { results: byTrace } = await dataset.listExperimentResults({
34
+ experimentId: 'exp-id',
35
+ traceId: 'trace-abc',
36
+ })
37
+
26
38
  for (const result of results) {
27
39
  console.log(`Item ${result.itemId}: ${result.error ? 'FAILED' : 'OK'}`)
28
40
  }
@@ -32,6 +44,12 @@ for (const result of results) {
32
44
 
33
45
  **experimentId** (`string`): ID of the experiment to list results for.
34
46
 
47
+ **traceId** (`string`): Restrict results to those linked to this trace ID.
48
+
49
+ **status** (`'needs-review' | 'reviewed' | 'complete'`): Restrict results to this per-result review status.
50
+
51
+ **filters** (`ExperimentTenancyFilters`): Multi-tenant scoping filters (\`organizationId\`, \`projectId\`). Forwarded to the storage layer.
52
+
35
53
  **page** (`number`): Page number. Defaults to \`0\`.
36
54
 
37
55
  **perPage** (`number`): Number of results per page. Defaults to \`20\`.
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/core@1.4.0`
6
6
 
7
- Lists all experiments (runs) for this dataset with pagination.
7
+ Lists experiments (runs) for this dataset with optional filters and pagination. Filters are applied at the storage layer, so results are always scoped to the current dataset.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -17,8 +17,17 @@ const mastra = new Mastra({
17
17
 
18
18
  const dataset = await mastra.datasets.get({ id: 'dataset-id' })
19
19
 
20
+ // Basic pagination
20
21
  const { experiments, pagination } = await dataset.listExperiments({ page: 0, perPage: 10 })
21
22
 
23
+ // Filter to a specific agent version — useful for baseline vs variant comparisons
24
+ const { experiments: v2Runs } = await dataset.listExperiments({
25
+ targetType: 'agent',
26
+ targetId: 'my-agent',
27
+ agentVersion: 'v2',
28
+ status: 'completed',
29
+ })
30
+
22
31
  for (const exp of experiments) {
23
32
  console.log(`${exp.id}: ${exp.status} (${exp.succeededCount}/${exp.totalItems})`)
24
33
  }
@@ -26,6 +35,16 @@ for (const exp of experiments) {
26
35
 
27
36
  ## Parameters
28
37
 
38
+ **targetType** (`'agent' | 'workflow' | 'scorer' | 'processor'`): Restrict results to experiments run against this target type.
39
+
40
+ **targetId** (`string`): Restrict results to experiments run against this target ID.
41
+
42
+ **agentVersion** (`string`): Restrict results to experiments recorded against this agent version. Useful for distinguishing baseline from variant runs.
43
+
44
+ **status** (`'pending' | 'running' | 'completed' | 'failed'`): Restrict results to experiments in this status.
45
+
46
+ **filters** (`ExperimentTenancyFilters`): Multi-tenant scoping filters (\`organizationId\`, \`projectId\`). Forwarded to the storage layer.
47
+
29
48
  **page** (`number`): Page number. Defaults to \`0\`.
30
49
 
31
50
  **perPage** (`number`): Number of experiments per page. Defaults to \`20\`.
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/core@1.4.0`
6
6
 
7
- Lists items in the dataset. When a `version` is specified, returns all items at that version. Otherwise, returns paginated items from the latest version.
7
+ Lists items in the dataset. When only `version` is provided, returns a bare `DatasetItem[]` snapshot of every item at that version. In all other cases — no arguments, or `search` / `page` / `perPage` provided with or without `version` — returns a paginated `{ items, pagination }` shape.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -23,13 +23,17 @@ const result = await dataset.listItems()
23
23
  // List with search
24
24
  const filtered = await dataset.listItems({ search: 'TypeScript', page: 0, perPage: 10 })
25
25
 
26
- // List all items at a specific version
26
+ // Paginated list scoped to a specific version
27
+ const versionedPage = await dataset.listItems({ version: 2, page: 0, perPage: 20 })
28
+
29
+ // Version-only snapshot returns a bare DatasetItem[] (deprecated form —
30
+ // prefer passing page/perPage to receive the paginated shape).
27
31
  const versionedItems = await dataset.listItems({ version: 2 })
28
32
  ```
29
33
 
30
34
  ## Parameters
31
35
 
32
- **version** (`number`): Dataset version to list items at. When set, returns all items at that version (no pagination).
36
+ **version** (`number`): Dataset version to list items at. When passed on its own, returns every item at that version as a bare \`DatasetItem\[]\` snapshot. Passing \`search\` / \`page\` / \`perPage\` alongside \`version\` switches to the paginated shape.
33
37
 
34
38
  **page** (`number`): Page number for pagination. Defaults to \`0\`.
35
39
 
@@ -39,11 +43,11 @@ const versionedItems = await dataset.listItems({ version: 2 })
39
43
 
40
44
  ## Returns
41
45
 
42
- When `version` is specified:
46
+ When only `version` is provided (no `search`, `page`, or `perPage`):
43
47
 
44
- **result** (`Promise<DatasetItem[]>`): Array of all items at the specified dataset version.
48
+ **result** (`Promise<DatasetItem[]>`): Bare array of every item at the specified dataset version. This shape is retained for backwards compatibility and is deprecated — pass \`page\` / \`perPage\` (or \`search\`) to always receive the paginated shape below.
45
49
 
46
- When `version` isn't specified:
50
+ In all other cases (no arguments, or `search` / `page` / `perPage` provided with or without `version`):
47
51
 
48
52
  **result** (`Promise<object>`): Paginated response.
49
53
 
@@ -55,7 +55,13 @@ export const tool = createTool({
55
55
 
56
56
  **requestContextSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema for validating request context values. When provided, the context is validated before execute() runs, returning an error object if validation fails.
57
57
 
58
- **execute** (`function`): The function that contains the tool's logic. It receives two parameters: the validated input data based on inputSchema (first parameter) and an optional execution context object (second parameter) containing \`requestContext\`, \`tracingContext\`, \`abortSignal\`, and other execution metadata.
58
+ **providerOptions** (`Record<string, Record<string, unknown>>`): Provider-specific options passed to the model when this tool is used. Keys are provider names, such as \`anthropic\` or \`openai\`, and values are provider-specific configuration objects.
59
+
60
+ **inputExamples** (`Array<{ input: Record<string, unknown> }>`): Examples of valid tool inputs that supported model providers can use as input examples.
61
+
62
+ **background** (`ToolBackgroundConfig`): Background task configuration for this tool. When enabled, the tool can execute in the background while the agent conversation continues.
63
+
64
+ **execute** (`function`): The function that contains the tool's logic. Ordinary custom tools usually provide \`execute\`, but the type allows omission for tool definitions that are executed or adapted elsewhere. It receives two parameters: the validated input data based on inputSchema (first parameter) and an execution context object (second parameter) containing \`requestContext\`, \`abortSignal\`, and other execution metadata.
59
65
 
60
66
  **execute.input** (`z.infer<TInput>`): The validated input data based on inputSchema
61
67
 
@@ -63,8 +69,6 @@ export const tool = createTool({
63
69
 
64
70
  **execute.context.requestContext** (`RequestContext`): Request Context for accessing shared state and dependencies
65
71
 
66
- **execute.context.tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata
67
-
68
72
  **execute.context.abortSignal** (`AbortSignal`): Signal for aborting the tool execution
69
73
 
70
74
  **execute.context.agent** (`AgentToolExecutionContext`): Agent-specific context, available when the tool is executed by an agent.
@@ -75,13 +79,15 @@ export const tool = createTool({
75
79
 
76
80
  **execute.context.observe** (`ToolObserve`): Observability helpers for recording child spans and structured logs from inside a tool's execute function. Always provided — when no tracing context is active, \`span\` runs the function directly and \`log\` is a no-op.
77
81
 
78
- **onInputStart** (`function`): Optional callback invoked when the tool call input streaming begins. Receives \`toolCallId\`, \`messages\`, and \`abortSignal\`.
82
+ **onInputStart** (`function`): Optional callback invoked when the tool call input streaming begins. Signature: \`(options: ToolCallOptions) => void | PromiseLike\<void>\`.
83
+
84
+ **onInputDelta** (`function`): Optional callback invoked for each incremental chunk of input text as it streams in. Signature: \`({ inputTextDelta, ...options }: { inputTextDelta: string } & ToolCallOptions) => void | PromiseLike\<void>\`.
79
85
 
80
- **onInputDelta** (`function`): Optional callback invoked for each incremental chunk of input text as it streams in. Receives \`inputTextDelta\`, \`toolCallId\`, \`messages\`, and \`abortSignal\`.
86
+ **onInputAvailable** (`function`): Optional callback invoked when the complete tool input is available and parsed. Signature: \`({ input, ...options }: { input: TSchemaIn } & ToolCallOptions) => void | PromiseLike\<void>\`.
81
87
 
82
- **onInputAvailable** (`function`): Optional callback invoked when the complete tool input is available and parsed. Receives the validated \`input\` object, \`toolCallId\`, \`messages\`, and \`abortSignal\`.
88
+ **onOutput** (`function`): Optional callback invoked after the tool has successfully executed and returned output. Signature: \`({ output, toolName, ...options }: { output: TSchemaOut; toolName: string } & Omit\<ToolCallOptions, 'messages'>) => void | PromiseLike\<void>\`.
83
89
 
84
- **onOutput** (`function`): Optional callback invoked after the tool has successfully executed and returned output. Receives the tool's \`output\`, \`toolCallId\`, \`messages\`, and \`abortSignal\`.
90
+ Runtime-populated fields such as `mastra` and `mcpMetadata` appear in source types but are set by Mastra or MCP adapters. You do not need to configure them for ordinary `createTool()` usage.
85
91
 
86
92
  ## Returns
87
93
 
@@ -310,8 +316,9 @@ export const weatherTool = createTool({
310
316
  },
311
317
  },
312
318
  execute: async inputData => {
313
- const weather = await fetchWeather(inputData.location)
314
- return { weather }
319
+ return {
320
+ weather: `Current weather for ${inputData.location}: sunny`,
321
+ }
315
322
  },
316
323
  })
317
324
  ```
@@ -320,7 +327,44 @@ export const weatherTool = createTool({
320
327
 
321
328
  Tools support lifecycle hooks that allow you to monitor and react to different stages of tool execution. These hooks are particularly useful for logging, analytics, validation, and real-time updates during streaming.
322
329
 
323
- ### Available Hooks
330
+ The following example demonstrates a tool with all lifecycle hooks configured:
331
+
332
+ ```typescript
333
+ import { createTool } from '@mastra/core/tools'
334
+ import { z } from 'zod'
335
+
336
+ export const weatherTool = createTool({
337
+ id: 'get-weather',
338
+ description: 'Get weather for a city',
339
+ inputSchema: z.object({
340
+ city: z.string(),
341
+ }),
342
+ outputSchema: z.object({
343
+ city: z.string(),
344
+ forecast: z.string(),
345
+ }),
346
+ execute: async ({ city }) => {
347
+ return {
348
+ city,
349
+ forecast: 'sunny',
350
+ }
351
+ },
352
+ onInputStart: ({ toolCallId }) => {
353
+ console.log(`Tool call ${toolCallId} input started`)
354
+ },
355
+ onInputDelta: ({ inputTextDelta, toolCallId }) => {
356
+ console.log(`Tool call ${toolCallId} received input chunk: ${inputTextDelta}`)
357
+ },
358
+ onInputAvailable: ({ input, toolCallId }) => {
359
+ console.log(`Tool call ${toolCallId} received city: ${input.city}`)
360
+ },
361
+ onOutput: ({ output, toolCallId, toolName }) => {
362
+ console.log(`Tool ${toolName} call ${toolCallId} returned forecast: ${output.forecast}`)
363
+ },
364
+ })
365
+ ```
366
+
367
+ ### Available hooks
324
368
 
325
369
  #### `onInputStart`
326
370
 
@@ -389,7 +433,7 @@ export const tool = createTool({
389
433
  })
390
434
  ```
391
435
 
392
- ### Hook Execution Order
436
+ ### Hook execution order
393
437
 
394
438
  For a typical streaming tool call, the hooks are invoked in this order:
395
439
 
@@ -399,19 +443,14 @@ For a typical streaming tool call, the hooks are invoked in this order:
399
443
  4. Tool's **execute** function runs
400
444
  5. **onOutput**: Tool has completed successfully
401
445
 
402
- ### Hook Parameters
403
-
404
- All hooks receive a parameter object with these common properties:
405
-
406
- - `toolCallId` (string): Unique identifier for this specific tool call
407
- - `abortSignal` (AbortSignal): Signal for detecting if the operation should be cancelled
446
+ ### Hook parameters
408
447
 
409
- Additionally:
448
+ Hook callbacks receive these source-backed parameter shapes:
410
449
 
411
- - `onInputStart`, `onInputDelta`, and `onInputAvailable` receive `messages` (array): The conversation messages at the time of the tool call
412
- - `onInputDelta` receives `inputTextDelta` (string): The incremental text chunk
413
- - `onInputAvailable` receives `input`: The validated input data (typed according to `inputSchema`)
414
- - `onOutput` receives `output`: The tool's return value (typed according to `outputSchema`) and `toolName` (string): The name of the tool
450
+ - `onInputStart`: Receives `ToolCallOptions`, including fields such as `toolCallId`, `messages`, and `abortSignal`.
451
+ - `onInputDelta`: Receives `{ inputTextDelta: string } & ToolCallOptions`.
452
+ - `onInputAvailable`: Receives `{ input: TSchemaIn } & ToolCallOptions`, where `input` is typed from `inputSchema`.
453
+ - `onOutput`: Receives `{ output: TSchemaOut; toolName: string } & Omit<ToolCallOptions, 'messages'>`, where `output` is typed from `outputSchema`. This hook does not receive `messages`.
415
454
 
416
455
  ### Error handling
417
456
 
@@ -430,7 +469,7 @@ mcp: {
430
469
  }
431
470
  ```
432
471
 
433
- ### `ToolAnnotations` Properties
472
+ ### `ToolAnnotations` properties
434
473
 
435
474
  **title** (`string`): A human-readable title for the tool. Used for display purposes in UI components.
436
475
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.4-alpha.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`9250acd`](https://github.com/mastra-ai/mastra/commit/9250acd1357f0f1f33d0dcca16f9655084c58eca), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`c64c2a8`](https://github.com/mastra-ai/mastra/commit/c64c2a8503a50252f9ca6b8e8c54cadee31b92a2), [`06e2680`](https://github.com/mastra-ai/mastra/commit/06e26806b51d2cbd858afdc66daa2b86ff3ba64a), [`1240f05`](https://github.com/mastra-ai/mastra/commit/1240f051c8e5371f1c014448bf37b1a1b9a05e47), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`24c10d3`](https://github.com/mastra-ai/mastra/commit/24c10d333e6649ac06075903aeeee13a933db3b3), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748), [`215f9b0`](https://github.com/mastra-ai/mastra/commit/215f9b0f3f3f6fc165edad360582dd4d3d7ea748)]:
8
+ - @mastra/core@1.49.0-alpha.5
9
+
10
+ ## 1.2.4-alpha.7
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`6a61846`](https://github.com/mastra-ai/mastra/commit/6a61846eeda29fb714549b70f1bee2bf6b141c44)]:
15
+ - @mastra/core@1.49.0-alpha.4
16
+
3
17
  ## 1.2.4-alpha.6
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.4-alpha.6",
3
+ "version": "1.2.4-alpha.9",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "jsdom": "^26.1.0",
29
29
  "local-pkg": "^1.1.2",
30
30
  "zod": "^4.4.3",
31
- "@mastra/core": "1.49.0-alpha.3",
32
- "@mastra/mcp": "^1.13.0-alpha.1"
31
+ "@mastra/mcp": "^1.13.0-alpha.1",
32
+ "@mastra/core": "1.49.0-alpha.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.11",
@@ -47,7 +47,7 @@
47
47
  "vitest": "4.1.8",
48
48
  "@internal/lint": "0.0.110",
49
49
  "@internal/types-builder": "0.0.85",
50
- "@mastra/core": "1.49.0-alpha.3"
50
+ "@mastra/core": "1.49.0-alpha.5"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {