@mastra/mcp-docs-server 1.3.5-alpha.12 → 1.3.5-alpha.18
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/overview.md +1 -1
- package/.docs/docs/auth/composite-auth.md +1 -1
- package/.docs/docs/auth/custom-auth-provider.md +28 -22
- package/.docs/docs/auth/jwt.md +1 -1
- package/.docs/docs/auth/overview.md +2 -2
- package/.docs/docs/auth/simple-auth.md +6 -1
- package/.docs/docs/browser.md +1 -2
- package/.docs/docs/deployment/overview.md +1 -1
- package/.docs/docs/deployment/web-framework.md +1 -1
- package/.docs/docs/evals/built-in-scorers.md +2 -2
- package/.docs/docs/guides/overview.md +15 -0
- package/.docs/docs/harness/agent-controller.md +7 -10
- package/.docs/docs/mastra-platform/configuration.md +1 -1
- package/.docs/docs/observability/overview.md +0 -5
- package/.docs/docs/sandbox/filesystem.md +12 -12
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/integrations/voice/livekit.md +449 -2
- package/.docs/models/gateways/netlify.md +2 -1
- package/.docs/models/gateways/openrouter.md +3 -1
- package/.docs/models/gateways/vercel.md +9 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/aki-io.md +12 -12
- package/.docs/models/providers/edenai.md +15 -13
- package/.docs/models/providers/kilo.md +8 -7
- package/.docs/models/providers/llmgateway-providers.md +4 -1
- package/.docs/models/providers/llmgateway.md +2 -1
- package/.docs/models/providers/mistral.md +7 -6
- package/.docs/models/providers/nano-gpt.md +10 -11
- package/.docs/models/providers/opencode-go.md +2 -2
- package/.docs/models/providers/opencode.md +3 -1
- package/.docs/models/providers/requesty.md +3 -1
- package/.docs/models/providers/the-grid-ai.md +19 -12
- package/.docs/models/providers/wandb.md +4 -13
- package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
- package/.docs/reference/agent-controller/session.md +18 -11
- package/.docs/reference/agents/createSkill.md +1 -2
- package/.docs/reference/agents/getModel.md +1 -1
- package/.docs/reference/agents/getSkill.md +6 -1
- package/.docs/reference/agents/listSkills.md +0 -1
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +13 -11
- package/.docs/reference/cli/create-mastra.md +1 -1
- package/.docs/reference/client-js/agent-controller.md +19 -3
- package/.docs/reference/client-js/conversations.md +1 -1
- package/.docs/reference/client-js/mastra-client.md +2 -2
- package/.docs/reference/client-js/workflows.md +18 -2
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/memory/observational-memory.md +2 -0
- package/.docs/reference/tools/mcp-server.md +1 -1
- package/.docs/reference/vectors/lance.md +56 -10
- package/package.json +5 -5
|
@@ -459,7 +459,7 @@ const mode = session.mode.resolve()
|
|
|
459
459
|
|
|
460
460
|
### `session.mode.switch({ modeId })`
|
|
461
461
|
|
|
462
|
-
Switch to another mode
|
|
462
|
+
Switch to another mode and persist the mode on the active thread. The session emits `mode_changed`. Switching modes doesn't change the active model; switch the model separately when your host assigns different models to different modes.
|
|
463
463
|
|
|
464
464
|
```typescript
|
|
465
465
|
await session.mode.switch({ modeId: 'build' })
|
|
@@ -467,7 +467,7 @@ await session.mode.switch({ modeId: 'build' })
|
|
|
467
467
|
|
|
468
468
|
## Model
|
|
469
469
|
|
|
470
|
-
`session.model` owns the active model selection
|
|
470
|
+
`session.model` owns the session's single active model selection.
|
|
471
471
|
|
|
472
472
|
### `session.model.get()`
|
|
473
473
|
|
|
@@ -495,21 +495,28 @@ if (session.model.hasSelection()) {
|
|
|
495
495
|
}
|
|
496
496
|
```
|
|
497
497
|
|
|
498
|
-
### `session.model.
|
|
498
|
+
### `session.model.set({ modelId })`
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
Set the active model in memory without persisting it, reporting model use, or emitting a `model_changed` event.
|
|
501
501
|
|
|
502
502
|
```typescript
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
503
|
+
session.model.set({ modelId: 'anthropic/claude-sonnet-4-6' })
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### `session.model.switch(modelId, options?)`
|
|
507
|
+
|
|
508
|
+
Switch the session's active model. The model ID is persisted as the thread's `currentModelId` and restored with that thread. Reports the selection to the controller's `modelUseCountTracker` and emits a `model_changed` event.
|
|
508
509
|
|
|
509
|
-
|
|
510
|
-
|
|
510
|
+
Pass `{ thinkingLevel }` as the second argument to switch and persist both values in one operation. The level must be `'off'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, or `'max'`, and the controller's state schema must accept it. Both live values are updated before events are emitted. Omitting the option preserves the existing thinking-level override. Every `model_changed` event includes the current `{ modelId, thinkingLevel }`, even when the thinking level is unchanged. The level is `undefined` when the session has no override.
|
|
511
|
+
|
|
512
|
+
```typescript
|
|
513
|
+
await session.model.switch('anthropic/claude-sonnet-4-6', {
|
|
514
|
+
thinkingLevel: 'high',
|
|
515
|
+
})
|
|
511
516
|
```
|
|
512
517
|
|
|
518
|
+
The client SDK exposes the same operation as `session.switchModel(modelId, { thinkingLevel })`.
|
|
519
|
+
|
|
513
520
|
## Observational Memory
|
|
514
521
|
|
|
515
522
|
The observational-memory model selection, grouped by role under `session.om.observer` and `session.om.reflector`. Both roles expose the same methods. Reads return the value from session state when set, falling back to the controller's `omConfig` defaults.
|
|
@@ -65,12 +65,11 @@ The skill is assigned a synthetic path of `inline/<name>` (e.g., `inline/code-re
|
|
|
65
65
|
|
|
66
66
|
- `name` is required and must be a valid slug
|
|
67
67
|
- `description` is required
|
|
68
|
-
- `instructions` is required and non-empty
|
|
69
68
|
|
|
70
69
|
If validation fails, an `Error` is thrown with details about the invalid fields.
|
|
71
70
|
|
|
72
71
|
```typescript
|
|
73
|
-
// Throws: Invalid skill "": name
|
|
72
|
+
// Throws: Invalid skill "": name: Skill name cannot be empty
|
|
74
73
|
createSkill({ name: '', description: 'test', instructions: 'test' })
|
|
75
74
|
```
|
|
76
75
|
|
|
@@ -20,7 +20,7 @@ await agent.getModel()
|
|
|
20
20
|
|
|
21
21
|
## Returns
|
|
22
22
|
|
|
23
|
-
**model** (`MastraLanguageModel | Promise<MastraLanguageModel>`): The language model configured for the agent, either as a direct instance or a promise that resolves to the model.
|
|
23
|
+
**model** (`MastraLanguageModel | MastraLegacyLanguageModel | Promise<MastraLanguageModel | MastraLegacyLanguageModel>`): The language model configured for the agent, either as a direct instance or a promise that resolves to the model.
|
|
24
24
|
|
|
25
25
|
## Extended usage example
|
|
26
26
|
|
|
@@ -40,7 +40,10 @@ interface Skill {
|
|
|
40
40
|
description: string
|
|
41
41
|
instructions: string
|
|
42
42
|
path: string
|
|
43
|
-
source:
|
|
43
|
+
source:
|
|
44
|
+
| { type: 'external'; packagePath: string }
|
|
45
|
+
| { type: 'local'; projectPath: string }
|
|
46
|
+
| { type: 'managed'; mastraPath: string }
|
|
44
47
|
references: string[]
|
|
45
48
|
scripts: string[]
|
|
46
49
|
assets: string[]
|
|
@@ -51,6 +54,8 @@ interface Skill {
|
|
|
51
54
|
}
|
|
52
55
|
```
|
|
53
56
|
|
|
57
|
+
`source` describes where Mastra discovered the skill. Skills from a path with a `node_modules` segment are `external`, skills under `.mastra/skills` are `managed`, and all other skills, including those created with [`createSkill()`](https://mastra.ai/reference/agents/createSkill), are `local`.
|
|
58
|
+
|
|
54
59
|
## Merging behavior
|
|
55
60
|
|
|
56
61
|
When both agent-level skills and workspace skills are configured, `.getSkill()` searches the merged set. Agent-level skills take precedence on name conflicts.
|
|
@@ -23,7 +23,7 @@ export const mastra = new Mastra({
|
|
|
23
23
|
|
|
24
24
|
## Constructor parameters
|
|
25
25
|
|
|
26
|
-
**secret** (`string`): A unique string used to sign and verify JSON Web Tokens (JWTs) for authenticating incoming requests.
|
|
26
|
+
**secret** (`string`): A unique string used to sign and verify JSON Web Tokens (JWTs) for authenticating incoming requests. Falls back to JWT\_AUTH\_SECRET when omitted. The resolved secret must be non-empty: the constructor throws an error if neither is set, or if this option is an empty string (an empty string does not fall back to JWT\_AUTH\_SECRET). (Default: `process.env.JWT_AUTH_SECRET`)
|
|
27
27
|
|
|
28
28
|
## Related
|
|
29
29
|
|
|
@@ -30,7 +30,7 @@ export const mastra = new Mastra({
|
|
|
30
30
|
|
|
31
31
|
**name** (`string`): Custom name for the auth provider instance.
|
|
32
32
|
|
|
33
|
-
**authorizeUser** (`(user: User, request:
|
|
33
|
+
**authorizeUser** (`(user: User, request: MastraAuthRequest) => Promise<boolean> | boolean`): Custom authorization function to determine if a user should be granted access. Called after token verification. By default, checks the 'isAdmin' column in the 'users' table.
|
|
34
34
|
|
|
35
35
|
## Related
|
|
36
36
|
|
|
@@ -157,12 +157,12 @@ const tools = browser.getTools()
|
|
|
157
157
|
|
|
158
158
|
### Screencast
|
|
159
159
|
|
|
160
|
-
#### `startScreencast(options
|
|
160
|
+
#### `startScreencast(options?)`
|
|
161
161
|
|
|
162
162
|
Starts streaming browser frames. Returns a `ScreencastStream` that emits frame events.
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
|
-
const stream = await browser.startScreencast({ format: 'jpeg', quality: 80 }
|
|
165
|
+
const stream = await browser.startScreencast({ format: 'jpeg', quality: 80 })
|
|
166
166
|
|
|
167
167
|
stream.on('frame', frame => {
|
|
168
168
|
console.log('Frame received:', frame.data.length, 'bytes')
|
|
@@ -205,29 +205,31 @@ await browser.injectKeyboardEvent({
|
|
|
205
205
|
|
|
206
206
|
### State
|
|
207
207
|
|
|
208
|
-
#### `
|
|
208
|
+
#### `getBrowserState(threadId?)`
|
|
209
209
|
|
|
210
|
-
Gets the current browser state including
|
|
210
|
+
Gets the current browser state, including open tabs and the active tab index. Returns `null` when no state is available.
|
|
211
211
|
|
|
212
212
|
```typescript
|
|
213
|
-
const state = await browser.
|
|
214
|
-
|
|
215
|
-
console.log('
|
|
213
|
+
const state = await browser.getBrowserState('thread-123')
|
|
214
|
+
if (state) {
|
|
215
|
+
console.log('Active tab:', state.tabs[state.activeTabIndex]?.url)
|
|
216
|
+
console.log('Tabs:', state.tabs)
|
|
217
|
+
}
|
|
216
218
|
```
|
|
217
219
|
|
|
218
|
-
**Returns:** `Promise<BrowserState>`
|
|
220
|
+
**Returns:** `Promise<BrowserState | null>`
|
|
219
221
|
|
|
220
222
|
```typescript
|
|
221
223
|
interface BrowserState {
|
|
222
|
-
currentUrl: string | null
|
|
223
224
|
tabs: BrowserTabState[]
|
|
224
225
|
activeTabIndex: number
|
|
226
|
+
closeReason?: 'agent' | 'user' | 'process_restart' | 'error'
|
|
227
|
+
activeUrlChangeSource?: 'agent' | 'user'
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
interface BrowserTabState {
|
|
228
|
-
id: string
|
|
229
231
|
url: string
|
|
230
|
-
title
|
|
232
|
+
title?: string
|
|
231
233
|
}
|
|
232
234
|
```
|
|
233
235
|
|
|
@@ -187,7 +187,7 @@ Use `--no-skills` or `--no-git` to skip these steps. Skills and Git setup failur
|
|
|
187
187
|
- `--llm` and `--llm-api-key` are only valid for the default starter project.
|
|
188
188
|
- The project name must be a safe, lowercase, single directory name and the target must not already exist.
|
|
189
189
|
|
|
190
|
-
Invalid
|
|
190
|
+
Invalid flags, project names, and GitHub URLs are rejected before any project files are created. An unknown template name is rejected after the template list is fetched, and the CLI prints the available templates.
|
|
191
191
|
|
|
192
192
|
## Arguments and flags
|
|
193
193
|
|
|
@@ -39,12 +39,22 @@ Retrieve the agent controllers hosted on the connected Mastra instance:
|
|
|
39
39
|
const controllers = await client.listAgentControllers()
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
Each entry's `id` is the key the controller is registered under in `new Mastra({ agentControllers })`, not the controller's own `id`.
|
|
43
|
+
|
|
42
44
|
## Working with a specific agent controller
|
|
43
45
|
|
|
44
|
-
Get an instance of an agent controller by the
|
|
46
|
+
Get an instance of an agent controller by the key it's registered under in `new Mastra({ agentControllers })`. The key can differ from the controller's `id`. In this example, pass `'coding'`, not `'coding-controller'`:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const codingController = new AgentController({ id: 'coding-controller', agent, modes })
|
|
50
|
+
|
|
51
|
+
export const mastra = new Mastra({
|
|
52
|
+
agentControllers: { coding: codingController },
|
|
53
|
+
})
|
|
54
|
+
```
|
|
45
55
|
|
|
46
56
|
```typescript
|
|
47
|
-
const controller = client.getAgentController('coding
|
|
57
|
+
const controller = client.getAgentController('coding')
|
|
48
58
|
```
|
|
49
59
|
|
|
50
60
|
### `listModes()`
|
|
@@ -155,7 +165,13 @@ Switches the active mode.
|
|
|
155
165
|
|
|
156
166
|
### `switchModel(modelId, options?)`
|
|
157
167
|
|
|
158
|
-
Switches the model
|
|
168
|
+
Switches the session's active model and persists it as the current model for the active thread. Switching modes doesn't change it. Pass `{ thinkingLevel }` as the second argument to apply and persist a thinking level with the model.
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
await session.switchModel('anthropic/claude-sonnet-4-6', {
|
|
172
|
+
thinkingLevel: 'high',
|
|
173
|
+
})
|
|
174
|
+
```
|
|
159
175
|
|
|
160
176
|
### `listThreads(options?)`
|
|
161
177
|
|
|
@@ -122,7 +122,7 @@ console.log(items.data)
|
|
|
122
122
|
- `data`: Conversation items such as `message`, `function_call`, and `function_call_output`
|
|
123
123
|
- `first_id`: The first item ID in the page
|
|
124
124
|
- `last_id`: The last item ID in the page
|
|
125
|
-
- `has_more`:
|
|
125
|
+
- `has_more`: Currently always `false`. `items.list()` returns up to 1000 items in a single response.
|
|
126
126
|
|
|
127
127
|
## Parameters
|
|
128
128
|
|
|
@@ -59,9 +59,9 @@ You can also pass `requestContext` as a `Record<string, any>`.
|
|
|
59
59
|
|
|
60
60
|
**getAgent(agentId)** (`Agent`): Retrieves a specific agent instance by ID.
|
|
61
61
|
|
|
62
|
-
**listAgentControllers()** (`Promise<AgentControllerInfo[]>`): Returns the agent controllers hosted on the connected Mastra instance.
|
|
62
|
+
**listAgentControllers()** (`Promise<AgentControllerInfo[]>`): Returns the agent controllers hosted on the connected Mastra instance. Each entry's id is the key the controller is registered under in new Mastra({ agentControllers }).
|
|
63
63
|
|
|
64
|
-
**getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by
|
|
64
|
+
**getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by the key it is registered under in new Mastra({ agentControllers }), which can differ from the controller id. .session(resourceId) returns a session client; call await session.create() to create or resume the server session.
|
|
65
65
|
|
|
66
66
|
**listMemoryThreads(params)** (`Promise<StorageThreadType[]>`): Retrieves memory threads for the specified resource and agent. Requires a resourceId and an agentId.
|
|
67
67
|
|
|
@@ -223,9 +223,25 @@ A workflow run result yields the following:
|
|
|
223
223
|
|
|
224
224
|
**runId** (`string`): Unique identifier for this workflow run instance
|
|
225
225
|
|
|
226
|
-
**
|
|
226
|
+
**workflowName** (`string`): Name of the workflow this run belongs to
|
|
227
227
|
|
|
228
|
-
**
|
|
228
|
+
**resourceId** (`string`): Resource ID associated with the run, if one was set
|
|
229
|
+
|
|
230
|
+
**createdAt** (`string`): ISO 8601 timestamp of when the run was created
|
|
231
|
+
|
|
232
|
+
**updatedAt** (`string`): ISO 8601 timestamp of when the run was last updated
|
|
233
|
+
|
|
234
|
+
**status** (`WorkflowRunStatus`): Current status of the run, such as 'running', 'success', 'failed', 'suspended', 'waiting', or 'canceled'
|
|
235
|
+
|
|
236
|
+
**payload** (`Record<string, any>`): Input data the run was started with
|
|
237
|
+
|
|
238
|
+
**result** (`Record<string, any>`): Final output of the workflow when the run succeeded
|
|
239
|
+
|
|
240
|
+
**error** (`SerializedError`): Error details when the run failed
|
|
241
|
+
|
|
242
|
+
**steps** (`Record<string, WorkflowStateStepResult>`): Per-step results, including status, output, payload, and timing
|
|
243
|
+
|
|
244
|
+
Use the `fields` option to limit which optional fields are returned. Metadata fields and `status` are always included.
|
|
229
245
|
|
|
230
246
|
## Dynamic workflows
|
|
231
247
|
|
|
@@ -58,7 +58,7 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
|
|
|
58
58
|
|
|
59
59
|
**mastra** (`Mastra`): Existing Mastra instance to mount onto. When omitted, a Mastra is created that owns the controller storage.
|
|
60
60
|
|
|
61
|
-
**controllerId** (`string`):
|
|
61
|
+
**controllerId** (`string`): Key the controller is registered under on the Mastra instance. Clients pass this key to client.getAgentController(). (Default: `controller.id`)
|
|
62
62
|
|
|
63
63
|
**modes** (`AgentControllerMode[]`): Override agent modes (model ids, colors, which modes exist). (Default: `build/plan/fast`)
|
|
64
64
|
|
|
@@ -592,6 +592,8 @@ Emitted when observation or reflection fails. The system falls back to synchrono
|
|
|
592
592
|
|
|
593
593
|
**error** (`string`): Error message.
|
|
594
594
|
|
|
595
|
+
**retrying** (`true`): Set when a reflection attempt did not compress below its target and OM is retrying at a higher compression level. A new start marker follows, so this failure is not final. Absent on final failures.
|
|
596
|
+
|
|
595
597
|
**observations** (`string`): Any partial content available for display.
|
|
596
598
|
|
|
597
599
|
**recordId** (`string`): The OM record ID.
|
|
@@ -1395,7 +1395,7 @@ const server = new MCPServer({
|
|
|
1395
1395
|
})
|
|
1396
1396
|
```
|
|
1397
1397
|
|
|
1398
|
-
Link a tool to its app resource by setting `mcp._meta.ui.resourceUri` in `createTool()` to the matching `ui://` URI. The server normalizes this metadata for older hosts when listing tools. Visit [MCP Apps](https://mastra.ai/docs/connections/mcp) for the full app bridge API and usage patterns.
|
|
1398
|
+
Link a tool to its app resource by setting `mcp._meta.ui.resourceUri` in `createTool()` to the matching `ui://` URI. The server normalizes this metadata for older hosts when listing tools, and returns the same link on successful tool call results. Visit [MCP Apps](https://mastra.ai/docs/connections/mcp) for the full app bridge API and usage patterns.
|
|
1399
1399
|
|
|
1400
1400
|
## Related information
|
|
1401
1401
|
|
|
@@ -49,15 +49,17 @@ const s3Store = await LanceVectorStore.create('s3://bucket/db', {
|
|
|
49
49
|
|
|
50
50
|
#### `LanceIndexConfig`
|
|
51
51
|
|
|
52
|
-
**type** (`'ivfflat' | 'hnsw'`): Index type (Default: `hnsw`)
|
|
52
|
+
**type** (`'ivfflat' | 'ivfpq' | 'hnsw'`): Index type (Default: `hnsw`)
|
|
53
53
|
|
|
54
|
-
**type.ivfflat** (`ivfflat`): Clusters vectors into
|
|
54
|
+
**type.ivfflat** (`ivfflat`): Clusters vectors into partitions and stores full vectors. Searches compute exact distances only within the probed partitions, so closer vectors in other partitions can be missed.
|
|
55
|
+
|
|
56
|
+
**type.ivfpq** (`ivfpq`): IVF index with product quantization. Uses less memory than ivfflat with lower recall.
|
|
55
57
|
|
|
56
58
|
**type.hnsw** (`hnsw`): Graph-based index offering fast search times and high recall.
|
|
57
59
|
|
|
58
60
|
**numPartitions** (`number`): Number of partitions for IVF indexes (Default: `128`)
|
|
59
61
|
|
|
60
|
-
**numSubVectors** (`number`): Number of sub-vectors for product quantization (Default: `16`)
|
|
62
|
+
**numSubVectors** (`number`): Number of sub-vectors for product quantization. Only applies to ivfpq (Default: `16`)
|
|
61
63
|
|
|
62
64
|
**hnsw** (`HNSWConfig`): HNSW configuration
|
|
63
65
|
|
|
@@ -137,16 +139,60 @@ interface IndexStats {
|
|
|
137
139
|
dimension: number
|
|
138
140
|
count: number
|
|
139
141
|
metric: 'cosine' | 'euclidean' | 'dotproduct'
|
|
140
|
-
type: 'ivfflat' | 'hnsw'
|
|
141
|
-
config: {
|
|
142
|
-
m?: number
|
|
143
|
-
efConstruction?: number
|
|
144
|
-
numPartitions?: number
|
|
145
|
-
numSubVectors?: number
|
|
146
|
-
}
|
|
147
142
|
}
|
|
148
143
|
```
|
|
149
144
|
|
|
145
|
+
### `getIndexCoverage()`
|
|
146
|
+
|
|
147
|
+
**tableName** (`string`): Table to inspect. Defaults to indexName when omitted.
|
|
148
|
+
|
|
149
|
+
**indexName** (`string`): Used as the table name when tableName is omitted, matching upsert() and query().
|
|
150
|
+
|
|
151
|
+
Returns one entry per index on the table:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
interface LanceIndexCoverage {
|
|
155
|
+
indexName: string
|
|
156
|
+
indexType: string
|
|
157
|
+
columns: string[]
|
|
158
|
+
numIndexedRows: number
|
|
159
|
+
numUnindexedRows: number
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### `optimize()`
|
|
164
|
+
|
|
165
|
+
Runs LanceDB table maintenance. It compacts data files, adds rows written since the index was built to the existing index, and removes old table versions. Mastra never calls it automatically. Concurrent calls for the same table in one process share a single run.
|
|
166
|
+
|
|
167
|
+
**tableName** (`string`): Table to optimize. Defaults to indexName when omitted.
|
|
168
|
+
|
|
169
|
+
**indexName** (`string`): Used as the table name when tableName is omitted.
|
|
170
|
+
|
|
171
|
+
**cleanupOlderThan** (`Date`): Remove table versions older than this date. When omitted, LanceDB keeps versions from the last 7 days.
|
|
172
|
+
|
|
173
|
+
**deleteUnverified** (`boolean`): Also delete unverified files newer than 7 days. Only set this when no other process writes to the table, or the table can be corrupted. (Default: `false`)
|
|
174
|
+
|
|
175
|
+
Returns LanceDB `OptimizeStats` (compaction and pruning counts).
|
|
176
|
+
|
|
177
|
+
#### When to optimize
|
|
178
|
+
|
|
179
|
+
`upsert()` writes rows outside the existing vector index. `query()` still returns those rows by scanning them without the index, so results stay complete, but queries get slower as unindexed rows grow. LanceDB's `fastSearch()` skips unindexed rows entirely.
|
|
180
|
+
|
|
181
|
+
`optimize()` adds new rows to the existing index without retraining it. If your data distribution has changed a lot, rebuild the index with `deleteIndex()` and `createIndex()` instead.
|
|
182
|
+
|
|
183
|
+
LanceDB suggests optimizing after roughly 100,000 modified rows or 20 write operations. Use `getIndexCoverage()` to build your own policy:
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
const [coverage] = await store.getIndexCoverage({ indexName: 'docs' })
|
|
187
|
+
const total = coverage.numIndexedRows + coverage.numUnindexedRows
|
|
188
|
+
|
|
189
|
+
if (coverage.numUnindexedRows >= 1_000 && coverage.numUnindexedRows / total >= 0.1) {
|
|
190
|
+
await store.optimize({ indexName: 'docs' })
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Managed LanceDB Cloud and Enterprise maintain tables automatically, so you don't need to call `optimize()` there.
|
|
195
|
+
|
|
150
196
|
### `deleteIndex()`
|
|
151
197
|
|
|
152
198
|
**indexName** (`string`): Name of the index to delete
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.5-alpha.
|
|
3
|
+
"version": "1.3.5-alpha.18",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
|
|
27
27
|
"local-pkg": "^1.1.2",
|
|
28
28
|
"zod": "^4.6.4",
|
|
29
|
-
"@mastra/
|
|
30
|
-
"@mastra/
|
|
29
|
+
"@mastra/mcp": "^2.2.0-alpha.2",
|
|
30
|
+
"@mastra/core": "1.75.0-alpha.8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hono/node-server": "^2.0.0",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"tsx": "^4.23.1",
|
|
44
44
|
"typescript": "^7.0.2",
|
|
45
45
|
"vitest": "4.1.11",
|
|
46
|
-
"@internal/lint": "0.0.140",
|
|
47
46
|
"@internal/types-builder": "0.0.115",
|
|
48
|
-
"@
|
|
47
|
+
"@internal/lint": "0.0.140",
|
|
48
|
+
"@mastra/core": "1.75.0-alpha.8"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://mastra.ai",
|
|
51
51
|
"repository": {
|