@mastra/mcp-docs-server 1.2.8-alpha.0 → 1.2.8-alpha.2

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.
Files changed (33) hide show
  1. package/.docs/docs/agent-builder/deploying.md +1 -0
  2. package/.docs/docs/agent-builder/overview.md +1 -1
  3. package/.docs/docs/agent-controller/overview.md +1 -1
  4. package/.docs/docs/agents/using-tools.md +37 -0
  5. package/.docs/docs/capabilities/channels/other-adapters.md +1 -1
  6. package/.docs/docs/capabilities/channels/overview.md +1 -0
  7. package/.docs/docs/capabilities/channels/slack.md +2 -2
  8. package/.docs/docs/getting-started/file-based-agents.md +2 -2
  9. package/.docs/docs/long-running-agents/schedules.md +2 -2
  10. package/.docs/docs/mastra-platform/database.md +1 -0
  11. package/.docs/docs/mastra-platform/deploy.md +3 -1
  12. package/.docs/docs/memory/multi-user-threads.md +4 -4
  13. package/.docs/docs/memory/observational-memory.md +1 -1
  14. package/.docs/docs/memory/working-memory.md +1 -1
  15. package/.docs/docs/observability/integrations/exporters/braintrust.md +34 -2
  16. package/.docs/docs/voice/livekit.md +1 -1
  17. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -0
  18. package/.docs/guides/guide/signal-provider.md +2 -0
  19. package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
  20. package/.docs/reference/agents/agent.md +1 -1
  21. package/.docs/reference/cli/mastra.md +1 -1
  22. package/.docs/reference/core/getTool.md +33 -0
  23. package/.docs/reference/core/getToolById.md +48 -0
  24. package/.docs/reference/core/listTools.md +38 -0
  25. package/.docs/reference/core/mastra-class.md +1 -1
  26. package/.docs/reference/file-based-agents/logger.md +1 -1
  27. package/.docs/reference/index.md +3 -0
  28. package/.docs/reference/storage/clickhouse.md +1 -1
  29. package/.docs/reference/storage/convex.md +17 -10
  30. package/.docs/reference/storage/retention.md +1 -1
  31. package/.docs/reference/tools/task-tools.md +2 -2
  32. package/CHANGELOG.md +7 -0
  33. package/package.json +5 -5
@@ -29,6 +29,7 @@ import { LibSQLStore } from '@mastra/libsql'
29
29
 
30
30
  new Mastra({
31
31
  storage: new LibSQLStore({
32
+ id: 'mastra-storage',
32
33
  url: process.env.DATABASE_URL!,
33
34
  authToken: process.env.DATABASE_AUTH_TOKEN,
34
35
  }),
@@ -67,7 +67,7 @@ import { createBuilderAgent } from '@mastra/editor/ee'
67
67
  import { LibSQLStore } from '@mastra/libsql'
68
68
 
69
69
  export const mastra = new Mastra({
70
- storage: new LibSQLStore({ url: 'file:./mastra.db' }),
70
+ storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
71
71
  agents: { builderAgent: createBuilderAgent() },
72
72
  editor: new MastraEditor({
73
73
  builder: {
@@ -65,7 +65,7 @@ const agent = new Agent({
65
65
  const agentController = new AgentController({
66
66
  id: 'my-agent',
67
67
  agent,
68
- storage: new LibSQLStore({ url: 'file:./data.db' }),
68
+ storage: new LibSQLStore({ id: 'agent-storage', url: 'file:./data.db' }),
69
69
  modes: [
70
70
  {
71
71
  id: 'plan',
@@ -193,6 +193,43 @@ export const researchAgent = new Agent({
193
193
  })
194
194
  ```
195
195
 
196
+ ## Share tools across agents
197
+
198
+ Direct imports are the simplest choice when one tool is used by one or a small number of agents. Each agent imports the tool and adds it to its `tools` record, as shown in the quickstart above.
199
+
200
+ For tools shared across agents or retrieved elsewhere from the Mastra instance, register them once with `new Mastra({ tools })`. A function-based Agent `tools` callback can then resolve entries from that registry.
201
+
202
+ ```typescript
203
+ import { Agent } from '@mastra/core/agent'
204
+ import { Mastra } from '@mastra/core/mastra'
205
+ import { weatherTool } from './tools/weather-tool'
206
+
207
+ export const sharedWeatherAgent = new Agent({
208
+ id: 'shared-weather-agent',
209
+ name: 'Shared Weather Agent',
210
+ instructions: `
211
+ You are a helpful weather assistant.
212
+ Use the weatherTool to fetch current weather data.`,
213
+ model: 'openai/gpt-5.5',
214
+ tools: ({ mastra }) => {
215
+ if (!mastra) {
216
+ throw new Error('Mastra instance is required to resolve shared tools')
217
+ }
218
+
219
+ return { weatherTool: mastra.getTool('weather') }
220
+ },
221
+ })
222
+
223
+ export const mastra = new Mastra({
224
+ tools: { weather: weatherTool },
225
+ agents: { sharedWeatherAgent },
226
+ })
227
+ ```
228
+
229
+ Register the tool and Agent on the same Mastra instance. The Agent can then retrieve the shared tool by its registration key in the `tools` callback and return it under the name the model should use. Keep the `mastra` guard because it's optional in the callback type.
230
+
231
+ For API details, see [`Mastra.getTool()`](https://mastra.ai/reference/core/getTool), [`Mastra.getToolById()`](https://mastra.ai/reference/core/getToolById), [`Mastra.listTools()`](https://mastra.ai/reference/core/listTools), and the [`Agent` reference](https://mastra.ai/reference/agents/agent).
232
+
196
233
  ## Shape output for the model
197
234
 
198
235
  Use `toModelOutput` when your tool returns rich structured data for your application, but you want the model to receive a smaller or multimodal representation. This keeps model context focused while preserving the full tool result in your app.
@@ -2,7 +2,7 @@
2
2
 
3
3
  # More
4
4
 
5
- Mastra channels use Chat SDK adapters, so the pages in this section are not the full list of supported platforms. Use any Chat SDK platform adapter that exports an adapter factory compatible with `channels.adapters`.
5
+ Mastra channels use Chat SDK adapters, so the pages in this section aren't the full list of supported platforms. Use any Chat SDK platform adapter that exports an adapter factory compatible with `channels.adapters`.
6
6
 
7
7
  ## Adapter catalog
8
8
 
@@ -58,6 +58,7 @@ import { yourAgent } from './agents/your-agent'
58
58
  export const mastra = new Mastra({
59
59
  agents: { yourAgent },
60
60
  storage: new LibSQLStore({
61
+ id: 'mastra-storage',
61
62
  url: process.env.DATABASE_URL,
62
63
  }),
63
64
  })
@@ -53,7 +53,7 @@ export const yourAgent = new Agent({
53
53
 
54
54
  ## Create a Slack app
55
55
 
56
- To connect your agent, create a Slack app in the workspace where you want it to run. The Slack app controls how your agent appears in Slack, what it can do, and which events it receives.
56
+ To connect your agent, create a Slack app in the workspace where you want it to run. The Slack app controls your agent's display in Slack, its capabilities, and the events it receives.
57
57
 
58
58
  This guide uses a [manifest](https://docs.slack.dev/app-manifests/configuring-apps-with-app-manifests/#creating_manifests): a configuration file that creates the Slack app settings for you. This is the fastest path when you are adding your agent to your own workspace. It doesn't cover the platform OAuth flow where other workspaces install your agent.
59
59
 
@@ -109,7 +109,7 @@ This manifest configures:
109
109
  - `display_information.name` and `features.bot_user.display_name`: Set your agent's name in Slack. You can update it at any time; remember to reinstall the app after changing names or permissions.
110
110
  - `app_home.messages_tab_enabled` and `app_home.messages_tab_read_only_enabled`: Enable direct messages from the Slack app's **Messages** tab.
111
111
  - `always_online`: Shows the Slack bot user as always available.
112
- - `oauth_config.scopes.bot`: Grants the bot permission to post messages, read channel messages where it is present, read mentions, read and write direct messages, and look up users.
112
+ - `oauth_config.scopes.bot`: Grants the bot permission to post messages, read channel messages where it's present, read mentions, read and write direct messages, and look up users.
113
113
  - `event_subscriptions`: Tells Slack which message events to send to the webhook.
114
114
  - `interactivity`: Enables interactive cards and tells Slack where to send card actions.
115
115
 
@@ -10,9 +10,9 @@ File-based agents are an experimental, convention-based way to define [Mastra ag
10
10
 
11
11
  This approach reduces glue code and makes the file system itself a direct representation of your [project structure](https://mastra.ai/reference/project-structure), so both you and your coding agent can understand it at a glance.
12
12
 
13
- You can build your entire project with file-based agents or combine this approach with agents and other primitives defined directly in code, making it easy to adopt incrementally.
13
+ You can build your entire project with file-based agents or combine this approach with agents and other primitives defined directly in code for incremental adoption.
14
14
 
15
- File-based agents have some limitations while in beta. Not every Mastra feature can be defined in a file yet, and they are not the best fit for dynamic configuration or runtime wiring. When needed, you can define agents and related primitives directly in code.
15
+ File-based agents have some limitations while in beta. Not every Mastra feature can be defined in a file yet, and they're not the best fit for dynamic configuration or runtime wiring. When needed, you can define agents and related primitives directly in code.
16
16
 
17
17
  > **Note:** All Mastra documentation currently shows agents and primitives defined directly in code. File-based agents use the same underlying concepts and APIs, so the guidance elsewhere in the docs still applies. As file-based agents mature, more examples may use this structure where appropriate.
18
18
 
@@ -30,7 +30,7 @@ const pinger = new Agent({
30
30
 
31
31
  const mastra = new Mastra({
32
32
  agents: { pinger },
33
- storage: new LibSQLStore({ url: 'file:./mastra.db' }),
33
+ storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
34
34
  })
35
35
 
36
36
  await mastra.schedules.create({
@@ -164,7 +164,7 @@ Hooks let you run code at key points in an agent schedule's lifecycle, for examp
164
164
  ```typescript
165
165
  const mastra = new Mastra({
166
166
  agents: { pinger },
167
- storage: new LibSQLStore({ url: 'file:./mastra.db' }),
167
+ storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
168
168
  schedules: {
169
169
  prepare: async ({ agentId, schedule, trigger }) => {
170
170
  // Return overrides, null to skip this fire, or undefined for defaults
@@ -99,6 +99,7 @@ Turso exposes two environment variables: `TURSO_DATABASE_URL` and `TURSO_AUTH_TO
99
99
  import { LibSQLStore } from '@mastra/libsql'
100
100
 
101
101
  export const storage = new LibSQLStore({
102
+ id: 'mastra-storage',
102
103
  url: process.env.TURSO_DATABASE_URL!,
103
104
  authToken: process.env.TURSO_AUTH_TOKEN!,
104
105
  })
@@ -44,6 +44,7 @@ A local `.env` file is optional. Environment variables stored on the platform ar
44
44
  >
45
45
  > ```ts
46
46
  > new LibSQLStore({
47
+ > id: 'mastra-storage',
47
48
  > // Uses the hosted database when deployed, a local file during development
48
49
  > url: process.env.TURSO_DATABASE_URL ?? 'file:./mastra.db',
49
50
  > authToken: process.env.TURSO_AUTH_TOKEN,
@@ -82,12 +83,13 @@ The region is fixed when the environment is created. Databases attached to an en
82
83
 
83
84
  Preflight validates the built output before anything ships, and only flags issues in your own code:
84
85
 
85
- - **Local storage paths**: A hard block. File-backed storage (for example `file:./mastra.db`) is lost on every deploy. Preflight passes when the path is guarded by an environment variable that is set locally, stored on the platform, or provided by a managed database:
86
+ - **Local storage paths**: A hard block. File-backed storage (for example `file:./mastra.db`) is lost on every deploy. Preflight passes when the path is guarded by an environment variable that's set locally, stored on the platform, or provided by a managed database:
86
87
 
87
88
  ```ts
88
89
  import { LibSQLStore } from '@mastra/libsql'
89
90
 
90
91
  export const storage = new LibSQLStore({
92
+ id: 'mastra-storage',
91
93
  // Uses the hosted database when deployed, a local file during development
92
94
  url: process.env.TURSO_DATABASE_URL ?? 'file:./mastra.db',
93
95
  authToken: process.env.TURSO_AUTH_TOKEN,
@@ -58,7 +58,7 @@ import { Memory } from '@mastra/memory'
58
58
  import { LibSQLStore } from '@mastra/libsql'
59
59
 
60
60
  const memory = new Memory({
61
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
61
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
62
62
  options: {
63
63
  lastMessages: 20,
64
64
  },
@@ -128,7 +128,7 @@ import { Memory } from '@mastra/memory'
128
128
  import { LibSQLStore } from '@mastra/libsql'
129
129
 
130
130
  const memory = new Memory({
131
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
131
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
132
132
  options: {
133
133
  lastMessages: 20,
134
134
  },
@@ -148,7 +148,7 @@ import { Memory } from '@mastra/memory'
148
148
  import { LibSQLStore } from '@mastra/libsql'
149
149
 
150
150
  const memory = new Memory({
151
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
151
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
152
152
  options: {
153
153
  lastMessages: 20,
154
154
  observationalMemory: true,
@@ -171,7 +171,7 @@ import { Memory } from '@mastra/memory'
171
171
  import { LibSQLStore } from '@mastra/libsql'
172
172
 
173
173
  const memory = new Memory({
174
- storage: new LibSQLStore({ url: 'file:./collab.db' }),
174
+ storage: new LibSQLStore({ id: 'collab-storage', url: 'file:./collab.db' }),
175
175
  options: {
176
176
  lastMessages: 20,
177
177
  workingMemory: {
@@ -47,7 +47,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
47
47
  >
48
48
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
49
49
 
50
- > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, and `@mastra/mongodb` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
50
+ > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mongodb`, and `@mastra/convex` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
51
51
 
52
52
  ## Temporal gap markers
53
53
 
@@ -403,7 +403,7 @@ By default, working memory reaches the model as part of the system message. You
403
403
 
404
404
  ```typescript
405
405
  const memory = new Memory({
406
- storage: new LibSQLStore({ url: 'file:./mastra.db' }),
406
+ storage: new LibSQLStore({ id: 'mastra-storage', url: 'file:./mastra.db' }),
407
407
  options: {
408
408
  workingMemory: {
409
409
  enabled: true,
@@ -109,10 +109,38 @@ new BraintrustExporter({
109
109
 
110
110
  ## Attach traces to Braintrust evals
111
111
 
112
+ Install the Braintrust SDK directly when your application uses `Eval()`, `logger.traced()`, or `currentSpan`:
113
+
114
+ **npm**:
115
+
116
+ ```bash
117
+ npm install braintrust@latest
118
+ ```
119
+
120
+ **pnpm**:
121
+
122
+ ```bash
123
+ pnpm add braintrust@latest
124
+ ```
125
+
126
+ **Yarn**:
127
+
128
+ ```bash
129
+ yarn add braintrust@latest
130
+ ```
131
+
132
+ **Bun**:
133
+
134
+ ```bash
135
+ bun add braintrust@latest
136
+ ```
137
+
112
138
  When you run Mastra inside Braintrust `Eval()` or `logger.traced()`, pass the Braintrust logger and `currentSpan` resolver to the exporter. Import `currentSpan` from the same `braintrust` package instance that creates the eval or traced span.
113
139
 
114
140
  This helps Mastra attach its spans under the active Braintrust span when your app and `@mastra/braintrust` resolve different installed copies of the Braintrust SDK.
115
141
 
142
+ The exporter accepts compatible logger and span objects from Braintrust SDK v2 and v3. Your application's Braintrust SDK version doesn't need to match the version installed by `@mastra/braintrust`.
143
+
116
144
  ```typescript
117
145
  import { currentSpan, initLogger } from 'braintrust'
118
146
  import { BraintrustExporter } from '@mastra/braintrust'
@@ -144,15 +172,19 @@ await Eval('my-project', {
144
172
  })
145
173
  ```
146
174
 
175
+ If your application upgrades its direct Braintrust dependency from v2 to v3 and uses Nunjucks prompt templates, follow the [Braintrust v2 to v3 migration guide](https://www.braintrust.dev/docs/sdks/typescript/migrations/v2-to-v3).
176
+
147
177
  ## Querying Braintrust with returned `spanId`
148
178
 
149
- For Braintrust, use `spanId` as the root span identifier when searching for traces because Braintrust root-span queries are typically faster than trace-id queries.
179
+ Mastra uses its returned `spanId` as both the Braintrust row ID and span ID. Use it to find the corresponding Braintrust span by `id` or `span_id`.
180
+
181
+ Braintrust v3 stores a separate W3C trace ID in `root_span_id`, so the returned Mastra `spanId` isn't the Braintrust `root_span_id`.
150
182
 
151
183
  ```typescript
152
184
  const result = await agent.stream('Summarize this ticket')
153
185
 
154
186
  console.log('Mastra trace ID:', result.traceId)
155
- console.log('Braintrust root span ID:', result.spanId)
187
+ console.log('Braintrust row and span ID:', result.spanId)
156
188
 
157
189
  // Use result.spanId in your Braintrust lookup/query path
158
190
  ```
@@ -360,7 +360,7 @@ import { LibSQLStore } from '@mastra/libsql'
360
360
  import { Observability, MastraStorageExporter } from '@mastra/observability'
361
361
 
362
362
  export const mastra = new Mastra({
363
- storage: new LibSQLStore({ url: 'file:./voice-agent.db' }),
363
+ storage: new LibSQLStore({ id: 'voice-agent-storage', url: 'file:./voice-agent.db' }),
364
364
  observability: new Observability({
365
365
  configs: {
366
366
  default: {
@@ -1134,6 +1134,7 @@ import { LibSQLStore } from '@mastra/libsql'
1134
1134
  export const mastra = new Mastra({
1135
1135
  workflows: { approvalWorkflow },
1136
1136
  storage: new LibSQLStore({
1137
+ id: 'mastra-storage',
1137
1138
  url: 'file:../mastra.db',
1138
1139
  }),
1139
1140
  server: {
@@ -26,6 +26,7 @@ import { LibSQLStore } from '@mastra/libsql'
26
26
 
27
27
  export const mastra = new Mastra({
28
28
  storage: new LibSQLStore({
29
+ id: 'mastra-storage',
29
30
  url: 'file:./mastra.db',
30
31
  }),
31
32
  })
@@ -133,6 +134,7 @@ import { devAgent } from './agents/dev-agent'
133
134
  export const mastra = new Mastra({
134
135
  agents: { devAgent },
135
136
  storage: new LibSQLStore({
137
+ id: 'mastra-storage',
136
138
  url: 'file:./mastra.db',
137
139
  }),
138
140
  })
@@ -22,7 +22,7 @@ import { z } from 'zod'
22
22
  const agentController = new AgentController({
23
23
  id: 'my-coding-agent',
24
24
  agent: myAgent,
25
- storage: new LibSQLStore({ url: 'file:./data.db' }),
25
+ storage: new LibSQLStore({ id: 'agent-storage', url: 'file:./data.db' }),
26
26
  stateSchema: z.object({
27
27
  currentModelId: z.string().optional(),
28
28
  }),
@@ -439,7 +439,7 @@ Returns an `AgentThreadSubscription` object with these members:
439
439
 
440
440
  **agents** (`Record<string, Agent> | ({ requestContext: RequestContext }) => Record<string, Agent> | Promise<Record<string, Agent>>`): Subagents that the agent can access. Can be provided statically or resolved dynamically.
441
441
 
442
- **tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
442
+ **tools** (`ToolsInput | ({ requestContext: RequestContext, mastra?: Mastra }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically from the request context and associated Mastra instance when available.
443
443
 
444
444
  **hooks** (`ToolHooks`): Hooks that run before and after every tool call made by this agent. Per-execution hooks passed to generate() or stream() override matching hooks set here. See Tool hooks below.
445
445
 
@@ -429,7 +429,7 @@ Emit machine-readable JSON. Secret values are masked unless `--show-secrets` is
429
429
 
430
430
  ### `mastra env db delete`
431
431
 
432
- Permanently deletes a database with the provider, including all of its data. This cannot be undone. The CLI prompts for confirmation unless `--yes` is passed. After deletion, deploys no longer receive the database's env vars.
432
+ Permanently deletes a database with the provider, including all of its data. This can't be undone. The CLI prompts for confirmation unless `--yes` is passed. After deletion, deploys no longer receive the database's env vars.
433
433
 
434
434
  ```bash
435
435
  mastra env db delete <database>
@@ -0,0 +1,33 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Mastra.getTool()
4
+
5
+ The `.getTool()` method retrieves a tool from the Mastra-level registry by its registration key.
6
+
7
+ ## Usage example
8
+
9
+ Register a tool under the `weather` key, then use that key to retrieve it.
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra'
13
+ import { weatherTool } from './tools/weather-tool'
14
+
15
+ export const mastra = new Mastra({
16
+ tools: {
17
+ weather: weatherTool,
18
+ },
19
+ })
20
+
21
+ const tool = mastra.getTool('weather')
22
+ ```
23
+
24
+ ## Parameters
25
+
26
+ **name** (`TToolName extends keyof TTools`): The registration key of the tool in the Mastra tools registry.
27
+
28
+ ## Related
29
+
30
+ - [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
31
+ - [Mastra class](https://mastra.ai/reference/core/mastra-class)
32
+ - [Mastra.getToolById()](https://mastra.ai/reference/core/getToolById)
33
+ - [Mastra.listTools()](https://mastra.ai/reference/core/listTools)
@@ -0,0 +1,48 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Mastra.getToolById()
4
+
5
+ The `.getToolById()` method first searches the Mastra-level registry for a tool with a matching intrinsic `id`. If no intrinsic ID matches, it treats the value as a registration key.
6
+
7
+ ## Usage example
8
+
9
+ This example uses `weather` as the registration key and `weather-tool` as the tool's intrinsic ID.
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra'
13
+ import { createTool } from '@mastra/core/tools'
14
+ import { z } from 'zod'
15
+
16
+ const weatherTool = createTool({
17
+ id: 'weather-tool',
18
+ description: 'Fetches weather for a location',
19
+ inputSchema: z.object({
20
+ location: z.string(),
21
+ }),
22
+ outputSchema: z.object({
23
+ weather: z.string(),
24
+ }),
25
+ execute: async ({ location }) => ({
26
+ weather: `Weather for ${location}`,
27
+ }),
28
+ })
29
+
30
+ export const mastra = new Mastra({
31
+ tools: {
32
+ weather: weatherTool,
33
+ },
34
+ })
35
+
36
+ const toolById = mastra.getToolById('weather-tool')
37
+ ```
38
+
39
+ ## Parameters
40
+
41
+ **id** (`TTools[TToolName]['id']`): The intrinsic tool ID to find. When no tool has that ID, Mastra uses the value as a registration key.
42
+
43
+ ## Related
44
+
45
+ - [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
46
+ - [Mastra class](https://mastra.ai/reference/core/mastra-class)
47
+ - [Mastra.getTool()](https://mastra.ai/reference/core/getTool)
48
+ - [Mastra.listTools()](https://mastra.ai/reference/core/listTools)
@@ -0,0 +1,38 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Mastra.listTools()
4
+
5
+ The `.listTools()` method returns the tools configured on a Mastra instance. The returned record uses Mastra registration keys and tool instances as values.
6
+
7
+ ## Usage example
8
+
9
+ ```typescript
10
+ import { Mastra } from '@mastra/core/mastra'
11
+ import { weatherTool } from './tools/weather-tool'
12
+
13
+ export const mastra = new Mastra({
14
+ tools: {
15
+ weather: weatherTool,
16
+ },
17
+ })
18
+
19
+ const tools = mastra.listTools()
20
+ const weather = tools?.weather
21
+ ```
22
+
23
+ ## Parameters
24
+
25
+ This method doesn't accept any parameters.
26
+
27
+ ## Returns
28
+
29
+ **tools** (`TTools | undefined`): The Mastra-level tool registry, where each key is a registration key and each value is a tool instance. Returns undefined when no registry is available.
30
+
31
+ This method lists the Mastra-level registry. It doesn't include tools that exist only in a function-based Agent `tools` callback.
32
+
33
+ ## Related
34
+
35
+ - [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
36
+ - [Mastra class](https://mastra.ai/reference/core/mastra-class)
37
+ - [Mastra.getTool()](https://mastra.ai/reference/core/getTool)
38
+ - [Mastra.getToolById()](https://mastra.ai/reference/core/getToolById)
@@ -53,7 +53,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
53
53
 
54
54
  **agents** (`Record<string, Agent>`): Agent instances to register, keyed by name (Default: `{}`)
55
55
 
56
- **tools** (`Record<string, ToolApi>`): Custom tools to register. Structured as a key-value pair, with keys being the tool name and values being the tool function. (Default: `{}`)
56
+ **tools** (`Record<string, ToolApi>`): Tool instances to register. Keys are registration keys used by \`getTool()\`, and values are tool instances. Use \`getToolById()\` for intrinsic ID lookup and \`listTools()\` to read the registry. (Default: `{}`)
57
57
 
58
58
  **storage** (`MastraCompositeStore`): Storage engine instance for persisting data
59
59
 
@@ -19,7 +19,7 @@ export default new PinoLogger({
19
19
  })
20
20
  ```
21
21
 
22
- Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they are wired up.
22
+ Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they're wired up.
23
23
 
24
24
  ## Precedence with code
25
25
 
@@ -97,6 +97,8 @@ The Reference section provides documentation of Mastra's API, including paramete
97
97
  - [.getServer()](https://mastra.ai/reference/core/getServer)
98
98
  - [.getStorage()](https://mastra.ai/reference/core/getStorage)
99
99
  - [.getTelemetry()](https://mastra.ai/reference/core/getTelemetry)
100
+ - [.getTool()](https://mastra.ai/reference/core/getTool)
101
+ - [.getToolById()](https://mastra.ai/reference/core/getToolById)
100
102
  - [.getVector()](https://mastra.ai/reference/core/getVector)
101
103
  - [.getWorkflow()](https://mastra.ai/reference/core/getWorkflow)
102
104
  - [.listAgents()](https://mastra.ai/reference/core/listAgents)
@@ -106,6 +108,7 @@ The Reference section provides documentation of Mastra's API, including paramete
106
108
  - [.listMCPServers()](https://mastra.ai/reference/core/listMCPServers)
107
109
  - [.listMemory()](https://mastra.ai/reference/core/listMemory)
108
110
  - [.listScorers()](https://mastra.ai/reference/core/listScorers)
111
+ - [.listTools()](https://mastra.ai/reference/core/listTools)
109
112
  - [.listVectors()](https://mastra.ai/reference/core/listVectors)
110
113
  - [.listWorkflows()](https://mastra.ai/reference/core/listWorkflows)
111
114
  - [.removeWorkspace()](https://mastra.ai/reference/core/removeWorkspace)
@@ -131,7 +131,7 @@ bun x mastra migrate
131
131
 
132
132
  The migration copies span data from `mastra_ai_spans` into `mastra_span_events` in day-sized batches. It handles column mapping, deduplicates legacy rows, and preserves the original table as a backup. After migration, traces appear in Studio through the vNext adapter.
133
133
 
134
- > **Note:** The legacy table is not deleted. Drop it manually after verifying the migration.
134
+ > **Note:** The legacy table isn't deleted. Drop it manually after verifying the migration.
135
135
 
136
136
  ### ClickHouse for every domain
137
137
 
@@ -50,6 +50,7 @@ import {
50
50
  mastraResourcesTable,
51
51
  mastraWorkflowSnapshotsTable,
52
52
  mastraScoresTable,
53
+ mastraObservationalMemoryTable,
53
54
  mastraVectorIndexesTable,
54
55
  mastraVectorsTable,
55
56
  mastraCacheTable,
@@ -63,6 +64,7 @@ export default defineSchema({
63
64
  mastra_resources: mastraResourcesTable,
64
65
  mastra_workflow_snapshots: mastraWorkflowSnapshotsTable,
65
66
  mastra_scorers: mastraScoresTable,
67
+ mastra_observational_memory: mastraObservationalMemoryTable,
66
68
  mastra_vector_indexes: mastraVectorIndexesTable,
67
69
  mastra_vectors: mastraVectorsTable,
68
70
  mastra_cache: mastraCacheTable,
@@ -192,16 +194,21 @@ Use a non-empty `keyPrefix` unless you intentionally want `clear()` to remove ev
192
194
 
193
195
  The storage implementation uses typed Convex tables for each Mastra domain:
194
196
 
195
- | Domain | Convex Table | Purpose |
196
- | ----------- | --------------------------- | ----------------------------------------- |
197
- | Threads | `mastra_threads` | Conversation threads |
198
- | Messages | `mastra_messages` | Chat messages |
199
- | Resources | `mastra_resources` | User working memory |
200
- | Workflows | `mastra_workflow_snapshots` | Workflow state |
201
- | Scorers | `mastra_scorers` | Evaluation data |
202
- | Cache | `mastra_cache` | Cache values, counters, and list metadata |
203
- | Cache Items | `mastra_cache_list_items` | Cache list entries |
204
- | Fallback | `mastra_documents` | Unknown tables |
197
+ | Domain | Convex Table | Purpose |
198
+ | -------------------- | ----------------------------- | ----------------------------------------- |
199
+ | Threads | `mastra_threads` | Conversation threads |
200
+ | Messages | `mastra_messages` | Chat messages |
201
+ | Resources | `mastra_resources` | User working memory |
202
+ | Observational Memory | `mastra_observational_memory` | Observational memory generations |
203
+ | Workflows | `mastra_workflow_snapshots` | Workflow state |
204
+ | Scorers | `mastra_scorers` | Evaluation data |
205
+ | Cache | `mastra_cache` | Cache values, counters, and list metadata |
206
+ | Cache Items | `mastra_cache_list_items` | Cache list entries |
207
+ | Fallback | `mastra_documents` | Unknown tables |
208
+
209
+ ### Observational memory
210
+
211
+ `ConvexStore` supports [observational memory](https://mastra.ai/docs/memory/observational-memory). Add `mastraObservationalMemoryTable` to your Convex schema and redeploy with `npx convex deploy` to enable it. Existing deployments created before this table was added need the same schema update.
205
212
 
206
213
  ### Architecture
207
214
 
@@ -228,7 +228,7 @@ const storage = new MongoDBStore({
228
228
  })
229
229
  ```
230
230
 
231
- > **Tip:** TTL indexes delete documents shortly after they expire (background thread runs every \~60 seconds), but the exact timing is not guaranteed. For precise, immediate cleanup, use `prune()` instead.
231
+ > **Tip:** TTL indexes delete documents shortly after they expire (background thread runs every \~60 seconds), but the exact timing isn't guaranteed. For precise, immediate cleanup, use `prune()` instead.
232
232
 
233
233
  ## Reclaiming disk
234
234
 
@@ -85,7 +85,7 @@ At least one of `content`, `status`, or `activeForm` is required.
85
85
  ### Behavior
86
86
 
87
87
  - When the update sets a task to `in_progress`, any other `in_progress` task is automatically demoted to `pending`.
88
- - Returns an error with available task IDs when the ID is not found.
88
+ - Returns an error with available task IDs when the ID isn't found.
89
89
 
90
90
  ## `task_complete`
91
91
 
@@ -97,7 +97,7 @@ Mark one task completed by its stable ID.
97
97
 
98
98
  ### Behavior
99
99
 
100
- Returns an error with available task IDs when the ID is not found.
100
+ Returns an error with available task IDs when the ID isn't found.
101
101
 
102
102
  ## `task_check`
103
103
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.8-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`8a0d145`](https://github.com/mastra-ai/mastra/commit/8a0d145aadbdf7278665aceaaec364b35dd9bd94), [`bd2f1d2`](https://github.com/mastra-ai/mastra/commit/bd2f1d274d05e60e2366f005ea0d94d5cea0d5ff), [`21a0eb8`](https://github.com/mastra-ai/mastra/commit/21a0eb86746ba0b703acea360d4f84c6a5a493f2), [`de86fd7`](https://github.com/mastra-ai/mastra/commit/de86fd7119f0438381d1a642e3d258143c0b9c29), [`2745031`](https://github.com/mastra-ai/mastra/commit/2745031d1d4a4978f037092da371428c32e2842a), [`db650ce`](https://github.com/mastra-ai/mastra/commit/db650ce490348914e85b93651d83acdf8f2a4c31), [`6354eeb`](https://github.com/mastra-ai/mastra/commit/6354eeb32efa9f5f68f51dda394e90e2ee76f1fb)]:
8
+ - @mastra/core@1.51.1-alpha.0
9
+
3
10
  ## 1.2.7
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.2.8-alpha.0",
3
+ "version": "1.2.8-alpha.2",
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/mcp": "^1.14.0",
32
- "@mastra/core": "1.51.0"
31
+ "@mastra/core": "1.51.1-alpha.0",
32
+ "@mastra/mcp": "^1.14.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.11",
@@ -45,9 +45,9 @@
45
45
  "tsx": "^4.22.4",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "4.1.10",
48
- "@internal/types-builder": "0.0.89",
49
48
  "@internal/lint": "0.0.114",
50
- "@mastra/core": "1.51.0"
49
+ "@internal/types-builder": "0.0.89",
50
+ "@mastra/core": "1.51.1-alpha.0"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {