@mastra/mcp-docs-server 1.1.21-alpha.7 → 1.1.22-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -195,13 +195,41 @@ const workspace = new Workspace({
195
195
 
196
196
  ### Tool options
197
197
 
198
- | Option | Type | Description |
199
- | ------------------------ | --------- | ---------------------------------------------------------------------------------------------------------- |
200
- | `enabled` | `boolean` | Whether the tool is available (default: `true`) |
201
- | `requireApproval` | `boolean` | Whether the tool requires user approval before execution (default: `false`) |
202
- | `requireReadBeforeWrite` | `boolean` | For write tools: require reading the file first (default: `false`) |
203
- | `name` | `string` | Custom name for the tool. Replaces the default `mastra_workspace_*` name. |
204
- | `maxOutputTokens` | `number` | Maximum tokens for tool output (default: `2000`). Output exceeding this limit is truncated using tiktoken. |
198
+ | Option | Type | Description |
199
+ | ------------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
200
+ | `enabled` | `boolean \| (context) => boolean` | Whether the tool is available (default: `true`). When a function, evaluated at tool-listing time. |
201
+ | `requireApproval` | `boolean \| (context) => boolean` | Whether the tool requires user approval before execution (default: `false`). When a function, evaluated at execution time with access to `args`. |
202
+ | `requireReadBeforeWrite` | `boolean \| (context) => boolean` | For write tools: require reading the file first (default: `false`). When a function, evaluated at execution time with access to `args`. |
203
+ | `name` | `string` | Custom name for the tool. Replaces the default `mastra_workspace_*` name. |
204
+ | `maxOutputTokens` | `number` | Maximum tokens for tool output (default: `2000`). Output exceeding this limit is truncated using tiktoken. |
205
+
206
+ ### Dynamic tool configuration
207
+
208
+ Tool options that accept functions receive a context object and return a boolean. This enables context-aware tool behavior.
209
+
210
+ ```typescript
211
+ const workspace = new Workspace({
212
+ filesystem: new LocalFilesystem({ basePath: './workspace' }),
213
+ tools: {
214
+ // Dynamic enabled: disable command execution unless explicitly allowed
215
+ [WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND]: {
216
+ enabled: async ({ requestContext }) => {
217
+ return requestContext['allowExecution'] === 'true'
218
+ },
219
+ },
220
+
221
+ // Dynamic requireApproval: only require approval for protected paths
222
+ [WORKSPACE_TOOLS.FILESYSTEM.WRITE_FILE]: {
223
+ requireApproval: async ({ args }) => {
224
+ return (args.path as string).startsWith('/protected')
225
+ },
226
+ requireReadBeforeWrite: true,
227
+ },
228
+ },
229
+ })
230
+ ```
231
+
232
+ Functions for `enabled` receive `{ requestContext, workspace }`. Functions for `requireApproval` and `requireReadBeforeWrite` also receive `args` since they are evaluated when the tool is called.
205
233
 
206
234
  ### Tool name remapping
207
235
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.1.22-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`ed425d7`](https://github.com/mastra-ai/mastra/commit/ed425d78e7c66cbda8209fee910856f98c6c6b82), [`ba6f7e9`](https://github.com/mastra-ai/mastra/commit/ba6f7e9086d8281393f2acae60fda61de3bff1f9), [`7eb2596`](https://github.com/mastra-ai/mastra/commit/7eb25960d607e07468c9a10c5437abd2deaf1e9a)]:
8
+ - @mastra/core@1.23.0-alpha.0
9
+
10
+ ## 1.1.21
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`81e4259`](https://github.com/mastra-ai/mastra/commit/81e425939b4ceeb4f586e9b6d89c3b1c1f2d2fe7), [`951b8a1`](https://github.com/mastra-ai/mastra/commit/951b8a1b5ef7e1474c59dc4f2b9fc1a8b1e508b6), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`2b4ea10`](https://github.com/mastra-ai/mastra/commit/2b4ea10b053e4ea1ab232d536933a4a3c4cba999), [`a0544f0`](https://github.com/mastra-ai/mastra/commit/a0544f0a1e6bd52ac12676228967c1938e43648d), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054), [`c8c86aa`](https://github.com/mastra-ai/mastra/commit/c8c86aa1458017fbd1c0776fdc0c520d129df8a6)]:
15
+ - @mastra/core@1.22.0
16
+
3
17
  ## 1.1.21-alpha.7
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.1.21-alpha.7",
3
+ "version": "1.1.22-alpha.0",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "local-pkg": "^1.1.2",
31
31
  "zod": "^4.3.6",
32
32
  "@mastra/mcp": "^1.4.1",
33
- "@mastra/core": "1.22.0-alpha.3"
33
+ "@mastra/core": "1.23.0-alpha.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@hono/node-server": "^1.19.11",
@@ -46,9 +46,9 @@
46
46
  "tsx": "^4.21.0",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "4.0.18",
49
- "@internal/lint": "0.0.78",
50
- "@internal/types-builder": "0.0.53",
51
- "@mastra/core": "1.22.0-alpha.3"
49
+ "@internal/lint": "0.0.79",
50
+ "@internal/types-builder": "0.0.54",
51
+ "@mastra/core": "1.23.0-alpha.0"
52
52
  },
53
53
  "homepage": "https://mastra.ai",
54
54
  "repository": {