@wonderwhy-er/desktop-commander 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +88 -27
  3. package/dist/command-manager.js +1 -1
  4. package/dist/config-manager.d.ts +1 -0
  5. package/dist/config-manager.js +21 -4
  6. package/dist/config.d.ts +2 -2
  7. package/dist/config.js +2 -3
  8. package/dist/error-handlers.js +1 -1
  9. package/dist/handlers/edit-search-handlers.d.ts +3 -1
  10. package/dist/handlers/edit-search-handlers.js +6 -12
  11. package/dist/handlers/filesystem-handlers.js +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/polyform-license-src/edit/edit.d.ts +15 -0
  14. package/dist/polyform-license-src/edit/edit.js +163 -0
  15. package/dist/polyform-license-src/edit/fuzzySearch.d.ts +30 -0
  16. package/dist/polyform-license-src/edit/fuzzySearch.js +121 -0
  17. package/dist/polyform-license-src/edit/handlers.d.ts +16 -0
  18. package/dist/polyform-license-src/edit/handlers.js +24 -0
  19. package/dist/polyform-license-src/edit/index.d.ts +12 -0
  20. package/dist/polyform-license-src/edit/index.js +13 -0
  21. package/dist/polyform-license-src/edit/schemas.d.ts +25 -0
  22. package/dist/polyform-license-src/edit/schemas.js +16 -0
  23. package/dist/polyform-license-src/index.d.ts +9 -0
  24. package/dist/polyform-license-src/index.js +10 -0
  25. package/dist/server.js +71 -43
  26. package/dist/setup-claude-server.js +549 -288
  27. package/dist/terminal-manager.js +4 -2
  28. package/dist/tools/edit.d.ts +8 -6
  29. package/dist/tools/edit.js +161 -34
  30. package/dist/tools/execute.js +2 -2
  31. package/dist/tools/filesystem.js +59 -10
  32. package/dist/tools/fuzzySearch.d.ts +22 -0
  33. package/dist/tools/fuzzySearch.js +113 -0
  34. package/dist/tools/pdf-reader.d.ts +13 -0
  35. package/dist/tools/pdf-reader.js +214 -0
  36. package/dist/tools/schemas.d.ts +12 -3
  37. package/dist/tools/schemas.js +5 -2
  38. package/dist/tools/search.js +5 -4
  39. package/dist/utils/capture.d.ts +15 -0
  40. package/dist/utils/capture.js +175 -0
  41. package/dist/utils/withTimeout.d.ts +11 -0
  42. package/dist/utils/withTimeout.js +52 -0
  43. package/dist/utils.d.ts +10 -1
  44. package/dist/utils.js +99 -26
  45. package/dist/version.d.ts +1 -1
  46. package/dist/version.js +1 -1
  47. package/package.json +2 -2
@@ -0,0 +1,121 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ import { distance } from 'fastest-levenshtein';
10
+ import { capture } from '../../utils.js';
11
+ /**
12
+ * Recursively finds the closest match to a query string within text using fuzzy matching
13
+ * @param text The text to search within
14
+ * @param query The query string to find
15
+ * @param start Start index in the text (default: 0)
16
+ * @param end End index in the text (default: text.length)
17
+ * @param parentDistance Best distance found so far (default: Infinity)
18
+ * @returns Object with start and end indices, matched value, and Levenshtein distance
19
+ */
20
+ export function recursiveFuzzyIndexOf(text, query, start = 0, end = null, parentDistance = Infinity, depth = 0) {
21
+ // For debugging and performance tracking purposes
22
+ if (depth === 0) {
23
+ const startTime = performance.now();
24
+ const result = recursiveFuzzyIndexOf(text, query, start, end, parentDistance, depth + 1);
25
+ const executionTime = performance.now() - startTime;
26
+ // Capture detailed metrics for the recursive search for in-depth analysis
27
+ capture('fuzzy_search_recursive_metrics', {
28
+ execution_time_ms: executionTime,
29
+ text_length: text.length,
30
+ query_length: query.length,
31
+ result_distance: result.distance
32
+ });
33
+ return result;
34
+ }
35
+ if (end === null)
36
+ end = text.length;
37
+ // For small text segments, use iterative approach
38
+ if (end - start <= 2 * query.length) {
39
+ return iterativeReduction(text, query, start, end, parentDistance);
40
+ }
41
+ let midPoint = start + Math.floor((end - start) / 2);
42
+ let leftEnd = Math.min(end, midPoint + query.length); // Include query length to cover overlaps
43
+ let rightStart = Math.max(start, midPoint - query.length); // Include query length to cover overlaps
44
+ // Calculate distance for current segments
45
+ let leftDistance = distance(text.substring(start, leftEnd), query);
46
+ let rightDistance = distance(text.substring(rightStart, end), query);
47
+ let bestDistance = Math.min(leftDistance, parentDistance, rightDistance);
48
+ // If parent distance is already the best, use iterative approach
49
+ if (parentDistance === bestDistance) {
50
+ return iterativeReduction(text, query, start, end, parentDistance);
51
+ }
52
+ // Recursively search the better half
53
+ if (leftDistance < rightDistance) {
54
+ return recursiveFuzzyIndexOf(text, query, start, leftEnd, bestDistance, depth + 1);
55
+ }
56
+ else {
57
+ return recursiveFuzzyIndexOf(text, query, rightStart, end, bestDistance, depth + 1);
58
+ }
59
+ }
60
+ /**
61
+ * Iteratively refines the best match by reducing the search area
62
+ * @param text The text to search within
63
+ * @param query The query string to find
64
+ * @param start Start index in the text
65
+ * @param end End index in the text
66
+ * @param parentDistance Best distance found so far
67
+ * @returns Object with start and end indices, matched value, and Levenshtein distance
68
+ */
69
+ function iterativeReduction(text, query, start, end, parentDistance) {
70
+ const startTime = performance.now();
71
+ let iterations = 0;
72
+ let bestDistance = parentDistance;
73
+ let bestStart = start;
74
+ let bestEnd = end;
75
+ // Improve start position
76
+ let nextDistance = distance(text.substring(bestStart + 1, bestEnd), query);
77
+ while (nextDistance < bestDistance) {
78
+ bestDistance = nextDistance;
79
+ bestStart++;
80
+ const smallerString = text.substring(bestStart + 1, bestEnd);
81
+ nextDistance = distance(smallerString, query);
82
+ iterations++;
83
+ }
84
+ // Improve end position
85
+ nextDistance = distance(text.substring(bestStart, bestEnd - 1), query);
86
+ while (nextDistance < bestDistance) {
87
+ bestDistance = nextDistance;
88
+ bestEnd--;
89
+ const smallerString = text.substring(bestStart, bestEnd - 1);
90
+ nextDistance = distance(smallerString, query);
91
+ iterations++;
92
+ }
93
+ const executionTime = performance.now() - startTime;
94
+ // Capture metrics for the iterative refinement phase
95
+ capture('fuzzy_search_iterative_metrics', {
96
+ execution_time_ms: executionTime,
97
+ iterations: iterations,
98
+ segment_length: end - start,
99
+ query_length: query.length,
100
+ final_distance: bestDistance
101
+ });
102
+ return {
103
+ start: bestStart,
104
+ end: bestEnd,
105
+ value: text.substring(bestStart, bestEnd),
106
+ distance: bestDistance
107
+ };
108
+ }
109
+ /**
110
+ * Calculates the similarity ratio between two strings
111
+ * @param a First string
112
+ * @param b Second string
113
+ * @returns Similarity ratio (0-1)
114
+ */
115
+ export function getSimilarityRatio(a, b) {
116
+ const maxLength = Math.max(a.length, b.length);
117
+ if (maxLength === 0)
118
+ return 1; // Both strings are empty
119
+ const levenshteinDistance = distance(a, b);
120
+ return 1 - (levenshteinDistance / maxLength);
121
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ import { ServerResult } from '../../types.js';
10
+ /**
11
+ * Handle edit_block command with enhanced functionality
12
+ * - Supports multiple replacements
13
+ * - Validates expected replacements count
14
+ * - Provides detailed error messages
15
+ */
16
+ export declare function handleEnhancedEditBlock(args: unknown): Promise<ServerResult>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ import { performSearchReplace } from './edit.js';
10
+ import { EditBlockArgsSchema } from './schemas.js';
11
+ /**
12
+ * Handle edit_block command with enhanced functionality
13
+ * - Supports multiple replacements
14
+ * - Validates expected replacements count
15
+ * - Provides detailed error messages
16
+ */
17
+ export async function handleEnhancedEditBlock(args) {
18
+ const parsed = EditBlockArgsSchema.parse(args);
19
+ const searchReplace = {
20
+ search: parsed.old_string,
21
+ replace: parsed.new_string
22
+ };
23
+ return performSearchReplace(parsed.file_path, searchReplace, parsed.expected_replacements);
24
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ export * from './edit.js';
10
+ export * from './fuzzySearch.js';
11
+ export * from './handlers.js';
12
+ export * from './schemas.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ // Export all enhanced edit functionality
10
+ export * from './edit.js';
11
+ export * from './fuzzySearch.js';
12
+ export * from './handlers.js';
13
+ export * from './schemas.js';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ import { z } from 'zod';
10
+ export declare const EditBlockArgsSchema: z.ZodObject<{
11
+ file_path: z.ZodString;
12
+ old_string: z.ZodString;
13
+ new_string: z.ZodString;
14
+ expected_replacements: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ file_path: string;
17
+ old_string: string;
18
+ new_string: string;
19
+ expected_replacements: number;
20
+ }, {
21
+ file_path: string;
22
+ old_string: string;
23
+ new_string: string;
24
+ expected_replacements?: number | undefined;
25
+ }>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ import { z } from 'zod';
10
+ // Enhanced edit block schema with separate parameters for clarity
11
+ export const EditBlockArgsSchema = z.object({
12
+ file_path: z.string(),
13
+ old_string: z.string(),
14
+ new_string: z.string(),
15
+ expected_replacements: z.number().optional().default(1),
16
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ export * from './edit/index.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
+ *
4
+ * Copyright (c) 2025 Desktope Commander MCP Contributors
5
+ *
6
+ * This file is licensed under the PolyForm Small Business License 1.0.0
7
+ * See the LICENSE file in the /src/polyform directory for the full license text.
8
+ */
9
+ // Export all PolyForm-licensed functionality
10
+ export * from './edit/index.js';
package/dist/server.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
3
3
  import { zodToJsonSchema } from "zod-to-json-schema";
4
- import { ExecuteCommandArgsSchema, ReadOutputArgsSchema, ForceTerminateArgsSchema, ListSessionsArgsSchema, KillProcessArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, WriteFileArgsSchema, CreateDirectoryArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, SearchFilesArgsSchema, GetFileInfoArgsSchema, EditBlockArgsSchema, SearchCodeArgsSchema, GetConfigArgsSchema, SetConfigValueArgsSchema, ListProcessesArgsSchema, } from './tools/schemas.js';
4
+ // Shared constants for tool descriptions
5
+ const PATH_GUIDANCE = `IMPORTANT: Always use absolute paths (starting with '/' or drive letter like 'C:\\') for reliability. Relative paths may fail as they depend on the current working directory. Tilde paths (~/...) might not work in all contexts. Unless the user explicitly asks for relative paths, use absolute paths.`;
6
+ import { ExecuteCommandArgsSchema, ReadOutputArgsSchema, ForceTerminateArgsSchema, ListSessionsArgsSchema, KillProcessArgsSchema, ReadFileArgsSchema, ReadMultipleFilesArgsSchema, WriteFileArgsSchema, CreateDirectoryArgsSchema, ListDirectoryArgsSchema, MoveFileArgsSchema, SearchFilesArgsSchema, GetFileInfoArgsSchema, SearchCodeArgsSchema, GetConfigArgsSchema, SetConfigValueArgsSchema, ListProcessesArgsSchema, EditBlockArgsSchema, } from './tools/schemas.js';
5
7
  import { getConfig, setConfigValue } from './tools/config.js';
6
8
  import { VERSION } from './version.js';
7
- import { capture } from "./utils.js";
9
+ import { capture } from "./utils/capture.js";
8
10
  console.error("Loading server.ts");
9
11
  export const server = new Server({
10
12
  name: "desktop-commander",
@@ -47,90 +49,116 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
47
49
  description: "Set a specific configuration value by key. WARNING: Should be used in a separate chat from file operations and command execution to prevent security issues. Config keys include: blockedCommands (array), defaultShell (string), allowedDirectories (array of paths). IMPORTANT: Setting allowedDirectories to an empty array ([]) allows full access to the entire file system, regardless of the operating system.",
48
50
  inputSchema: zodToJsonSchema(SetConfigValueArgsSchema),
49
51
  },
50
- // Terminal tools
51
- {
52
- name: "execute_command",
53
- description: "Execute a terminal command with timeout. Command will continue running in background if it doesn't complete within timeout.",
54
- inputSchema: zodToJsonSchema(ExecuteCommandArgsSchema),
55
- },
56
- {
57
- name: "read_output",
58
- description: "Read new output from a running terminal session.",
59
- inputSchema: zodToJsonSchema(ReadOutputArgsSchema),
60
- },
61
- {
62
- name: "force_terminate",
63
- description: "Force terminate a running terminal session.",
64
- inputSchema: zodToJsonSchema(ForceTerminateArgsSchema),
65
- },
66
- {
67
- name: "list_sessions",
68
- description: "List all active terminal sessions.",
69
- inputSchema: zodToJsonSchema(ListSessionsArgsSchema),
70
- },
71
- {
72
- name: "list_processes",
73
- description: "List all running processes. Returns process information including PID, command name, CPU usage, and memory usage.",
74
- inputSchema: zodToJsonSchema(ListProcessesArgsSchema),
75
- },
76
- {
77
- name: "kill_process",
78
- description: "Terminate a running process by PID. Use with caution as this will forcefully terminate the specified process.",
79
- inputSchema: zodToJsonSchema(KillProcessArgsSchema),
80
- },
81
52
  // Filesystem tools
82
53
  {
83
54
  name: "read_file",
84
- description: "Read the complete contents of a file from the file system or a URL. When reading from the file system, only works within allowed directories. Can fetch content from URLs when isUrl parameter is set to true. Handles text files normally and image files are returned as viewable images. Recognized image types: PNG, JPEG, GIF, WebP.",
55
+ description: `Read the complete contents of a file from the file system or a URL. Prefer this over 'execute_command' with cat/type for viewing files. When reading from the file system, only works within allowed directories. Can fetch content from URLs when isUrl parameter is set to true. Handles text files normally and image files are returned as viewable images. Recognized image types: PNG, JPEG, GIF, WebP. ${PATH_GUIDANCE}`,
85
56
  inputSchema: zodToJsonSchema(ReadFileArgsSchema),
86
57
  },
87
58
  {
88
59
  name: "read_multiple_files",
89
- description: "Read the contents of multiple files simultaneously. Each file's content is returned with its path as a reference. Handles text files normally and renders images as viewable content. Recognized image types: PNG, JPEG, GIF, WebP. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.",
60
+ description: `Read the contents of multiple files simultaneously. Each file's content is returned with its path as a reference. Handles text files normally and renders images as viewable content. Recognized image types: PNG, JPEG, GIF, WebP. Failed reads for individual files won't stop the entire operation. Only works within allowed directories. ${PATH_GUIDANCE}`,
90
61
  inputSchema: zodToJsonSchema(ReadMultipleFilesArgsSchema),
91
62
  },
92
63
  {
93
64
  name: "write_file",
94
- description: "Completely replace file contents. Best for large changes (>20% of file) or when edit_block fails. Use with caution as it will overwrite existing files. Only works within allowed directories.",
65
+ description: `Completely replace file contents. Best for large changes (>20% of file) or when edit_block fails. Use with caution as it will overwrite existing files. Only works within allowed directories. ${PATH_GUIDANCE}`,
95
66
  inputSchema: zodToJsonSchema(WriteFileArgsSchema),
96
67
  },
97
68
  {
98
69
  name: "create_directory",
99
- description: "Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. Only works within allowed directories.",
70
+ description: `Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. Only works within allowed directories. ${PATH_GUIDANCE}`,
100
71
  inputSchema: zodToJsonSchema(CreateDirectoryArgsSchema),
101
72
  },
102
73
  {
103
74
  name: "list_directory",
104
- description: "Get a detailed listing of all files and directories in a specified path. Results distinguish between files and directories with [FILE] and [DIR] prefixes. Only works within allowed directories.",
75
+ description: `Get a detailed listing of all files and directories in a specified path. Use this instead of 'execute_command' with ls/dir commands. Results distinguish between files and directories with [FILE] and [DIR] prefixes. Only works within allowed directories. ${PATH_GUIDANCE}`,
105
76
  inputSchema: zodToJsonSchema(ListDirectoryArgsSchema),
106
77
  },
107
78
  {
108
79
  name: "move_file",
109
- description: "Move or rename files and directories. Can move files between directories and rename them in a single operation. Both source and destination must be within allowed directories.",
80
+ description: `Move or rename files and directories.
81
+ Can move files between directories and rename them in a single operation.
82
+ Both source and destination must be within allowed directories. ${PATH_GUIDANCE}`,
110
83
  inputSchema: zodToJsonSchema(MoveFileArgsSchema),
111
84
  },
112
85
  {
113
86
  name: "search_files",
114
- description: "Finds files by name using a case-insensitive substring matching. Searches through all subdirectories from the starting path. Has a default timeout of 30 seconds which can be customized using the timeoutMs parameter. Only searches within allowed directories.",
87
+ description: `Finds files by name using a case-insensitive substring matching.
88
+ Use this instead of 'execute_command' with find/dir/ls for locating files.
89
+ Searches through all subdirectories from the starting path.
90
+ Has a default timeout of 30 seconds which can be customized using the timeoutMs parameter.
91
+ Only searches within allowed directories. ${PATH_GUIDANCE}`,
115
92
  inputSchema: zodToJsonSchema(SearchFilesArgsSchema),
116
93
  },
117
94
  {
118
95
  name: "search_code",
119
- description: "Search for text/code patterns within file contents using ripgrep. Fast and powerful search similar to VS Code search functionality. Supports regular expressions, file pattern filtering, and context lines. Has a default timeout of 30 seconds which can be customized. Only searches within allowed directories.",
96
+ description: `Search for text/code patterns within file contents using ripgrep.
97
+ Use this instead of 'execute_command' with grep/find for searching code content.
98
+ Fast and powerful search similar to VS Code search functionality.
99
+ Supports regular expressions, file pattern filtering, and context lines.
100
+ Has a default timeout of 30 seconds which can be customized.
101
+ Only searches within allowed directories.
102
+ ${PATH_GUIDANCE}`,
120
103
  inputSchema: zodToJsonSchema(SearchCodeArgsSchema),
121
104
  },
122
105
  {
123
106
  name: "get_file_info",
124
- description: "Retrieve detailed metadata about a file or directory including size, creation time, last modified time, permissions, and type. Only works within allowed directories.",
107
+ description: `Retrieve detailed metadata about a file or directory including size, creation time, last modified time,
108
+ permissions, and type.
109
+ Only works within allowed directories. ${PATH_GUIDANCE}`,
125
110
  inputSchema: zodToJsonSchema(GetFileInfoArgsSchema),
126
111
  },
127
112
  // Note: list_allowed_directories removed - use get_config to check allowedDirectories
128
113
  // Text editing tools
129
114
  {
130
115
  name: "edit_block",
131
- description: "Apply surgical text replacements to files. Best for small changes (<20% of file size). Call repeatedly to change multiple blocks. Will verify changes after application. Format:\nfilepath\n<<<<<<< SEARCH\ncontent to find\n=======\nnew content\n>>>>>>> REPLACE",
116
+ description: `Apply surgical text replacements to files.
117
+ BEST PRACTICE: Make multiple small, focused edits rather than one large edit.
118
+ Each edit_block call should change only what needs to be changed - include just enough context to uniquely identify the text being modified.
119
+ Takes file_path, old_string (text to replace), new_string (replacement text), and optional expected_replacements parameter.
120
+ By default, replaces only ONE occurrence of the search text.
121
+ To replace multiple occurrences, provide the expected_replacements parameter with the exact number of matches expected.
122
+ UNIQUENESS REQUIREMENT: When expected_replacements=1 (default), include the minimal amount of context necessary (typically 1-3 lines) before and after the change point, with exact whitespace and indentation.
123
+ When editing multiple sections, make separate edit_block calls for each distinct change rather than one large replacement.
124
+ When a close but non-exact match is found, a character-level diff is shown in the format: common_prefix{-removed-}{+added+}common_suffix to help you identify what's different.
125
+ ${PATH_GUIDANCE}`,
132
126
  inputSchema: zodToJsonSchema(EditBlockArgsSchema),
133
127
  },
128
+ // Terminal tools
129
+ {
130
+ name: "execute_command",
131
+ description: `Execute a terminal command with timeout.
132
+ Command will continue running in background if it doesn't complete within timeout.
133
+ NOTE: For file operations, prefer specialized tools like read_file, search_code, list_directory instead of cat, grep, or ls commands.
134
+ ${PATH_GUIDANCE}`,
135
+ inputSchema: zodToJsonSchema(ExecuteCommandArgsSchema),
136
+ },
137
+ {
138
+ name: "read_output",
139
+ description: "Read new output from a running terminal session.",
140
+ inputSchema: zodToJsonSchema(ReadOutputArgsSchema),
141
+ },
142
+ {
143
+ name: "force_terminate",
144
+ description: "Force terminate a running terminal session.",
145
+ inputSchema: zodToJsonSchema(ForceTerminateArgsSchema),
146
+ },
147
+ {
148
+ name: "list_sessions",
149
+ description: "List all active terminal sessions.",
150
+ inputSchema: zodToJsonSchema(ListSessionsArgsSchema),
151
+ },
152
+ {
153
+ name: "list_processes",
154
+ description: "List all running processes. Returns process information including PID, command name, CPU usage, and memory usage.",
155
+ inputSchema: zodToJsonSchema(ListProcessesArgsSchema),
156
+ },
157
+ {
158
+ name: "kill_process",
159
+ description: "Terminate a running process by PID. Use with caution as this will forcefully terminate the specified process.",
160
+ inputSchema: zodToJsonSchema(KillProcessArgsSchema),
161
+ },
134
162
  ],
135
163
  };
136
164
  }