@wonderwhy-er/desktop-commander 0.3.1-alpha.2 → 0.3.2-alpha.1
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/LICENSE +20 -20
- package/README.md +1154 -1152
- package/dist/bootstrap.js +0 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/command-manager.js +0 -0
- package/dist/command-manager.js.map +1 -0
- package/dist/config-field-definitions.js +0 -0
- package/dist/config-field-definitions.js.map +1 -0
- package/dist/config-manager.js +0 -0
- package/dist/config-manager.js.map +1 -0
- package/dist/config-recovery.js +0 -0
- package/dist/config-recovery.js.map +1 -0
- package/dist/config.js +0 -0
- package/dist/config.js.map +1 -0
- package/dist/custom-stdio.js +0 -0
- package/dist/custom-stdio.js.map +1 -0
- package/dist/data/onboarding-prompts.json +70 -70
- package/dist/error-handlers.js +0 -0
- package/dist/error-handlers.js.map +1 -0
- package/dist/handlers/edit-search-handlers.js.map +1 -0
- package/dist/handlers/filesystem-handlers.js +2 -2
- package/dist/handlers/filesystem-handlers.js.map +1 -0
- package/dist/handlers/history-handlers.js.map +1 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/process-handlers.js.map +1 -0
- package/dist/handlers/search-answers.js.map +1 -0
- package/dist/handlers/search-handlers.js.map +1 -0
- package/dist/handlers/terminal-handlers.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -0
- package/dist/npm-scripts/remote.js +32 -28
- package/dist/npm-scripts/remote.js.map +1 -0
- package/dist/npm-scripts/setup.js.map +1 -0
- package/dist/npm-scripts/uninstall.js.map +1 -0
- package/dist/npm-scripts/verify-ripgrep.js.map +1 -0
- package/dist/remote-device/desktop-commander-integration.d.ts +1 -0
- package/dist/remote-device/desktop-commander-integration.js.map +1 -0
- package/dist/remote-device/device-authenticator.js.map +1 -0
- package/dist/remote-device/device.d.ts +4 -3
- package/dist/remote-device/device.js +134 -35
- package/dist/remote-device/device.js.map +1 -0
- package/dist/remote-device/diagnostics/device-log.js.map +1 -0
- package/dist/remote-device/diagnostics/redact.js.map +1 -0
- package/dist/remote-device/diagnostics/report.js +2 -1
- package/dist/remote-device/diagnostics/report.js.map +1 -0
- package/dist/remote-device/diagnostics/upload.d.ts +1 -1
- package/dist/remote-device/diagnostics/upload.js +3 -3
- package/dist/remote-device/diagnostics/upload.js.map +1 -0
- package/dist/remote-device/mqtt/config.d.ts +1 -0
- package/dist/remote-device/mqtt/config.js +3 -0
- package/dist/remote-device/mqtt/config.js.map +1 -0
- package/dist/remote-device/mqtt/mqtt-enrollment.d.ts +15 -0
- package/dist/remote-device/mqtt/mqtt-enrollment.js +293 -0
- package/dist/remote-device/mqtt/mqtt-enrollment.js.map +1 -0
- package/dist/remote-device/mqtt/mqtt-transport.d.ts +45 -0
- package/dist/remote-device/mqtt/mqtt-transport.js +276 -0
- package/dist/remote-device/mqtt/mqtt-transport.js.map +1 -0
- package/dist/remote-device/realtime-health-telemetry.d.ts +35 -0
- package/dist/remote-device/realtime-health-telemetry.js +110 -0
- package/dist/remote-device/realtime-health-telemetry.js.map +1 -0
- package/dist/remote-device/remote-channel.d.ts +87 -59
- package/dist/remote-device/remote-channel.js +509 -398
- package/dist/remote-device/remote-channel.js.map +1 -0
- package/dist/remote-device/remote-utils.d.ts +3 -0
- package/dist/remote-device/remote-utils.js +20 -0
- package/dist/remote-device/remote-utils.js.map +1 -0
- package/dist/remote-device/rollouts.d.ts +48 -0
- package/dist/remote-device/rollouts.js +105 -0
- package/dist/remote-device/rollouts.js.map +1 -0
- package/dist/remote-device/scripts/blocking-offline-update.js +135 -133
- package/dist/remote-device/transport-telemetry.d.ts +1 -1
- package/dist/remote-device/transport-telemetry.js +4 -2
- package/dist/remote-device/transport-telemetry.js.map +1 -0
- package/dist/search-manager.js +0 -0
- package/dist/search-manager.js.map +1 -0
- package/dist/server.js +581 -712
- package/dist/server.js.map +1 -0
- package/dist/setup-claude-server.js +942 -942
- package/dist/terminal-manager.js +2 -37
- package/dist/terminal-manager.js.map +1 -0
- package/dist/tools/config.js.map +1 -0
- package/dist/tools/edit.js +2 -2
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/feedback.js.map +1 -0
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/fuzzySearch.js +9 -9
- package/dist/tools/fuzzySearch.js.map +1 -0
- package/dist/tools/fuzzySearchCore.js.map +1 -0
- package/dist/tools/improved-process-tools.js +12 -11
- package/dist/tools/improved-process-tools.js.map +1 -0
- package/dist/tools/mime-types.js.map +1 -0
- package/dist/tools/pdf/extract-images.js +2 -6
- package/dist/tools/pdf/extract-images.js.map +1 -0
- package/dist/tools/pdf/index.js.map +1 -0
- package/dist/tools/pdf/lib/pdf2md.js +28 -33
- package/dist/tools/pdf/lib/pdf2md.js.map +1 -0
- package/dist/tools/pdf/manipulations.js.map +1 -0
- package/dist/tools/pdf/markdown.d.ts +10 -38
- package/dist/tools/pdf/markdown.js.map +1 -0
- package/dist/tools/pdf/utils.d.ts +10 -0
- package/dist/tools/pdf/utils.js +11 -0
- package/dist/tools/pdf/utils.js.map +1 -0
- package/dist/tools/process.js.map +1 -0
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/prompts.js.map +1 -0
- package/dist/tools/schemas.d.ts +0 -10
- package/dist/tools/schemas.js +0 -8
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/usage.js.map +1 -0
- package/dist/track-installation.js +387 -387
- package/dist/types.js +0 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/config-editor/config-editor-runtime.js +61 -80
- package/dist/ui/config-editor/index.html +13 -13
- package/dist/ui/config-editor/src/app.js +30 -30
- package/dist/ui/config-editor/src/app.js.map +1 -0
- package/dist/ui/config-editor/src/array-modal.js +32 -32
- package/dist/ui/config-editor/src/array-modal.js.map +1 -0
- package/dist/ui/config-editor/src/main.js.map +1 -0
- package/dist/ui/config-editor/styles.css +586 -586
- package/dist/ui/contracts.d.ts +27 -0
- package/dist/ui/contracts.js +36 -0
- package/dist/ui/contracts.js.map +1 -0
- package/dist/ui/file-preview/index.html +16 -16
- package/dist/ui/file-preview/preview-runtime.js +221 -231
- package/dist/ui/file-preview/shared/preview-file-types.js.map +1 -0
- package/dist/ui/file-preview/src/app.js +8 -8
- package/dist/ui/file-preview/src/app.js.map +1 -0
- package/dist/ui/file-preview/src/components/code-viewer.js.map +1 -0
- package/dist/ui/file-preview/src/components/highlighting.js.map +1 -0
- package/dist/ui/file-preview/src/components/html-renderer.js +4 -2
- package/dist/ui/file-preview/src/components/html-renderer.js.map +1 -0
- package/dist/ui/file-preview/src/components/markdown-renderer.js.map +1 -0
- package/dist/ui/file-preview/src/directory-controller.js.map +1 -0
- package/dist/ui/file-preview/src/document-layout.js +31 -31
- package/dist/ui/file-preview/src/document-layout.js.map +1 -0
- package/dist/ui/file-preview/src/document-outline.js +8 -8
- package/dist/ui/file-preview/src/document-outline.js.map +1 -0
- package/dist/ui/file-preview/src/document-workspace.js.map +1 -0
- package/dist/ui/file-preview/src/file-type-handlers.js.map +1 -0
- package/dist/ui/file-preview/src/host/external-actions.js.map +1 -0
- package/dist/ui/file-preview/src/host/selection-context.js.map +1 -0
- package/dist/ui/file-preview/src/image-preview.js.map +1 -0
- package/dist/ui/file-preview/src/main.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/conflict-dialog.js +33 -33
- package/dist/ui/file-preview/src/markdown/conflict-dialog.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/controller.js +9 -9
- package/dist/ui/file-preview/src/markdown/controller.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/editor.js +31 -31
- package/dist/ui/file-preview/src/markdown/editor.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/linking.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/outline.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/parser.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/preview.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/slugify.js.map +1 -0
- package/dist/ui/file-preview/src/markdown/utils.js.map +1 -0
- package/dist/ui/file-preview/src/model.js.map +1 -0
- package/dist/ui/file-preview/src/panel-actions.js.map +1 -0
- package/dist/ui/file-preview/src/path-utils.js.map +1 -0
- package/dist/ui/file-preview/src/payload-utils.js.map +1 -0
- package/dist/ui/file-preview/src/types.js.map +1 -0
- package/dist/ui/file-preview/styles.css +1630 -1630
- package/dist/ui/resources.js +11 -4
- package/dist/ui/resources.js.map +1 -0
- package/dist/ui/shared/compact-row.js.map +1 -0
- package/dist/ui/shared/escape-html.js.map +1 -0
- package/dist/ui/shared/host-context.js.map +1 -0
- package/dist/ui/shared/tool-bridge.js.map +1 -0
- package/dist/ui/shared/tool-shell.js.map +1 -0
- package/dist/ui/shared/ui-event-tracker.js.map +1 -0
- package/dist/ui/shared/widget-state.js.map +1 -0
- package/dist/uninstall-claude-server.js +745 -745
- package/dist/utils/ab-test.js.map +1 -0
- package/dist/utils/atomic-write.js.map +1 -0
- package/dist/utils/capture.d.ts +1 -1
- package/dist/utils/capture.js +28 -6
- package/dist/utils/capture.js.map +1 -0
- package/dist/utils/dockerPrompt.js.map +1 -0
- package/dist/utils/exit-process.js.map +1 -0
- package/dist/utils/feature-flags.js.map +1 -0
- package/dist/utils/files/base.js.map +1 -0
- package/dist/utils/files/binary.js +4 -4
- package/dist/utils/files/binary.js.map +1 -0
- package/dist/utils/files/docx.js.map +1 -0
- package/dist/utils/files/excel.js +3 -3
- package/dist/utils/files/excel.js.map +1 -0
- package/dist/utils/files/factory.js.map +1 -0
- package/dist/utils/files/image.js.map +1 -0
- package/dist/utils/files/index.js.map +1 -0
- package/dist/utils/files/pdf.js.map +1 -0
- package/dist/utils/files/text.d.ts +7 -0
- package/dist/utils/files/text.js +40 -21
- package/dist/utils/files/text.js.map +1 -0
- package/dist/utils/fuzzySearchLogger.js.map +1 -0
- package/dist/utils/internal-facts.js.map +1 -0
- package/dist/utils/lazy-package.js.map +1 -0
- package/dist/utils/lineEndingHandler.js.map +1 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-ui-ab-test.js.map +1 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/process-detection.js.map +1 -0
- package/dist/utils/process-tree.js.map +1 -0
- package/dist/utils/rename.js.map +1 -0
- package/dist/utils/ripgrep-resolver.js.map +1 -0
- package/dist/utils/shell.d.ts +11 -0
- package/dist/utils/shell.js +50 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/system-info.d.ts +1 -0
- package/dist/utils/system-info.js +110 -97
- package/dist/utils/system-info.js.map +1 -0
- package/dist/utils/terminal-timestamps.d.ts +2 -0
- package/dist/utils/terminal-timestamps.js +18 -0
- package/dist/utils/terminal-timestamps.js.map +1 -0
- package/dist/utils/toolHistory.js.map +1 -0
- package/dist/utils/trackTools.js.map +1 -0
- package/dist/utils/unsupportedParams.js.map +1 -0
- package/dist/utils/usageTracker.d.ts +0 -39
- package/dist/utils/usageTracker.js +16 -176
- package/dist/utils/usageTracker.js.map +1 -0
- package/dist/utils/welcome-onboarding.js.map +1 -0
- package/dist/utils/withTimeout.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -0
- package/node_modules/@desktop-commander/telemetry-contract/README.md +56 -56
- package/node_modules/@desktop-commander/telemetry-contract/package.json +32 -32
- package/node_modules/@desktop-commander/telemetry-contract/transport.d.ts +39 -38
- package/node_modules/@desktop-commander/telemetry-contract/transport.js +167 -164
- package/package.json +11 -10
- package/vendor/telemetry-contract/README.md +56 -56
- package/vendor/telemetry-contract/package.json +32 -32
- package/vendor/telemetry-contract/transport.d.ts +38 -38
- package/vendor/telemetry-contract/transport.js +164 -164
- package/vendor/telemetry-contract/transport.test.js +39 -39
package/dist/server.js
CHANGED
|
@@ -7,14 +7,19 @@ import { getSystemInfo, getOSSpecificGuidance, getPathGuidance, getDevelopmentTo
|
|
|
7
7
|
const SYSTEM_INFO = getSystemInfo();
|
|
8
8
|
const OS_GUIDANCE = getOSSpecificGuidance(SYSTEM_INFO);
|
|
9
9
|
const DEV_TOOL_GUIDANCE = getDevelopmentToolGuidance(SYSTEM_INFO);
|
|
10
|
-
const PATH_GUIDANCE =
|
|
10
|
+
const PATH_GUIDANCE = `${getPathGuidance(SYSTEM_INFO)} Relative paths depend on the current working directory, and tilde paths (~/...) may not resolve in every context. Absolute paths are generally the most reliable.`;
|
|
11
11
|
const CMD_PREFIX_DESCRIPTION = `This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.`;
|
|
12
|
-
|
|
12
|
+
const SERVER_INSTRUCTIONS = `Desktop Commander provides tools for working with the user's authorized device.
|
|
13
|
+
- Filesystem tools handle direct file and directory operations within configured access boundaries.
|
|
14
|
+
- Terminal process tools support shell commands, REPLs, and long-running processes. start_process creates a process session; interact_with_process sends input; read_process_output reads later output; force_terminate ends a session.
|
|
15
|
+
- Search tools are session-based. start_search creates a search session; get_more_search_results reads its results; stop_search ends it early.
|
|
16
|
+
- Absolute paths are generally the most reliable because relative paths depend on the active working directory.
|
|
17
|
+
- allowedDirectories and each tool's schema, annotations, and documented constraints define the operational boundaries.`;
|
|
18
|
+
import { StartProcessArgsSchema, ReadProcessOutputArgsSchema, InteractWithProcessArgsSchema, ForceTerminateArgsSchema, ListSessionsArgsSchema, KillProcessArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, WriteFileArgsSchema, CreateDirectoryArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, GetFileInfoArgsSchema, GetConfigArgsSchema, SetConfigValueArgsSchema, ListProcessesArgsSchema, EditBlockArgsSchema, GetUsageStatsArgsSchema, GiveFeedbackArgsSchema, StartSearchArgsSchema, GetMoreSearchResultsArgsSchema, StopSearchArgsSchema, ListSearchesArgsSchema, GetRecentToolCallsArgsSchema, WritePdfArgsSchema, toolArgSchemas, } from './tools/schemas.js';
|
|
13
19
|
import { detectUnsupportedParams, getSupportedParams, buildUnsupportedParamsWarning, } from './utils/unsupportedParams.js';
|
|
14
20
|
import { getConfig, setConfigValue } from './tools/config.js';
|
|
15
21
|
import { getUsageStats } from './tools/usage.js';
|
|
16
22
|
import { giveFeedbackToDesktopCommander } from './tools/feedback.js';
|
|
17
|
-
import { getPrompts } from './tools/prompts.js';
|
|
18
23
|
import { trackToolCall } from './utils/trackTools.js';
|
|
19
24
|
import { usageTracker } from './utils/usageTracker.js';
|
|
20
25
|
import { processDockerPrompt } from './utils/dockerPrompt.js';
|
|
@@ -190,6 +195,7 @@ server.setRequestHandler(InitializeRequestSchema, async (request) => {
|
|
|
190
195
|
name: "desktop-commander",
|
|
191
196
|
version: VERSION,
|
|
192
197
|
},
|
|
198
|
+
instructions: SERVER_INSTRUCTIONS,
|
|
193
199
|
};
|
|
194
200
|
}
|
|
195
201
|
catch (error) {
|
|
@@ -206,7 +212,7 @@ deferLog('info', 'Setting up request handlers...');
|
|
|
206
212
|
function shouldIncludeTool(toolName) {
|
|
207
213
|
// Exclude these tools for desktop-commander client (DC-specific meta-tools not useful when DC itself is the client)
|
|
208
214
|
if (currentClient?.name === 'desktop-commander-app') {
|
|
209
|
-
if (toolName === 'give_feedback_to_desktop_commander'
|
|
215
|
+
if (toolName === 'give_feedback_to_desktop_commander') {
|
|
210
216
|
return false;
|
|
211
217
|
}
|
|
212
218
|
}
|
|
@@ -223,45 +229,47 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
223
229
|
// Configuration tools
|
|
224
230
|
{
|
|
225
231
|
name: "get_config",
|
|
226
|
-
description: `
|
|
227
|
-
Get the complete server configuration as JSON. Config includes fields for:
|
|
228
|
-
- blockedCommands (array of blocked shell commands)
|
|
229
|
-
- defaultShell (shell to use for commands)
|
|
230
|
-
- allowedDirectories (paths the server can access)
|
|
231
|
-
- fileReadLineLimit (max lines for read_file, default 1000)
|
|
232
|
-
- fileWriteLineLimit (max lines per write_file call, default 50)
|
|
233
|
-
- telemetryEnabled (boolean for telemetry opt-in/out)
|
|
234
|
-
- currentClient (information about the currently connected MCP client)
|
|
235
|
-
- clientHistory (history of all clients that have connected)
|
|
236
|
-
- version (version of the DesktopCommander)
|
|
237
|
-
- systemInfo (operating system and environment details)
|
|
232
|
+
description: `
|
|
233
|
+
Get the complete server configuration as JSON. Config includes fields for:
|
|
234
|
+
- blockedCommands (array of blocked shell commands)
|
|
235
|
+
- defaultShell (shell to use for commands)
|
|
236
|
+
- allowedDirectories (paths the server can access)
|
|
237
|
+
- fileReadLineLimit (max lines for read_file, default 1000)
|
|
238
|
+
- fileWriteLineLimit (max lines per write_file call, default 50)
|
|
239
|
+
- telemetryEnabled (boolean for telemetry opt-in/out)
|
|
240
|
+
- currentClient (information about the currently connected MCP client)
|
|
241
|
+
- clientHistory (history of all clients that have connected)
|
|
242
|
+
- version (version of the DesktopCommander)
|
|
243
|
+
- systemInfo (operating system and environment details)
|
|
238
244
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
239
245
|
inputSchema: zodToJsonSchema(GetConfigArgsSchema),
|
|
240
246
|
_meta: buildUiToolMeta(CONFIG_EDITOR_RESOURCE_URI, true, showMcpUiPreviews),
|
|
241
247
|
annotations: {
|
|
242
248
|
title: "Get Configuration",
|
|
243
249
|
readOnlyHint: true,
|
|
250
|
+
openWorldHint: false,
|
|
251
|
+
destructiveHint: false,
|
|
244
252
|
},
|
|
245
253
|
},
|
|
246
254
|
{
|
|
247
255
|
name: "set_config_value",
|
|
248
|
-
description: `
|
|
249
|
-
Set a specific configuration value by key.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
command
|
|
253
|
-
|
|
254
|
-
Config keys include:
|
|
255
|
-
- blockedCommands (array)
|
|
256
|
-
- defaultShell (string)
|
|
257
|
-
- allowedDirectories (array of paths)
|
|
258
|
-
- fileReadLineLimit (number, max lines for read_file)
|
|
259
|
-
- fileWriteLineLimit (number, max lines per write_file call)
|
|
260
|
-
- telemetryEnabled (boolean)
|
|
261
|
-
|
|
262
|
-
IMPORTANT: Setting allowedDirectories to an empty array ([]) allows full access
|
|
263
|
-
to the entire file system, regardless of the operating system.
|
|
264
|
-
|
|
256
|
+
description: `
|
|
257
|
+
Set a specific configuration value by key.
|
|
258
|
+
|
|
259
|
+
Security note: configuration changes affect later file and command behavior.
|
|
260
|
+
Isolating them from untrusted file or command content reduces the chance that external content influences configuration.
|
|
261
|
+
|
|
262
|
+
Config keys include:
|
|
263
|
+
- blockedCommands (array)
|
|
264
|
+
- defaultShell (string)
|
|
265
|
+
- allowedDirectories (array of paths)
|
|
266
|
+
- fileReadLineLimit (number, max lines for read_file)
|
|
267
|
+
- fileWriteLineLimit (number, max lines per write_file call)
|
|
268
|
+
- telemetryEnabled (boolean)
|
|
269
|
+
|
|
270
|
+
IMPORTANT: Setting allowedDirectories to an empty array ([]) allows full access
|
|
271
|
+
to the entire file system, regardless of the operating system.
|
|
272
|
+
|
|
265
273
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
266
274
|
inputSchema: zodToJsonSchema(SetConfigValueArgsSchema),
|
|
267
275
|
annotations: {
|
|
@@ -274,60 +282,59 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
274
282
|
// Filesystem tools
|
|
275
283
|
{
|
|
276
284
|
name: "read_file",
|
|
277
|
-
description: `
|
|
278
|
-
Read contents from files and URLs.
|
|
279
|
-
Read PDF files and extract content as markdown and images.
|
|
280
|
-
|
|
281
|
-
Suitable for reading authorized local files directly without starting a shell command.
|
|
282
|
-
|
|
283
|
-
Supports partial file reading with:
|
|
284
|
-
- 'offset' (start line, default: 0)
|
|
285
|
-
* Positive: Start from line N (0-based indexing)
|
|
286
|
-
* Negative: Read last N lines from end (tail behavior)
|
|
287
|
-
- 'length' (max lines to read, default: configurable via 'fileReadLineLimit' setting, initially 1000)
|
|
288
|
-
* Used with positive offsets for range reading
|
|
289
|
-
* Ignored when offset is negative (reads all requested tail lines)
|
|
290
|
-
|
|
291
|
-
Examples:
|
|
292
|
-
- offset: 0, length: 10 → First 10 lines
|
|
293
|
-
- offset: 100, length: 5 → Lines 100-104
|
|
294
|
-
- offset: -20 → Last 20 lines
|
|
295
|
-
- offset: -5, length: 10 → Last 5 lines (length ignored)
|
|
296
|
-
|
|
297
|
-
Performance optimizations:
|
|
298
|
-
- Large files with negative offsets use reverse reading for efficiency
|
|
299
|
-
- Large files with deep positive offsets use byte estimation
|
|
300
|
-
- Small files use fast readline streaming
|
|
301
|
-
|
|
302
|
-
When reading from the file system, only works within allowed directories.
|
|
303
|
-
Can fetch content from URLs when isUrl parameter is set to true
|
|
304
|
-
(URLs are always read in full regardless of offset/length).
|
|
305
|
-
|
|
306
|
-
FORMAT HANDLING (by extension):
|
|
307
|
-
- Text: Uses offset/length for line-based pagination
|
|
308
|
-
- Excel (.xlsx, .xls, .xlsm): Returns JSON 2D array
|
|
309
|
-
* sheet: "Sheet1" (name) or "0" (index as string, 0-based)
|
|
310
|
-
* range
|
|
311
|
-
* offset/length work as row pagination (optional fallback)
|
|
312
|
-
- Images (PNG, JPEG, GIF, WebP): Base64 encoded viewable content
|
|
313
|
-
- PDF: Extracts text content as markdown with page structure
|
|
314
|
-
* offset/length work as page pagination (0-based)
|
|
315
|
-
* Includes embedded images when available
|
|
316
|
-
- DOCX (.docx): Two modes depending on parameters:
|
|
317
|
-
* DEFAULT (no offset/length): Returns a text-bearing outline — shows paragraphs with text,
|
|
318
|
-
tables with cell content, styles, image refs. Skips shapes/drawings/SVG noise.
|
|
319
|
-
Each element shows its body index [0], [1], etc.
|
|
320
|
-
* WITH offset/length: Returns raw pretty-printed XML with line pagination.
|
|
321
|
-
Use this to drill into specific sections or see the actual XML for editing.
|
|
322
|
-
*
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
${PATH_GUIDANCE}
|
|
285
|
+
description: `
|
|
286
|
+
Read contents from files and URLs.
|
|
287
|
+
Read PDF files and extract content as markdown and images.
|
|
288
|
+
|
|
289
|
+
Suitable for reading authorized local files directly without starting a shell command.
|
|
290
|
+
|
|
291
|
+
Supports partial file reading with:
|
|
292
|
+
- 'offset' (start line, default: 0)
|
|
293
|
+
* Positive: Start from line N (0-based indexing)
|
|
294
|
+
* Negative: Read last N lines from end (tail behavior)
|
|
295
|
+
- 'length' (max lines to read, default: configurable via 'fileReadLineLimit' setting, initially 1000)
|
|
296
|
+
* Used with positive offsets for range reading
|
|
297
|
+
* Ignored when offset is negative (reads all requested tail lines)
|
|
298
|
+
|
|
299
|
+
Examples:
|
|
300
|
+
- offset: 0, length: 10 → First 10 lines
|
|
301
|
+
- offset: 100, length: 5 → Lines 100-104
|
|
302
|
+
- offset: -20 → Last 20 lines
|
|
303
|
+
- offset: -5, length: 10 → Last 5 lines (length ignored)
|
|
304
|
+
|
|
305
|
+
Performance optimizations:
|
|
306
|
+
- Large files with negative offsets use reverse reading for efficiency
|
|
307
|
+
- Large files with deep positive offsets use byte estimation
|
|
308
|
+
- Small files use fast readline streaming
|
|
309
|
+
|
|
310
|
+
When reading from the file system, only works within allowed directories.
|
|
311
|
+
Can fetch content from URLs when isUrl parameter is set to true
|
|
312
|
+
(URLs are always read in full regardless of offset/length).
|
|
313
|
+
|
|
314
|
+
FORMAT HANDLING (by extension):
|
|
315
|
+
- Text: Uses offset/length for line-based pagination
|
|
316
|
+
- Excel (.xlsx, .xls, .xlsm): Returns JSON 2D array
|
|
317
|
+
* sheet: "Sheet1" (name) or "0" (index as string, 0-based)
|
|
318
|
+
* range uses FROM:TO format (e.g., "A1:D100", "C1:C1", "B2:B50")
|
|
319
|
+
* offset/length work as row pagination (optional fallback)
|
|
320
|
+
- Images (PNG, JPEG, GIF, WebP): Base64 encoded viewable content
|
|
321
|
+
- PDF: Extracts text content as markdown with page structure
|
|
322
|
+
* offset/length work as page pagination (0-based)
|
|
323
|
+
* Includes embedded images when available
|
|
324
|
+
- DOCX (.docx): Two modes depending on parameters:
|
|
325
|
+
* DEFAULT (no offset/length): Returns a text-bearing outline — shows paragraphs with text,
|
|
326
|
+
tables with cell content, styles, image refs. Skips shapes/drawings/SVG noise.
|
|
327
|
+
Each element shows its body index [0], [1], etc.
|
|
328
|
+
* WITH offset/length: Returns raw pretty-printed XML with line pagination.
|
|
329
|
+
Use this to drill into specific sections or see the actual XML for editing.
|
|
330
|
+
* Raw DOCX XML output is compatible with edit_block's XML find/replace mode using
|
|
331
|
+
XML fragments copied from the read output.
|
|
332
|
+
* Raw XML mode requires a non-zero offset (offset=1 starts from line 1).
|
|
333
|
+
offset=0 returns the outline regardless of length.
|
|
334
|
+
* Bulk transformations can be performed programmatically against the DOCX archive
|
|
335
|
+
when the task requires changes across many XML text nodes.
|
|
336
|
+
|
|
337
|
+
${PATH_GUIDANCE}
|
|
331
338
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
332
339
|
inputSchema: zodToJsonSchema(ReadFileArgsSchema),
|
|
333
340
|
_meta: buildUiToolMeta(FILE_PREVIEW_RESOURCE_URI, true, showMcpUiPreviews),
|
|
@@ -335,67 +342,53 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
335
342
|
title: "Read File or URL",
|
|
336
343
|
readOnlyHint: true,
|
|
337
344
|
openWorldHint: true,
|
|
345
|
+
destructiveHint: false,
|
|
338
346
|
},
|
|
339
347
|
},
|
|
340
348
|
{
|
|
341
349
|
name: "read_multiple_files",
|
|
342
|
-
description: `
|
|
343
|
-
Read the contents of multiple files simultaneously.
|
|
344
|
-
|
|
345
|
-
Each file's content is returned with its path as a reference.
|
|
346
|
-
Handles text files normally and renders images as viewable content.
|
|
347
|
-
Recognized image types: PNG, JPEG, GIF, WebP.
|
|
348
|
-
|
|
349
|
-
Failed reads for individual files won't stop the entire operation.
|
|
350
|
-
Only works within allowed directories.
|
|
351
|
-
|
|
352
|
-
${PATH_GUIDANCE}
|
|
350
|
+
description: `
|
|
351
|
+
Read the contents of multiple files simultaneously.
|
|
352
|
+
|
|
353
|
+
Each file's content is returned with its path as a reference.
|
|
354
|
+
Handles text files normally and renders images as viewable content.
|
|
355
|
+
Recognized image types: PNG, JPEG, GIF, WebP.
|
|
356
|
+
|
|
357
|
+
Failed reads for individual files won't stop the entire operation.
|
|
358
|
+
Only works within allowed directories.
|
|
359
|
+
|
|
360
|
+
${PATH_GUIDANCE}
|
|
353
361
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
354
362
|
inputSchema: zodToJsonSchema(ReadMultipleFilesArgsSchema),
|
|
355
363
|
annotations: {
|
|
356
364
|
title: "Read Multiple Files",
|
|
357
365
|
readOnlyHint: true,
|
|
366
|
+
openWorldHint: false,
|
|
367
|
+
destructiveHint: false,
|
|
358
368
|
},
|
|
359
369
|
},
|
|
360
370
|
{
|
|
361
371
|
name: "write_file",
|
|
362
|
-
description: `
|
|
363
|
-
Write or append to file contents.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
3. When creating documentation, code files, or configuration files
|
|
383
|
-
|
|
384
|
-
HANDLING CONTINUATION ("Continue" prompts):
|
|
385
|
-
If user asks to "Continue" after an incomplete operation:
|
|
386
|
-
1. Read the file to see what was successfully written
|
|
387
|
-
2. Continue writing ONLY the remaining content using {mode: 'append'}
|
|
388
|
-
3. Keep chunks to 25-30 lines each
|
|
389
|
-
|
|
390
|
-
FORMAT HANDLING (by extension):
|
|
391
|
-
- Text files: String content
|
|
392
|
-
- Excel (.xlsx, .xls, .xlsm): JSON 2D array or {"SheetName": [[...]]}
|
|
393
|
-
Example: '[["Name","Age"],["Alice",30]]'
|
|
394
|
-
|
|
395
|
-
Files over 50 lines will generate performance notes but are still written successfully.
|
|
396
|
-
Only works within allowed directories.
|
|
397
|
-
|
|
398
|
-
${PATH_GUIDANCE}
|
|
372
|
+
description: `
|
|
373
|
+
Write or append to file contents.
|
|
374
|
+
|
|
375
|
+
PDF creation is handled by the dedicated write_pdf tool.
|
|
376
|
+
Existing DOCX content can be edited with edit_block. New DOCX files can be created here; markdown headings (#, ##, ###) are converted to styled DOCX paragraphs.
|
|
377
|
+
|
|
378
|
+
CHUNKED WRITES:
|
|
379
|
+
- Repeated calls with mode='rewrite' followed by mode='append' are supported for longer files.
|
|
380
|
+
- Chunks of roughly 25-30 lines minimize latency when writing long text, multiple files, documentation, code, or configuration files.
|
|
381
|
+
- Files over 50 lines are still written successfully but may generate performance notes.
|
|
382
|
+
- For continuation after a partial write, the existing file state can be inspected before appending the remaining content.
|
|
383
|
+
|
|
384
|
+
FORMAT HANDLING (by extension):
|
|
385
|
+
- Text files: String content
|
|
386
|
+
- Excel (.xlsx, .xls, .xlsm): JSON 2D array or {"SheetName": [[...]]}
|
|
387
|
+
Example: '[["Name","Age"],["Alice",30]]'
|
|
388
|
+
|
|
389
|
+
Only works within allowed directories.
|
|
390
|
+
|
|
391
|
+
${PATH_GUIDANCE}
|
|
399
392
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
400
393
|
inputSchema: zodToJsonSchema(WriteFileArgsSchema),
|
|
401
394
|
_meta: buildUiToolMeta(FILE_PREVIEW_RESOURCE_URI, true, showMcpUiPreviews),
|
|
@@ -408,57 +401,56 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
408
401
|
},
|
|
409
402
|
{
|
|
410
403
|
name: "write_pdf",
|
|
411
|
-
description: `
|
|
412
|
-
Create a new PDF file or modify an existing one.
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
-
|
|
418
|
-
|
|
419
|
-
MODES:
|
|
420
|
-
1. CREATE NEW PDF:
|
|
421
|
-
- Pass a markdown string as 'content'.
|
|
422
|
-
write_pdf(path="doc.pdf", content="# Title\\n\\nBody text...")
|
|
423
|
-
|
|
424
|
-
2. MODIFY EXISTING PDF:
|
|
425
|
-
- Pass array of operations as 'content'.
|
|
426
|
-
-
|
|
427
|
-
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
{ type: "
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
{ type: "insert", pageIndex:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
-
|
|
453
|
-
-
|
|
454
|
-
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
${PATH_GUIDANCE}
|
|
404
|
+
description: `
|
|
405
|
+
Create a new PDF file or modify an existing one.
|
|
406
|
+
|
|
407
|
+
Dedicated PDF creation and modification tool.
|
|
408
|
+
|
|
409
|
+
OUTPUT FILES:
|
|
410
|
+
- Creating a PDF requires 'outputPath' with a new filename (e.g., "result_01.pdf", "analysis_2025_01.pdf", etc.).
|
|
411
|
+
|
|
412
|
+
MODES:
|
|
413
|
+
1. CREATE NEW PDF:
|
|
414
|
+
- Pass a markdown string as 'content'.
|
|
415
|
+
write_pdf(path="doc.pdf", content="# Title\\n\\nBody text...")
|
|
416
|
+
|
|
417
|
+
2. MODIFY EXISTING PDF:
|
|
418
|
+
- Pass array of operations as 'content'.
|
|
419
|
+
- Modifications preserve the original PDF and require a different filename in 'outputPath'.
|
|
420
|
+
- The result includes the original and output paths for reference.
|
|
421
|
+
|
|
422
|
+
write_pdf(path="doc.pdf", content=[
|
|
423
|
+
{ type: "delete", pageIndexes: [0, 2] },
|
|
424
|
+
{ type: "insert", pageIndex: 1, markdown: "# New Page" }
|
|
425
|
+
])
|
|
426
|
+
|
|
427
|
+
OPERATIONS:
|
|
428
|
+
- delete: Remove pages by 0-based index.
|
|
429
|
+
{ type: "delete", pageIndexes: [0, 1, 5] }
|
|
430
|
+
|
|
431
|
+
- insert: Add pages at a specific 0-based index.
|
|
432
|
+
{ type: "insert", pageIndex: 0, markdown: "..." }
|
|
433
|
+
{ type: "insert", pageIndex: 5, sourcePdfPath: "/path/to/source.pdf" }
|
|
434
|
+
|
|
435
|
+
PAGE BREAKS:
|
|
436
|
+
To force a page break, use this HTML element:
|
|
437
|
+
<div style="page-break-before: always;"></div>
|
|
438
|
+
|
|
439
|
+
Example:
|
|
440
|
+
"# Page 1\\n\\n<div style=\\"page-break-before: always;\\"></div>\\n\\n# Page 2"
|
|
441
|
+
|
|
442
|
+
ADVANCED STYLING:
|
|
443
|
+
HTML/CSS and inline SVG are supported for:
|
|
444
|
+
- Text styling: colors, sizes, alignment, highlights
|
|
445
|
+
- Boxes: borders, backgrounds, padding, rounded corners
|
|
446
|
+
- SVG graphics: charts, diagrams, icons, shapes
|
|
447
|
+
- Images: <img src="/absolute/path/image.jpg" width="300" /> or 
|
|
448
|
+
|
|
449
|
+
Supports standard markdown features including headers, lists, code blocks, tables, and basic formatting.
|
|
450
|
+
|
|
451
|
+
Only works within allowed directories.
|
|
452
|
+
|
|
453
|
+
${PATH_GUIDANCE}
|
|
462
454
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
463
455
|
inputSchema: zodToJsonSchema(WritePdfArgsSchema),
|
|
464
456
|
annotations: {
|
|
@@ -470,70 +462,73 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
470
462
|
},
|
|
471
463
|
{
|
|
472
464
|
name: "create_directory",
|
|
473
|
-
description: `
|
|
474
|
-
Create a new directory or ensure a directory exists.
|
|
475
|
-
|
|
476
|
-
Can create multiple nested directories in one operation.
|
|
477
|
-
Only works within allowed directories.
|
|
478
|
-
|
|
479
|
-
${PATH_GUIDANCE}
|
|
465
|
+
description: `
|
|
466
|
+
Create a new directory or ensure a directory exists.
|
|
467
|
+
|
|
468
|
+
Can create multiple nested directories in one operation.
|
|
469
|
+
Only works within allowed directories.
|
|
470
|
+
|
|
471
|
+
${PATH_GUIDANCE}
|
|
480
472
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
481
473
|
inputSchema: zodToJsonSchema(CreateDirectoryArgsSchema),
|
|
482
474
|
annotations: {
|
|
483
475
|
title: "Create Directory",
|
|
484
476
|
readOnlyHint: false,
|
|
477
|
+
openWorldHint: false,
|
|
485
478
|
destructiveHint: false,
|
|
486
479
|
},
|
|
487
480
|
},
|
|
488
481
|
{
|
|
489
482
|
name: "list_directory",
|
|
490
|
-
description: `
|
|
491
|
-
Get a detailed listing of all files and directories in a specified path.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
Results distinguish between files and directories with [FILE] and [DIR] prefixes.
|
|
495
|
-
|
|
496
|
-
Supports recursive listing with the 'depth' parameter (default: 2):
|
|
497
|
-
- depth=1: Only direct contents of the directory
|
|
498
|
-
- depth=2: Contents plus one level of subdirectories
|
|
499
|
-
- depth=3+: Multiple levels deep
|
|
500
|
-
|
|
501
|
-
CONTEXT OVERFLOW PROTECTION:
|
|
502
|
-
- Top-level directory shows ALL items
|
|
503
|
-
- Nested directories are limited to 100 items maximum per directory
|
|
504
|
-
- When a nested directory has more than 100 items, you'll see a warning like:
|
|
505
|
-
[WARNING] node_modules: 500 items hidden (showing first 100 of 600 total)
|
|
506
|
-
- This prevents overwhelming the context with large directories like node_modules
|
|
507
|
-
|
|
508
|
-
Results show full relative paths from the root directory being listed.
|
|
509
|
-
Example output with depth=2:
|
|
510
|
-
[DIR] src
|
|
511
|
-
[FILE] src/index.ts
|
|
512
|
-
[DIR] src/tools
|
|
513
|
-
[FILE] src/tools/filesystem.ts
|
|
514
|
-
|
|
515
|
-
If a directory cannot be accessed, it will show [DENIED] instead.
|
|
516
|
-
If a path does not exist, it will show [NOT_FOUND] instead.
|
|
517
|
-
Only works within allowed directories.
|
|
518
|
-
|
|
519
|
-
${PATH_GUIDANCE}
|
|
483
|
+
description: `
|
|
484
|
+
Get a detailed listing of all files and directories in a specified path.
|
|
485
|
+
|
|
486
|
+
Returns a structured directory listing without starting a shell command.
|
|
487
|
+
Results distinguish between files and directories with [FILE] and [DIR] prefixes.
|
|
488
|
+
|
|
489
|
+
Supports recursive listing with the 'depth' parameter (default: 2):
|
|
490
|
+
- depth=1: Only direct contents of the directory
|
|
491
|
+
- depth=2: Contents plus one level of subdirectories
|
|
492
|
+
- depth=3+: Multiple levels deep
|
|
493
|
+
|
|
494
|
+
CONTEXT OVERFLOW PROTECTION:
|
|
495
|
+
- Top-level directory shows ALL items
|
|
496
|
+
- Nested directories are limited to 100 items maximum per directory
|
|
497
|
+
- When a nested directory has more than 100 items, you'll see a warning like:
|
|
498
|
+
[WARNING] node_modules: 500 items hidden (showing first 100 of 600 total)
|
|
499
|
+
- This prevents overwhelming the context with large directories like node_modules
|
|
500
|
+
|
|
501
|
+
Results show full relative paths from the root directory being listed.
|
|
502
|
+
Example output with depth=2:
|
|
503
|
+
[DIR] src
|
|
504
|
+
[FILE] src/index.ts
|
|
505
|
+
[DIR] src/tools
|
|
506
|
+
[FILE] src/tools/filesystem.ts
|
|
507
|
+
|
|
508
|
+
If a directory cannot be accessed, it will show [DENIED] instead.
|
|
509
|
+
If a path does not exist, it will show [NOT_FOUND] instead.
|
|
510
|
+
Only works within allowed directories.
|
|
511
|
+
|
|
512
|
+
${PATH_GUIDANCE}
|
|
520
513
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
521
514
|
inputSchema: zodToJsonSchema(ListDirectoryArgsSchema),
|
|
522
515
|
_meta: buildUiToolMeta(FILE_PREVIEW_RESOURCE_URI, true, showMcpUiPreviews),
|
|
523
516
|
annotations: {
|
|
524
517
|
title: "List Directory Contents",
|
|
525
518
|
readOnlyHint: true,
|
|
519
|
+
openWorldHint: false,
|
|
520
|
+
destructiveHint: false,
|
|
526
521
|
},
|
|
527
522
|
},
|
|
528
523
|
{
|
|
529
524
|
name: "move_file",
|
|
530
|
-
description: `
|
|
531
|
-
Move or rename files and directories.
|
|
532
|
-
|
|
533
|
-
Can move files between directories and rename them in a single operation.
|
|
534
|
-
Both source and destination must be within allowed directories.
|
|
535
|
-
|
|
536
|
-
${PATH_GUIDANCE}
|
|
525
|
+
description: `
|
|
526
|
+
Move or rename files and directories.
|
|
527
|
+
|
|
528
|
+
Can move files between directories and rename them in a single operation.
|
|
529
|
+
Both source and destination must be within allowed directories.
|
|
530
|
+
|
|
531
|
+
${PATH_GUIDANCE}
|
|
537
532
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
538
533
|
inputSchema: zodToJsonSchema(MoveFileArgsSchema),
|
|
539
534
|
annotations: {
|
|
@@ -545,237 +540,240 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
545
540
|
},
|
|
546
541
|
{
|
|
547
542
|
name: "start_search",
|
|
548
|
-
description: `
|
|
549
|
-
Start a streaming search that can return results progressively.
|
|
550
|
-
|
|
551
|
-
SEARCH STRATEGY GUIDE:
|
|
552
|
-
Choose the right search type based on what the user is looking for:
|
|
553
|
-
|
|
554
|
-
USE searchType="files" WHEN:
|
|
555
|
-
- User asks for specific files: "find package.json", "locate config files"
|
|
556
|
-
- Pattern looks like a filename: "*.js", "README.md", "test-*.tsx"
|
|
557
|
-
- User wants to find files by name/extension: "all TypeScript files", "Python scripts"
|
|
558
|
-
- Looking for configuration/setup files: ".env", "dockerfile", "tsconfig.json"
|
|
559
|
-
|
|
560
|
-
USE searchType="content" WHEN:
|
|
561
|
-
- User asks about code/logic: "authentication logic", "error handling", "API calls"
|
|
562
|
-
- Looking for functions/variables: "getUserData function", "useState hook"
|
|
563
|
-
- Searching for text/comments: "TODO items", "FIXME comments", "documentation"
|
|
564
|
-
- Finding patterns in code: "console.log statements", "import statements"
|
|
565
|
-
- User describes functionality: "components that handle login", "files with database queries"
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
Example
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
-
|
|
586
|
-
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
-
|
|
593
|
-
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
- "find
|
|
600
|
-
- "
|
|
601
|
-
- "
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
-
|
|
608
|
-
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
Perfect for large directories where you want to see results immediately and
|
|
623
|
-
have the option to cancel if the search takes too long or you find what you need.
|
|
624
|
-
|
|
625
|
-
${PATH_GUIDANCE}
|
|
543
|
+
description: `
|
|
544
|
+
Start a streaming search that can return results progressively.
|
|
545
|
+
|
|
546
|
+
SEARCH STRATEGY GUIDE:
|
|
547
|
+
Choose the right search type based on what the user is looking for:
|
|
548
|
+
|
|
549
|
+
USE searchType="files" WHEN:
|
|
550
|
+
- User asks for specific files: "find package.json", "locate config files"
|
|
551
|
+
- Pattern looks like a filename: "*.js", "README.md", "test-*.tsx"
|
|
552
|
+
- User wants to find files by name/extension: "all TypeScript files", "Python scripts"
|
|
553
|
+
- Looking for configuration/setup files: ".env", "dockerfile", "tsconfig.json"
|
|
554
|
+
|
|
555
|
+
USE searchType="content" WHEN:
|
|
556
|
+
- User asks about code/logic: "authentication logic", "error handling", "API calls"
|
|
557
|
+
- Looking for functions/variables: "getUserData function", "useState hook"
|
|
558
|
+
- Searching for text/comments: "TODO items", "FIXME comments", "documentation"
|
|
559
|
+
- Finding patterns in code: "console.log statements", "import statements"
|
|
560
|
+
- User describes functionality: "components that handle login", "files with database queries"
|
|
561
|
+
|
|
562
|
+
AMBIGUOUS SEARCHES:
|
|
563
|
+
Queries that could refer to either filenames or file contents can be covered with two
|
|
564
|
+
searches: one with searchType="files" and one with searchType="content".
|
|
565
|
+
Example: "find authentication stuff" can pair a filename search for "auth" with a
|
|
566
|
+
content search for "authentication".
|
|
567
|
+
|
|
568
|
+
SEARCH TYPES:
|
|
569
|
+
- searchType="files": Find files by name (pattern matches file names)
|
|
570
|
+
- searchType="content": Search inside files for text patterns
|
|
571
|
+
|
|
572
|
+
PATTERN MATCHING MODES:
|
|
573
|
+
- Default (literalSearch=false): Patterns are treated as regular expressions
|
|
574
|
+
- Literal (literalSearch=true): Patterns are treated as exact strings
|
|
575
|
+
|
|
576
|
+
literalSearch=true is useful for code patterns with special characters:
|
|
577
|
+
- Function calls with parentheses and quotes
|
|
578
|
+
- Array access with brackets
|
|
579
|
+
- Object methods with dots and parentheses
|
|
580
|
+
- File paths with backslashes
|
|
581
|
+
- Any pattern containing: . * + ? ^ $ { } [ ] | \\ ( )
|
|
582
|
+
|
|
583
|
+
IMPORTANT PARAMETERS:
|
|
584
|
+
- pattern: What to search for (file names OR content text)
|
|
585
|
+
- literalSearch: Use exact string matching instead of regex (default: false)
|
|
586
|
+
- filePattern: Optional filter to limit search to specific file types (e.g., "*.js", "package.json")
|
|
587
|
+
- ignoreCase: Case-insensitive search (default: true). Works for both file names and content.
|
|
588
|
+
- earlyTermination: Stop search early when exact filename match is found (optional: defaults to true for file searches, false for content searches)
|
|
589
|
+
|
|
590
|
+
DECISION EXAMPLES:
|
|
591
|
+
- "find package.json" → searchType="files", pattern="package.json" (specific file)
|
|
592
|
+
- "find authentication components" → searchType="content", pattern="authentication" (looking for functionality)
|
|
593
|
+
- "locate all React components" → searchType="files", pattern="*.tsx" or "*.jsx" (file pattern)
|
|
594
|
+
- "find TODO comments" → searchType="content", pattern="TODO" (text in files)
|
|
595
|
+
- "show me login files" → AMBIGUOUS → run both: files with "login" AND content with "login"
|
|
596
|
+
- "find config" → AMBIGUOUS → run both: config files AND files containing config code
|
|
597
|
+
|
|
598
|
+
COMPREHENSIVE SEARCH EXAMPLES:
|
|
599
|
+
- Find package.json files: searchType="files", pattern="package.json"
|
|
600
|
+
- Find all JS files: searchType="files", pattern="*.js"
|
|
601
|
+
- Search for TODO in code: searchType="content", pattern="TODO", filePattern="*.js|*.ts"
|
|
602
|
+
- Search for exact code: searchType="content", pattern="toast.error('test')", literalSearch=true
|
|
603
|
+
- Ambiguous request "find auth stuff": Run two searches:
|
|
604
|
+
1. searchType="files", pattern="auth"
|
|
605
|
+
2. searchType="content", pattern="authentication"
|
|
606
|
+
|
|
607
|
+
Ambiguous requests can combine file-name and content searches for broader coverage.
|
|
608
|
+
|
|
609
|
+
This tool starts a background search process and returns immediately with a session ID.
|
|
610
|
+
Results are available through get_more_search_results, and stop_search can end the search early.
|
|
611
|
+
|
|
612
|
+
Perfect for large directories where you want to see results immediately and
|
|
613
|
+
have the option to cancel if the search takes too long or you find what you need.
|
|
614
|
+
|
|
615
|
+
${PATH_GUIDANCE}
|
|
626
616
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
627
617
|
inputSchema: zodToJsonSchema(StartSearchArgsSchema),
|
|
628
618
|
annotations: {
|
|
629
619
|
title: "Start Search",
|
|
630
620
|
readOnlyHint: true,
|
|
621
|
+
openWorldHint: false,
|
|
622
|
+
destructiveHint: false,
|
|
631
623
|
},
|
|
632
624
|
},
|
|
633
625
|
{
|
|
634
626
|
name: "get_more_search_results",
|
|
635
|
-
description: `
|
|
636
|
-
Get more results from an active search with offset-based pagination.
|
|
637
|
-
|
|
638
|
-
Supports partial result reading with:
|
|
639
|
-
- 'offset' (start result index, default: 0)
|
|
640
|
-
* Positive: Start from result N (0-based indexing)
|
|
641
|
-
* Negative: Read last N results from end (tail behavior)
|
|
642
|
-
- 'length' (max results to read, default: 100)
|
|
643
|
-
* Used with positive offsets for range reading
|
|
644
|
-
* Ignored when offset is negative (reads all requested tail results)
|
|
645
|
-
|
|
646
|
-
Examples:
|
|
647
|
-
- offset: 0, length: 100 → First 100 results
|
|
648
|
-
- offset: 200, length: 50 → Results 200-249
|
|
649
|
-
- offset: -20 → Last 20 results
|
|
650
|
-
- offset: -5, length: 10 → Last 5 results (length ignored)
|
|
651
|
-
|
|
652
|
-
Returns only results in the specified range, along with search status.
|
|
653
|
-
Works like read_process_output - call this repeatedly to get progressive
|
|
654
|
-
results from a search started with start_search.
|
|
655
|
-
|
|
627
|
+
description: `
|
|
628
|
+
Get more results from an active search with offset-based pagination.
|
|
629
|
+
|
|
630
|
+
Supports partial result reading with:
|
|
631
|
+
- 'offset' (start result index, default: 0)
|
|
632
|
+
* Positive: Start from result N (0-based indexing)
|
|
633
|
+
* Negative: Read last N results from end (tail behavior)
|
|
634
|
+
- 'length' (max results to read, default: 100)
|
|
635
|
+
* Used with positive offsets for range reading
|
|
636
|
+
* Ignored when offset is negative (reads all requested tail results)
|
|
637
|
+
|
|
638
|
+
Examples:
|
|
639
|
+
- offset: 0, length: 100 → First 100 results
|
|
640
|
+
- offset: 200, length: 50 → Results 200-249
|
|
641
|
+
- offset: -20 → Last 20 results
|
|
642
|
+
- offset: -5, length: 10 → Last 5 results (length ignored)
|
|
643
|
+
|
|
644
|
+
Returns only results in the specified range, along with search status.
|
|
645
|
+
Works like read_process_output - call this repeatedly to get progressive
|
|
646
|
+
results from a search started with start_search.
|
|
647
|
+
|
|
656
648
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
657
649
|
inputSchema: zodToJsonSchema(GetMoreSearchResultsArgsSchema),
|
|
658
650
|
annotations: {
|
|
659
651
|
title: "Get Search Results",
|
|
660
652
|
readOnlyHint: true,
|
|
653
|
+
openWorldHint: false,
|
|
654
|
+
destructiveHint: false,
|
|
661
655
|
},
|
|
662
656
|
},
|
|
663
657
|
{
|
|
664
658
|
name: "stop_search",
|
|
665
|
-
description: `
|
|
666
|
-
Stop an active search.
|
|
667
|
-
|
|
668
|
-
Stops the background search process gracefully. Use this when you've found
|
|
669
|
-
what you need or if a search is taking too long. Similar to force_terminate
|
|
670
|
-
for terminal processes.
|
|
671
|
-
|
|
672
|
-
The search will still be available for reading final results until it's
|
|
673
|
-
automatically cleaned up after 5 minutes.
|
|
674
|
-
|
|
659
|
+
description: `
|
|
660
|
+
Stop an active search.
|
|
661
|
+
|
|
662
|
+
Stops the background search process gracefully. Use this when you've found
|
|
663
|
+
what you need or if a search is taking too long. Similar to force_terminate
|
|
664
|
+
for terminal processes.
|
|
665
|
+
|
|
666
|
+
The search will still be available for reading final results until it's
|
|
667
|
+
automatically cleaned up after 5 minutes.
|
|
668
|
+
|
|
675
669
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
676
670
|
inputSchema: zodToJsonSchema(StopSearchArgsSchema),
|
|
677
671
|
annotations: {
|
|
678
672
|
title: "Stop Search",
|
|
679
673
|
readOnlyHint: false,
|
|
674
|
+
openWorldHint: false,
|
|
680
675
|
destructiveHint: false,
|
|
681
676
|
},
|
|
682
677
|
},
|
|
683
678
|
{
|
|
684
679
|
name: "list_searches",
|
|
685
|
-
description: `
|
|
686
|
-
List all active searches.
|
|
687
|
-
|
|
688
|
-
Shows search IDs, search types, patterns, status, and runtime.
|
|
689
|
-
Similar to list_sessions for terminal processes. Useful for managing
|
|
690
|
-
multiple concurrent searches.
|
|
691
|
-
|
|
680
|
+
description: `
|
|
681
|
+
List all active searches.
|
|
682
|
+
|
|
683
|
+
Shows search IDs, search types, patterns, status, and runtime.
|
|
684
|
+
Similar to list_sessions for terminal processes. Useful for managing
|
|
685
|
+
multiple concurrent searches.
|
|
686
|
+
|
|
692
687
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
693
688
|
inputSchema: zodToJsonSchema(ListSearchesArgsSchema),
|
|
694
689
|
annotations: {
|
|
695
690
|
title: "List Active Searches",
|
|
696
691
|
readOnlyHint: true,
|
|
692
|
+
openWorldHint: false,
|
|
693
|
+
destructiveHint: false,
|
|
697
694
|
},
|
|
698
695
|
},
|
|
699
696
|
{
|
|
700
697
|
name: "get_file_info",
|
|
701
|
-
description: `
|
|
702
|
-
Retrieve detailed metadata about a file or directory including:
|
|
703
|
-
- size
|
|
704
|
-
- creation time
|
|
705
|
-
- last modified time
|
|
706
|
-
- permissions
|
|
707
|
-
- type
|
|
708
|
-
- lineCount (for text files)
|
|
709
|
-
- lastLine (zero-indexed number of last line, for text files)
|
|
710
|
-
- appendPosition (line number for appending, for text files)
|
|
711
|
-
- sheets (for Excel files - array of {name, rowCount, colCount})
|
|
712
|
-
|
|
713
|
-
Only works within allowed directories.
|
|
714
|
-
|
|
715
|
-
${PATH_GUIDANCE}
|
|
698
|
+
description: `
|
|
699
|
+
Retrieve detailed metadata about a file or directory including:
|
|
700
|
+
- size
|
|
701
|
+
- creation time
|
|
702
|
+
- last modified time
|
|
703
|
+
- permissions
|
|
704
|
+
- type
|
|
705
|
+
- lineCount (for text files)
|
|
706
|
+
- lastLine (zero-indexed number of last line, for text files)
|
|
707
|
+
- appendPosition (line number for appending, for text files)
|
|
708
|
+
- sheets (for Excel files - array of {name, rowCount, colCount})
|
|
709
|
+
|
|
710
|
+
Only works within allowed directories.
|
|
711
|
+
|
|
712
|
+
${PATH_GUIDANCE}
|
|
716
713
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
717
714
|
inputSchema: zodToJsonSchema(GetFileInfoArgsSchema),
|
|
718
715
|
annotations: {
|
|
719
716
|
title: "Get File Information",
|
|
720
717
|
readOnlyHint: true,
|
|
718
|
+
openWorldHint: false,
|
|
719
|
+
destructiveHint: false,
|
|
721
720
|
},
|
|
722
721
|
},
|
|
723
722
|
// Note: list_allowed_directories removed - use get_config to check allowedDirectories
|
|
724
723
|
// Editing tools
|
|
725
724
|
{
|
|
726
725
|
name: "edit_block",
|
|
727
|
-
description: `
|
|
728
|
-
Apply surgical edits to files.
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
-
|
|
739
|
-
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
-
|
|
745
|
-
-
|
|
746
|
-
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
-
|
|
757
|
-
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
${PATH_GUIDANCE}
|
|
726
|
+
description: `
|
|
727
|
+
Apply surgical edits to files.
|
|
728
|
+
|
|
729
|
+
Small, focused edits are easier to verify than large multi-purpose replacements.
|
|
730
|
+
old_string can include enough surrounding context to uniquely identify the intended text.
|
|
731
|
+
|
|
732
|
+
FORMAT HANDLING (by extension):
|
|
733
|
+
|
|
734
|
+
EXCEL FILES (.xlsx, .xls, .xlsm) - Range Update mode:
|
|
735
|
+
Takes:
|
|
736
|
+
- file_path: Path to the Excel file
|
|
737
|
+
- range uses FROM:TO format - "SheetName!A1:C10" or "SheetName!C1:C1"
|
|
738
|
+
- content: 2D array, e.g., [["H1","H2"],["R1","R2"]]
|
|
739
|
+
|
|
740
|
+
TEXT FILES - Find/Replace mode:
|
|
741
|
+
Takes:
|
|
742
|
+
- file_path: Path to the file to edit
|
|
743
|
+
- old_string: Text to replace
|
|
744
|
+
- new_string: Replacement text
|
|
745
|
+
- expected_replacements: Optional number of replacements (default: 1)
|
|
746
|
+
|
|
747
|
+
DOCX FILES (.docx) - XML Find/Replace mode:
|
|
748
|
+
Takes same parameters as text files (old_string, new_string, expected_replacements).
|
|
749
|
+
Operates on the pretty-printed XML inside the DOCX — the same XML you see from
|
|
750
|
+
read_file with offset/length. Copy XML fragments from read output as old_string.
|
|
751
|
+
After editing, the XML is repacked into a valid DOCX.
|
|
752
|
+
Also searches headers/footers if not found in document body.
|
|
753
|
+
Examples:
|
|
754
|
+
- Replace text: old_string="<w:t>Old Text</w:t>" new_string="<w:t>New Text</w:t>"
|
|
755
|
+
- Change style: old_string='<w:pStyle w:val="Normal"/>' new_string='<w:pStyle w:val="Heading1"/>'
|
|
756
|
+
- Add content: include surrounding XML context in old_string, add new elements in new_string
|
|
757
|
+
|
|
758
|
+
By default, replaces only ONE occurrence of the search text.
|
|
759
|
+
To replace multiple occurrences, provide expected_replacements with
|
|
760
|
+
the exact number of matches expected.
|
|
761
|
+
|
|
762
|
+
UNIQUENESS REQUIREMENT: When expected_replacements=1 (default), include the minimal
|
|
763
|
+
amount of context necessary (typically 1-3 lines) before and after the change point,
|
|
764
|
+
with exact whitespace and indentation.
|
|
765
|
+
|
|
766
|
+
When editing multiple sections, make separate edit_block calls for each distinct change
|
|
767
|
+
rather than one large replacement.
|
|
768
|
+
|
|
769
|
+
When a close but non-exact match is found, a character-level diff is shown in the format:
|
|
770
|
+
common_prefix{-removed-}{+added+}common_suffix to help you identify what's different.
|
|
771
|
+
|
|
772
|
+
Similar to write_file, there is a configurable line limit (fileWriteLineLimit) that warns
|
|
773
|
+
if the edited file exceeds this limit. If this happens, consider breaking your edits into
|
|
774
|
+
smaller, more focused changes.
|
|
775
|
+
|
|
776
|
+
${PATH_GUIDANCE}
|
|
779
777
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
780
778
|
inputSchema: zodToJsonSchema(EditBlockArgsSchema),
|
|
781
779
|
_meta: buildUiToolMeta(FILE_PREVIEW_RESOURCE_URI, true, showMcpUiPreviews),
|
|
@@ -789,44 +787,44 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
789
787
|
// Terminal tools
|
|
790
788
|
{
|
|
791
789
|
name: "start_process",
|
|
792
|
-
description: `
|
|
793
|
-
Start a terminal process on the authorized device with intelligent state detection.
|
|
794
|
-
|
|
795
|
-
Suitable for shell commands, interactive REPL sessions, data-processing scripts,
|
|
796
|
-
programmatic file analysis, and other long-running terminal work.
|
|
797
|
-
|
|
798
|
-
${OS_GUIDANCE}
|
|
799
|
-
|
|
800
|
-
Examples:
|
|
801
|
-
• start_process("python3 -i") → Start an interactive Python REPL
|
|
802
|
-
• start_process("node -i") → Start an interactive Node.js REPL
|
|
803
|
-
• start_process("node:local") → Run stateless Node.js code on the MCP server
|
|
804
|
-
• start_process("wc -l /path/file.csv") → Run a one-shot shell command
|
|
805
|
-
|
|
806
|
-
Interactive process sessions support follow-up input after they are started.
|
|
807
|
-
Long-running process sessions expose newly available output while they remain active.
|
|
808
|
-
Binary files can be processed with appropriate command-line tools or libraries available
|
|
809
|
-
in the selected process environment.
|
|
810
|
-
|
|
811
|
-
SMART DETECTION:
|
|
812
|
-
- Detects REPL prompts (>>>, >, $, etc.)
|
|
813
|
-
- Identifies when a process is waiting for input
|
|
814
|
-
- Recognizes process completion vs timeout
|
|
815
|
-
- Early exit prevents unnecessary waiting
|
|
816
|
-
|
|
817
|
-
STATES DETECTED:
|
|
818
|
-
Process waiting for input (shows prompt)
|
|
819
|
-
Process finished execution
|
|
820
|
-
Process running (use read_process_output)
|
|
821
|
-
|
|
822
|
-
PERFORMANCE DEBUGGING (verbose_timing parameter):
|
|
823
|
-
Set verbose_timing: true to get detailed timing information including:
|
|
824
|
-
- Exit reason (early_exit_quick_pattern, early_exit_periodic_check, process_exit, timeout)
|
|
825
|
-
- Total duration and time to first output
|
|
826
|
-
- Complete timeline of all output events with timestamps
|
|
827
|
-
- Which detection mechanism triggered early exit
|
|
828
|
-
|
|
829
|
-
${PATH_GUIDANCE}
|
|
790
|
+
description: `
|
|
791
|
+
Start a terminal process on the authorized device with intelligent state detection.
|
|
792
|
+
|
|
793
|
+
Suitable for shell commands, interactive REPL sessions, data-processing scripts,
|
|
794
|
+
programmatic file analysis, and other long-running terminal work.
|
|
795
|
+
|
|
796
|
+
${OS_GUIDANCE}
|
|
797
|
+
|
|
798
|
+
Examples:
|
|
799
|
+
• start_process("python3 -i") → Start an interactive Python REPL
|
|
800
|
+
• start_process("node -i") → Start an interactive Node.js REPL
|
|
801
|
+
• start_process("node:local") → Run stateless Node.js code on the MCP server
|
|
802
|
+
• start_process("wc -l /path/file.csv") → Run a one-shot shell command
|
|
803
|
+
|
|
804
|
+
Interactive process sessions support follow-up input after they are started.
|
|
805
|
+
Long-running process sessions expose newly available output while they remain active.
|
|
806
|
+
Binary files can be processed with appropriate command-line tools or libraries available
|
|
807
|
+
in the selected process environment.
|
|
808
|
+
|
|
809
|
+
SMART DETECTION:
|
|
810
|
+
- Detects REPL prompts (>>>, >, $, etc.)
|
|
811
|
+
- Identifies when a process is waiting for input
|
|
812
|
+
- Recognizes process completion vs timeout
|
|
813
|
+
- Early exit prevents unnecessary waiting
|
|
814
|
+
|
|
815
|
+
STATES DETECTED:
|
|
816
|
+
Process waiting for input (shows prompt)
|
|
817
|
+
Process finished execution
|
|
818
|
+
Process running (use read_process_output)
|
|
819
|
+
|
|
820
|
+
PERFORMANCE DEBUGGING (verbose_timing parameter):
|
|
821
|
+
Set verbose_timing: true to get detailed timing information including:
|
|
822
|
+
- Exit reason (early_exit_quick_pattern, early_exit_periodic_check, process_exit, timeout)
|
|
823
|
+
- Total duration and time to first output
|
|
824
|
+
- Complete timeline of all output events with timestamps
|
|
825
|
+
- Which detection mechanism triggered early exit
|
|
826
|
+
|
|
827
|
+
${PATH_GUIDANCE}
|
|
830
828
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
831
829
|
inputSchema: zodToJsonSchema(StartProcessArgsSchema),
|
|
832
830
|
annotations: {
|
|
@@ -838,79 +836,81 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
838
836
|
},
|
|
839
837
|
{
|
|
840
838
|
name: "read_process_output",
|
|
841
|
-
description: `
|
|
842
|
-
Read output from a running process with file-like pagination support.
|
|
843
|
-
|
|
844
|
-
Supports partial output reading with offset and length parameters (like read_file):
|
|
845
|
-
- 'offset' (start line, default: 0)
|
|
846
|
-
* offset=0: Read NEW output since last read (default, like old behavior)
|
|
847
|
-
* Positive: Read from absolute line position
|
|
848
|
-
* Negative: Read last N lines from end (tail behavior)
|
|
849
|
-
- 'length' (max lines to read, default: configurable via 'fileReadLineLimit' setting)
|
|
850
|
-
|
|
851
|
-
Examples:
|
|
852
|
-
- offset: 0, length: 100 → First 100 NEW lines since last read
|
|
853
|
-
- offset: 0 → All new lines (respects config limit)
|
|
854
|
-
- offset: 500, length: 50 → Lines 500-549 (absolute position)
|
|
855
|
-
- offset: -20 → Last 20 lines (tail)
|
|
856
|
-
- offset: -50, length: 10 → Start 50 from end, read 10 lines
|
|
857
|
-
|
|
858
|
-
OUTPUT PROTECTION:
|
|
859
|
-
- Uses same fileReadLineLimit as read_file (default: 1000 lines)
|
|
860
|
-
- Returns status like: [Reading 100 lines from line 0 (total: 5000 lines, 4900 remaining)]
|
|
861
|
-
- Prevents context overflow from verbose processes
|
|
862
|
-
|
|
863
|
-
SMART FEATURES:
|
|
864
|
-
- For offset=0, waits up to timeout_ms for new output to arrive
|
|
865
|
-
- Detects REPL prompts and process completion
|
|
866
|
-
- Shows process state (waiting for input, finished, etc.)
|
|
867
|
-
|
|
868
|
-
DETECTION STATES:
|
|
869
|
-
Process waiting for input (ready for interact_with_process)
|
|
870
|
-
Process finished execution
|
|
871
|
-
Timeout reached (may still be running)
|
|
872
|
-
|
|
839
|
+
description: `
|
|
840
|
+
Read output from a running process with file-like pagination support.
|
|
841
|
+
|
|
842
|
+
Supports partial output reading with offset and length parameters (like read_file):
|
|
843
|
+
- 'offset' (start line, default: 0)
|
|
844
|
+
* offset=0: Read NEW output since last read (default, like old behavior)
|
|
845
|
+
* Positive: Read from absolute line position
|
|
846
|
+
* Negative: Read last N lines from end (tail behavior)
|
|
847
|
+
- 'length' (max lines to read, default: configurable via 'fileReadLineLimit' setting)
|
|
848
|
+
|
|
849
|
+
Examples:
|
|
850
|
+
- offset: 0, length: 100 → First 100 NEW lines since last read
|
|
851
|
+
- offset: 0 → All new lines (respects config limit)
|
|
852
|
+
- offset: 500, length: 50 → Lines 500-549 (absolute position)
|
|
853
|
+
- offset: -20 → Last 20 lines (tail)
|
|
854
|
+
- offset: -50, length: 10 → Start 50 from end, read 10 lines
|
|
855
|
+
|
|
856
|
+
OUTPUT PROTECTION:
|
|
857
|
+
- Uses same fileReadLineLimit as read_file (default: 1000 lines)
|
|
858
|
+
- Returns status like: [Reading 100 lines from line 0 (total: 5000 lines, 4900 remaining)]
|
|
859
|
+
- Prevents context overflow from verbose processes
|
|
860
|
+
|
|
861
|
+
SMART FEATURES:
|
|
862
|
+
- For offset=0, waits up to timeout_ms for new output to arrive
|
|
863
|
+
- Detects REPL prompts and process completion
|
|
864
|
+
- Shows process state (waiting for input, finished, etc.)
|
|
865
|
+
|
|
866
|
+
DETECTION STATES:
|
|
867
|
+
Process waiting for input (ready for interact_with_process)
|
|
868
|
+
Process finished execution
|
|
869
|
+
Timeout reached (may still be running)
|
|
870
|
+
|
|
873
871
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
874
872
|
inputSchema: zodToJsonSchema(ReadProcessOutputArgsSchema),
|
|
875
873
|
annotations: {
|
|
876
874
|
title: "Read Process Output",
|
|
877
875
|
readOnlyHint: true,
|
|
876
|
+
openWorldHint: false,
|
|
877
|
+
destructiveHint: false,
|
|
878
878
|
},
|
|
879
879
|
},
|
|
880
880
|
{
|
|
881
881
|
name: "interact_with_process",
|
|
882
|
-
description: `
|
|
883
|
-
Send input to an existing terminal or REPL process and return newly available output.
|
|
884
|
-
|
|
885
|
-
Useful for interactive shells, Python/Node/R/Julia REPLs, database consoles,
|
|
886
|
-
and long-running commands started with start_process().
|
|
887
|
-
|
|
888
|
-
Examples:
|
|
889
|
-
- Interactive Python REPL sessions can be started with \`python3 -i\`.
|
|
890
|
-
- Existing interactive sessions accept additional input such as imports or analysis commands.
|
|
891
|
-
- Interactive sessions can return newly available output while they remain active.
|
|
892
|
-
|
|
893
|
-
SMART DETECTION:
|
|
894
|
-
- Automatically waits for a recognized prompt when requested
|
|
895
|
-
- Detects errors and completion states
|
|
896
|
-
- Early exit prevents unnecessary waiting
|
|
897
|
-
- Cleans common REPL prompt text from returned output
|
|
898
|
-
|
|
899
|
-
PARAMETERS:
|
|
900
|
-
- pid: Process ID returned by start_process
|
|
901
|
-
- input: Text or command to send to the process
|
|
902
|
-
- timeout_ms: Maximum wait time (default: 8000ms)
|
|
903
|
-
- wait_for_prompt: Whether to wait for a prompt before returning (default: true)
|
|
904
|
-
- verbose_timing: Include detailed timing telemetry (default: false)
|
|
905
|
-
|
|
906
|
-
Returns execution result with status indicators.
|
|
907
|
-
|
|
908
|
-
PERFORMANCE DEBUGGING (verbose_timing parameter):
|
|
909
|
-
When enabled, detailed timing includes:
|
|
910
|
-
- Exit reason
|
|
911
|
-
- Total duration and time to first output
|
|
912
|
-
- Timeline of output events
|
|
913
|
-
|
|
882
|
+
description: `
|
|
883
|
+
Send input to an existing terminal or REPL process and return newly available output.
|
|
884
|
+
|
|
885
|
+
Useful for interactive shells, Python/Node/R/Julia REPLs, database consoles,
|
|
886
|
+
and long-running commands started with start_process().
|
|
887
|
+
|
|
888
|
+
Examples:
|
|
889
|
+
- Interactive Python REPL sessions can be started with \`python3 -i\`.
|
|
890
|
+
- Existing interactive sessions accept additional input such as imports or analysis commands.
|
|
891
|
+
- Interactive sessions can return newly available output while they remain active.
|
|
892
|
+
|
|
893
|
+
SMART DETECTION:
|
|
894
|
+
- Automatically waits for a recognized prompt when requested
|
|
895
|
+
- Detects errors and completion states
|
|
896
|
+
- Early exit prevents unnecessary waiting
|
|
897
|
+
- Cleans common REPL prompt text from returned output
|
|
898
|
+
|
|
899
|
+
PARAMETERS:
|
|
900
|
+
- pid: Process ID returned by start_process
|
|
901
|
+
- input: Text or command to send to the process
|
|
902
|
+
- timeout_ms: Maximum wait time (default: 8000ms)
|
|
903
|
+
- wait_for_prompt: Whether to wait for a prompt before returning (default: true)
|
|
904
|
+
- verbose_timing: Include detailed timing telemetry (default: false)
|
|
905
|
+
|
|
906
|
+
Returns execution result with status indicators.
|
|
907
|
+
|
|
908
|
+
PERFORMANCE DEBUGGING (verbose_timing parameter):
|
|
909
|
+
When enabled, detailed timing includes:
|
|
910
|
+
- Exit reason
|
|
911
|
+
- Total duration and time to first output
|
|
912
|
+
- Timeline of output events
|
|
913
|
+
|
|
914
914
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
915
915
|
inputSchema: zodToJsonSchema(InteractWithProcessArgsSchema),
|
|
916
916
|
annotations: {
|
|
@@ -922,9 +922,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
922
922
|
},
|
|
923
923
|
{
|
|
924
924
|
name: "force_terminate",
|
|
925
|
-
description: `
|
|
926
|
-
Force terminate a running terminal session.
|
|
927
|
-
|
|
925
|
+
description: `
|
|
926
|
+
Force terminate a running terminal session.
|
|
927
|
+
|
|
928
928
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
929
929
|
inputSchema: zodToJsonSchema(ForceTerminateArgsSchema),
|
|
930
930
|
annotations: {
|
|
@@ -936,47 +936,51 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
936
936
|
},
|
|
937
937
|
{
|
|
938
938
|
name: "list_sessions",
|
|
939
|
-
description: `
|
|
940
|
-
List all active terminal sessions.
|
|
941
|
-
|
|
942
|
-
Shows session status including:
|
|
943
|
-
- PID: Process identifier
|
|
944
|
-
- Blocked: Whether session is waiting for input
|
|
945
|
-
- Runtime: How long the session has been running
|
|
946
|
-
|
|
947
|
-
DEBUGGING REPLs:
|
|
948
|
-
- "Blocked: true" often means REPL is waiting for input
|
|
949
|
-
- Use this to verify sessions are running before sending input
|
|
950
|
-
- Long runtime with blocked status may indicate stuck process
|
|
951
|
-
|
|
939
|
+
description: `
|
|
940
|
+
List all active terminal sessions.
|
|
941
|
+
|
|
942
|
+
Shows session status including:
|
|
943
|
+
- PID: Process identifier
|
|
944
|
+
- Blocked: Whether session is waiting for input
|
|
945
|
+
- Runtime: How long the session has been running
|
|
946
|
+
|
|
947
|
+
DEBUGGING REPLs:
|
|
948
|
+
- "Blocked: true" often means REPL is waiting for input
|
|
949
|
+
- Use this to verify sessions are running before sending input
|
|
950
|
+
- Long runtime with blocked status may indicate stuck process
|
|
951
|
+
|
|
952
952
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
953
953
|
inputSchema: zodToJsonSchema(ListSessionsArgsSchema),
|
|
954
954
|
annotations: {
|
|
955
955
|
title: "List Terminal Sessions",
|
|
956
956
|
readOnlyHint: true,
|
|
957
|
+
openWorldHint: false,
|
|
958
|
+
destructiveHint: false,
|
|
957
959
|
},
|
|
958
960
|
},
|
|
959
961
|
{
|
|
960
962
|
name: "list_processes",
|
|
961
|
-
description: `
|
|
962
|
-
List all running processes.
|
|
963
|
-
|
|
964
|
-
Returns process information including PID, command name, CPU usage, and memory usage.
|
|
965
|
-
|
|
963
|
+
description: `
|
|
964
|
+
List all running processes.
|
|
965
|
+
|
|
966
|
+
Returns process information including PID, command name, CPU usage, and memory usage.
|
|
967
|
+
|
|
966
968
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
967
969
|
inputSchema: zodToJsonSchema(ListProcessesArgsSchema),
|
|
968
970
|
annotations: {
|
|
969
971
|
title: "List Running Processes",
|
|
970
972
|
readOnlyHint: true,
|
|
973
|
+
openWorldHint: false,
|
|
974
|
+
destructiveHint: false,
|
|
971
975
|
},
|
|
972
976
|
},
|
|
973
977
|
{
|
|
974
978
|
name: "kill_process",
|
|
975
|
-
description: `
|
|
976
|
-
Terminate a running process by PID.
|
|
977
|
-
|
|
978
|
-
Use with caution as this will forcefully terminate the specified process.
|
|
979
|
-
|
|
979
|
+
description: `
|
|
980
|
+
Terminate a running process by PID.
|
|
981
|
+
|
|
982
|
+
Use with caution as this will forcefully terminate the specified process.
|
|
983
|
+
|
|
980
984
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
981
985
|
inputSchema: zodToJsonSchema(KillProcessArgsSchema),
|
|
982
986
|
annotations: {
|
|
@@ -988,114 +992,68 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
988
992
|
},
|
|
989
993
|
{
|
|
990
994
|
name: "get_usage_stats",
|
|
991
|
-
description: `
|
|
992
|
-
Get usage statistics for debugging and analysis.
|
|
993
|
-
|
|
994
|
-
Returns summary of tool usage, success/failure rates, and performance metrics.
|
|
995
|
-
|
|
995
|
+
description: `
|
|
996
|
+
Get usage statistics for debugging and analysis.
|
|
997
|
+
|
|
998
|
+
Returns summary of tool usage, success/failure rates, and performance metrics.
|
|
999
|
+
|
|
996
1000
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
997
1001
|
inputSchema: zodToJsonSchema(GetUsageStatsArgsSchema),
|
|
998
1002
|
annotations: {
|
|
999
1003
|
title: "Get Usage Statistics",
|
|
1000
1004
|
readOnlyHint: true,
|
|
1005
|
+
openWorldHint: false,
|
|
1006
|
+
destructiveHint: false,
|
|
1001
1007
|
},
|
|
1002
1008
|
},
|
|
1003
1009
|
{
|
|
1004
1010
|
name: "get_recent_tool_calls",
|
|
1005
|
-
description: `
|
|
1006
|
-
Get recent local tool call history with arguments and outputs.
|
|
1007
|
-
Returns a chronological list of recent calls loaded from the local history file.
|
|
1008
|
-
|
|
1009
|
-
Useful for:
|
|
1010
|
-
- Onboarding new chats about work already done
|
|
1011
|
-
- Recovering context after chat history loss
|
|
1012
|
-
- Debugging tool call sequences
|
|
1013
|
-
|
|
1014
|
-
Note: Does not track its own calls or track_ui_event.
|
|
1015
|
-
History is persisted locally in tool-history.jsonl, keeps up to the last 1000
|
|
1016
|
-
calls in memory, and trims older on-disk history. Stored outputs over 4 KiB
|
|
1017
|
-
are replaced with an omission marker.
|
|
1018
|
-
|
|
1011
|
+
description: `
|
|
1012
|
+
Get recent local tool call history with arguments and outputs.
|
|
1013
|
+
Returns a chronological list of recent calls loaded from the local history file.
|
|
1014
|
+
|
|
1015
|
+
Useful for:
|
|
1016
|
+
- Onboarding new chats about work already done
|
|
1017
|
+
- Recovering context after chat history loss
|
|
1018
|
+
- Debugging tool call sequences
|
|
1019
|
+
|
|
1020
|
+
Note: Does not track its own calls or track_ui_event.
|
|
1021
|
+
History is persisted locally in tool-history.jsonl, keeps up to the last 1000
|
|
1022
|
+
calls in memory, and trims older on-disk history. Stored outputs over 4 KiB
|
|
1023
|
+
are replaced with an omission marker.
|
|
1024
|
+
|
|
1019
1025
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
1020
1026
|
inputSchema: zodToJsonSchema(GetRecentToolCallsArgsSchema),
|
|
1021
1027
|
annotations: {
|
|
1022
1028
|
title: "Get Recent Tool Calls",
|
|
1023
1029
|
readOnlyHint: true,
|
|
1030
|
+
openWorldHint: false,
|
|
1031
|
+
destructiveHint: false,
|
|
1024
1032
|
},
|
|
1025
1033
|
},
|
|
1026
1034
|
{
|
|
1027
1035
|
name: "give_feedback_to_desktop_commander",
|
|
1028
|
-
description: `
|
|
1029
|
-
Open feedback form in browser to provide feedback about Desktop Commander.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
- platform: Their operating system (Mac/Windows/Linux)
|
|
1041
|
-
- client_id: Analytics identifier
|
|
1042
|
-
|
|
1043
|
-
All survey questions will be answered directly in the form:
|
|
1044
|
-
- Job title and technical comfort level
|
|
1045
|
-
- Company URL for industry context
|
|
1046
|
-
- Other AI tools they use
|
|
1047
|
-
- Desktop Commander's biggest advantage
|
|
1048
|
-
- How they typically use it
|
|
1049
|
-
- Recommendation likelihood (0-10)
|
|
1050
|
-
- User study participation interest
|
|
1051
|
-
- Email and any additional feedback
|
|
1052
|
-
|
|
1053
|
-
EXAMPLE INTERACTION:
|
|
1054
|
-
User: "sure, I'll give feedback"
|
|
1055
|
-
Claude: "Perfect! Let me open the feedback form for you."
|
|
1056
|
-
[calls tool immediately]
|
|
1057
|
-
|
|
1058
|
-
No parameters are needed - just call the tool to open the form.
|
|
1059
|
-
|
|
1036
|
+
description: `
|
|
1037
|
+
Open feedback form in browser to provide feedback about Desktop Commander.
|
|
1038
|
+
|
|
1039
|
+
The form itself collects survey answers; this tool does not accept survey responses or
|
|
1040
|
+
pre-fill them. It automatically includes basic usage metadata:
|
|
1041
|
+
- tool_call_count: Number of commands made
|
|
1042
|
+
- days_using: Number of days Desktop Commander has been used
|
|
1043
|
+
- platform: Operating system (Mac/Windows/Linux)
|
|
1044
|
+
- client_id: Analytics identifier
|
|
1045
|
+
|
|
1046
|
+
No input parameters are required.
|
|
1047
|
+
|
|
1060
1048
|
${CMD_PREFIX_DESCRIPTION}`,
|
|
1061
1049
|
inputSchema: zodToJsonSchema(GiveFeedbackArgsSchema),
|
|
1062
1050
|
annotations: {
|
|
1063
1051
|
title: "Give Feedback",
|
|
1064
1052
|
readOnlyHint: false,
|
|
1065
1053
|
openWorldHint: true,
|
|
1054
|
+
destructiveHint: false,
|
|
1066
1055
|
},
|
|
1067
1056
|
},
|
|
1068
|
-
{
|
|
1069
|
-
name: "get_prompts",
|
|
1070
|
-
description: `
|
|
1071
|
-
Retrieve a specific Desktop Commander onboarding prompt by ID and execute it.
|
|
1072
|
-
|
|
1073
|
-
SIMPLIFIED ONBOARDING V2: This tool only supports direct prompt retrieval.
|
|
1074
|
-
The onboarding system presents 5 options as a simple numbered list:
|
|
1075
|
-
|
|
1076
|
-
1. Organize my Downloads folder (promptId: 'onb2_01')
|
|
1077
|
-
2. Explain a codebase or repository (promptId: 'onb2_02')
|
|
1078
|
-
3. Create organized knowledge base (promptId: 'onb2_03')
|
|
1079
|
-
4. Analyze a data file (promptId: 'onb2_04')
|
|
1080
|
-
5. Check system health and resources (promptId: 'onb2_05')
|
|
1081
|
-
|
|
1082
|
-
USAGE:
|
|
1083
|
-
When user says "1", "2", "3", "4", or "5" from onboarding:
|
|
1084
|
-
- "1" → get_prompts(action='get_prompt', promptId='onb2_01')
|
|
1085
|
-
- "2" → get_prompts(action='get_prompt', promptId='onb2_02')
|
|
1086
|
-
- "3" → get_prompts(action='get_prompt', promptId='onb2_03')
|
|
1087
|
-
- "4" → get_prompts(action='get_prompt', promptId='onb2_04')
|
|
1088
|
-
- "5" → get_prompts(action='get_prompt', promptId='onb2_05')
|
|
1089
|
-
|
|
1090
|
-
The prompt content will be injected and execution begins immediately.
|
|
1091
|
-
|
|
1092
|
-
${CMD_PREFIX_DESCRIPTION}`,
|
|
1093
|
-
inputSchema: zodToJsonSchema(GetPromptsArgsSchema),
|
|
1094
|
-
annotations: {
|
|
1095
|
-
title: "Get Prompts",
|
|
1096
|
-
readOnlyHint: true,
|
|
1097
|
-
},
|
|
1098
|
-
}
|
|
1099
1057
|
];
|
|
1100
1058
|
// Filter tools based on current client
|
|
1101
1059
|
const filteredTools = allTools.filter(tool => shouldIncludeTool(tool.name));
|
|
@@ -1191,17 +1149,6 @@ async function handleCallToolRequest(request) {
|
|
|
1191
1149
|
if (name === 'set_config_value' && args && typeof args === 'object' && 'key' in args) {
|
|
1192
1150
|
telemetryData.set_config_value_key_name = args.key;
|
|
1193
1151
|
}
|
|
1194
|
-
if (name === 'get_prompts' && args && typeof args === 'object') {
|
|
1195
|
-
const promptArgs = args;
|
|
1196
|
-
telemetryData.action = promptArgs.action;
|
|
1197
|
-
if (promptArgs.category) {
|
|
1198
|
-
telemetryData.category = promptArgs.category;
|
|
1199
|
-
telemetryData.has_category_filter = true;
|
|
1200
|
-
}
|
|
1201
|
-
if (promptArgs.promptId) {
|
|
1202
|
-
telemetryData.prompt_id = promptArgs.promptId;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
1152
|
// Track tool call
|
|
1206
1153
|
trackToolCall(name, args);
|
|
1207
1154
|
// Using a more structured approach with dedicated handlers
|
|
@@ -1244,50 +1191,6 @@ async function handleCallToolRequest(request) {
|
|
|
1244
1191
|
};
|
|
1245
1192
|
}
|
|
1246
1193
|
break;
|
|
1247
|
-
case "get_prompts":
|
|
1248
|
-
try {
|
|
1249
|
-
result = await getPrompts(args || {});
|
|
1250
|
-
// Capture detailed analytics for all successful get_prompts actions
|
|
1251
|
-
if (args && typeof args === 'object' && !result.isError) {
|
|
1252
|
-
const action = args.action;
|
|
1253
|
-
try {
|
|
1254
|
-
if (action === 'get_prompt' && args.promptId) {
|
|
1255
|
-
// Existing get_prompt analytics
|
|
1256
|
-
const { loadPromptsData } = await import('./tools/prompts.js');
|
|
1257
|
-
const promptsData = await loadPromptsData();
|
|
1258
|
-
const prompt = promptsData.prompts.find(p => p.id === args.promptId);
|
|
1259
|
-
if (prompt) {
|
|
1260
|
-
await capture('server_get_prompt', {
|
|
1261
|
-
prompt_id: prompt.id,
|
|
1262
|
-
prompt_title: prompt.title,
|
|
1263
|
-
category: prompt.categories[0] || 'uncategorized',
|
|
1264
|
-
author: prompt.author,
|
|
1265
|
-
verified: prompt.verified,
|
|
1266
|
-
// Temporarily disabled for privacy review - Dec 2025
|
|
1267
|
-
// anonymous_use_case: (args as any).anonymous_user_use_case || null
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
catch (error) {
|
|
1273
|
-
// Don't fail the request if analytics fail
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
// Track if user used get_prompts after seeing onboarding invitation (for state management only)
|
|
1277
|
-
const onboardingState = await usageTracker.getOnboardingState();
|
|
1278
|
-
if (onboardingState.attemptsShown > 0 && !onboardingState.promptsUsed) {
|
|
1279
|
-
// Mark that they used prompts after seeing onboarding (stops future onboarding messages)
|
|
1280
|
-
await usageTracker.markOnboardingPromptsUsed();
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
catch (error) {
|
|
1284
|
-
capture('server_request_error', { message: `Error in get_prompts handler: ${error}` });
|
|
1285
|
-
result = {
|
|
1286
|
-
content: [{ type: "text", text: `Error: Failed to retrieve prompts` }],
|
|
1287
|
-
isError: true,
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
break;
|
|
1291
1194
|
case "get_recent_tool_calls":
|
|
1292
1195
|
try {
|
|
1293
1196
|
result = await handlers.handleGetRecentToolCalls(args);
|
|
@@ -1423,40 +1326,6 @@ async function handleCallToolRequest(request) {
|
|
|
1423
1326
|
else {
|
|
1424
1327
|
await usageTracker.trackSuccess(name);
|
|
1425
1328
|
console.log(`[FEEDBACK DEBUG] Tool ${name} succeeded, checking feedback...`);
|
|
1426
|
-
// Check if should show onboarding (before feedback - first-time users are priority)
|
|
1427
|
-
const shouldShowOnboarding = await usageTracker.shouldShowOnboarding();
|
|
1428
|
-
console.log(`[ONBOARDING DEBUG] Should show onboarding: ${shouldShowOnboarding}`);
|
|
1429
|
-
if (shouldShowOnboarding) {
|
|
1430
|
-
console.log(`[ONBOARDING DEBUG] Generating onboarding message...`);
|
|
1431
|
-
const onboardingResult = await usageTracker.getOnboardingMessage();
|
|
1432
|
-
console.log(`[ONBOARDING DEBUG] Generated variant: ${onboardingResult.variant}`);
|
|
1433
|
-
// Capture onboarding prompt injection event
|
|
1434
|
-
const stats = await usageTracker.getStats();
|
|
1435
|
-
await capture('server_onboarding_shown', {
|
|
1436
|
-
trigger_tool: name,
|
|
1437
|
-
total_calls: stats.totalToolCalls,
|
|
1438
|
-
successful_calls: stats.successfulCalls,
|
|
1439
|
-
days_since_first_use: Math.floor((Date.now() - stats.firstUsed) / (1000 * 60 * 60 * 24)),
|
|
1440
|
-
total_sessions: stats.totalSessions,
|
|
1441
|
-
message_variant: onboardingResult.variant
|
|
1442
|
-
});
|
|
1443
|
-
// Inject onboarding message for the LLM
|
|
1444
|
-
if (result.content && result.content.length > 0 && result.content[0].type === "text") {
|
|
1445
|
-
const currentContent = result.content[0].text || '';
|
|
1446
|
-
result.content[0].text = `${currentContent}${onboardingResult.message}`;
|
|
1447
|
-
}
|
|
1448
|
-
else {
|
|
1449
|
-
result.content = [
|
|
1450
|
-
...(result.content || []),
|
|
1451
|
-
{
|
|
1452
|
-
type: "text",
|
|
1453
|
-
text: onboardingResult.message
|
|
1454
|
-
}
|
|
1455
|
-
];
|
|
1456
|
-
}
|
|
1457
|
-
// Mark that we've shown onboarding (to prevent spam)
|
|
1458
|
-
await usageTracker.markOnboardingShown(onboardingResult.variant);
|
|
1459
|
-
}
|
|
1460
1329
|
// Check if should prompt for feedback (only on successful operations)
|
|
1461
1330
|
const shouldPrompt = await usageTracker.shouldPromptForFeedback();
|
|
1462
1331
|
console.log(`[FEEDBACK DEBUG] Should prompt for feedback: ${shouldPrompt}`);
|