@j0hanz/filesystem-mcp 1.19.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/README.md +333 -838
  2. package/dist/cli-help.d.ts +3 -0
  3. package/dist/cli-help.d.ts.map +1 -0
  4. package/dist/cli-help.js +169 -0
  5. package/dist/cli-help.js.map +1 -0
  6. package/dist/cli.d.ts +28 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +168 -123
  9. package/dist/cli.js.map +1 -0
  10. package/dist/core/concurrency.d.ts +70 -0
  11. package/dist/core/concurrency.d.ts.map +1 -0
  12. package/dist/core/concurrency.js +173 -0
  13. package/dist/core/concurrency.js.map +1 -0
  14. package/dist/core/config.d.ts +19 -0
  15. package/dist/core/config.d.ts.map +1 -0
  16. package/dist/core/config.js +11 -0
  17. package/dist/core/config.js.map +1 -0
  18. package/dist/core/cursor.d.ts +23 -0
  19. package/dist/core/cursor.d.ts.map +1 -0
  20. package/dist/core/cursor.js +62 -0
  21. package/dist/core/cursor.js.map +1 -0
  22. package/dist/core/errors.d.ts +96 -0
  23. package/dist/core/errors.d.ts.map +1 -0
  24. package/dist/core/errors.js +356 -0
  25. package/dist/core/errors.js.map +1 -0
  26. package/dist/core/file-uri.d.ts +24 -0
  27. package/dist/core/file-uri.d.ts.map +1 -0
  28. package/dist/core/file-uri.js +52 -0
  29. package/dist/core/file-uri.js.map +1 -0
  30. package/dist/core/fmt.d.ts +38 -0
  31. package/dist/core/fmt.d.ts.map +1 -0
  32. package/dist/core/fmt.js +109 -0
  33. package/dist/core/fmt.js.map +1 -0
  34. package/dist/core/fs.d.ts +108 -0
  35. package/dist/core/fs.d.ts.map +1 -0
  36. package/dist/core/fs.js +243 -0
  37. package/dist/core/fs.js.map +1 -0
  38. package/dist/core/glob.d.ts +41 -0
  39. package/dist/core/glob.d.ts.map +1 -0
  40. package/dist/core/glob.js +399 -0
  41. package/dist/core/glob.js.map +1 -0
  42. package/dist/core/input-required.d.ts +147 -0
  43. package/dist/core/input-required.d.ts.map +1 -0
  44. package/dist/core/input-required.js +261 -0
  45. package/dist/core/input-required.js.map +1 -0
  46. package/dist/core/mime.d.ts +15 -0
  47. package/dist/core/mime.d.ts.map +1 -0
  48. package/dist/core/mime.js +188 -0
  49. package/dist/core/mime.js.map +1 -0
  50. package/dist/core/observability.d.ts +10 -0
  51. package/dist/core/observability.d.ts.map +1 -0
  52. package/dist/core/observability.js +76 -0
  53. package/dist/core/observability.js.map +1 -0
  54. package/dist/core/page-store.d.ts +41 -0
  55. package/dist/core/page-store.d.ts.map +1 -0
  56. package/dist/core/page-store.js +74 -0
  57. package/dist/core/page-store.js.map +1 -0
  58. package/dist/core/path-completer.d.ts +10 -0
  59. package/dist/core/path-completer.d.ts.map +1 -0
  60. package/dist/core/path-completer.js +227 -0
  61. package/dist/core/path-completer.js.map +1 -0
  62. package/dist/core/path-discovery.d.ts +8 -0
  63. package/dist/core/path-discovery.d.ts.map +1 -0
  64. package/dist/core/path-discovery.js +105 -0
  65. package/dist/core/path-discovery.js.map +1 -0
  66. package/dist/core/path-utils.d.ts +9 -0
  67. package/dist/core/path-utils.d.ts.map +1 -0
  68. package/dist/core/path-utils.js +121 -0
  69. package/dist/core/path-utils.js.map +1 -0
  70. package/dist/core/path.d.ts +148 -0
  71. package/dist/core/path.d.ts.map +1 -0
  72. package/dist/core/path.js +674 -0
  73. package/dist/core/path.js.map +1 -0
  74. package/dist/core/primitives.d.ts +23 -0
  75. package/dist/core/primitives.d.ts.map +1 -0
  76. package/dist/core/primitives.js +54 -0
  77. package/dist/core/primitives.js.map +1 -0
  78. package/dist/core/read.d.ts +74 -0
  79. package/dist/core/read.d.ts.map +1 -0
  80. package/dist/core/read.js +562 -0
  81. package/dist/core/read.js.map +1 -0
  82. package/dist/core/schema.d.ts +139 -0
  83. package/dist/core/schema.d.ts.map +1 -0
  84. package/dist/core/schema.js +345 -0
  85. package/dist/core/schema.js.map +1 -0
  86. package/dist/core/search.d.ts +100 -0
  87. package/dist/core/search.d.ts.map +1 -0
  88. package/dist/core/search.js +248 -0
  89. package/dist/core/search.js.map +1 -0
  90. package/dist/core/sensitive.d.ts +6 -0
  91. package/dist/core/sensitive.d.ts.map +1 -0
  92. package/dist/core/sensitive.js +142 -0
  93. package/dist/core/sensitive.js.map +1 -0
  94. package/dist/core/store.d.ts +57 -0
  95. package/dist/core/store.d.ts.map +1 -0
  96. package/dist/core/store.js +162 -0
  97. package/dist/core/store.js.map +1 -0
  98. package/dist/core/util.d.ts +26 -0
  99. package/dist/core/util.d.ts.map +1 -0
  100. package/dist/core/util.js +66 -0
  101. package/dist/core/util.js.map +1 -0
  102. package/dist/core/watcher-registry.d.ts +68 -0
  103. package/dist/core/watcher-registry.d.ts.map +1 -0
  104. package/dist/core/watcher-registry.js +312 -0
  105. package/dist/core/watcher-registry.js.map +1 -0
  106. package/dist/http-policy.d.ts +121 -0
  107. package/dist/http-policy.d.ts.map +1 -0
  108. package/dist/http-policy.js +340 -0
  109. package/dist/http-policy.js.map +1 -0
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +77 -41
  113. package/dist/index.js.map +1 -0
  114. package/dist/instructions.d.ts +12 -0
  115. package/dist/instructions.d.ts.map +1 -0
  116. package/dist/instructions.js +71 -0
  117. package/dist/instructions.js.map +1 -0
  118. package/dist/prompts.d.ts +8 -6
  119. package/dist/prompts.d.ts.map +1 -0
  120. package/dist/prompts.js +74 -168
  121. package/dist/prompts.js.map +1 -0
  122. package/dist/resources.d.ts +73 -9
  123. package/dist/resources.d.ts.map +1 -0
  124. package/dist/resources.js +392 -163
  125. package/dist/resources.js.map +1 -0
  126. package/dist/server.d.ts +62 -1
  127. package/dist/server.d.ts.map +1 -0
  128. package/dist/server.js +139 -1
  129. package/dist/server.js.map +1 -0
  130. package/dist/tools/batch.d.ts +89 -0
  131. package/dist/tools/batch.d.ts.map +1 -0
  132. package/dist/tools/batch.js +157 -0
  133. package/dist/tools/batch.js.map +1 -0
  134. package/dist/tools/create.d.ts +2 -0
  135. package/dist/tools/create.d.ts.map +1 -0
  136. package/dist/tools/create.js +142 -0
  137. package/dist/tools/create.js.map +1 -0
  138. package/dist/tools/define.d.ts +110 -0
  139. package/dist/tools/define.d.ts.map +1 -0
  140. package/dist/tools/define.js +394 -0
  141. package/dist/tools/define.js.map +1 -0
  142. package/dist/tools/delete-file.d.ts +2 -4
  143. package/dist/tools/delete-file.d.ts.map +1 -0
  144. package/dist/tools/delete-file.js +330 -87
  145. package/dist/tools/delete-file.js.map +1 -0
  146. package/dist/tools/diff.d.ts +2 -0
  147. package/dist/tools/diff.d.ts.map +1 -0
  148. package/dist/tools/diff.js +94 -0
  149. package/dist/tools/diff.js.map +1 -0
  150. package/dist/tools/edit.d.ts +2 -0
  151. package/dist/tools/edit.d.ts.map +1 -0
  152. package/dist/tools/edit.js +442 -0
  153. package/dist/tools/edit.js.map +1 -0
  154. package/dist/tools/index.d.ts +26 -0
  155. package/dist/tools/index.d.ts.map +1 -0
  156. package/dist/tools/index.js +52 -0
  157. package/dist/tools/index.js.map +1 -0
  158. package/dist/tools/list.d.ts +2 -0
  159. package/dist/tools/list.d.ts.map +1 -0
  160. package/dist/tools/list.js +291 -0
  161. package/dist/tools/list.js.map +1 -0
  162. package/dist/tools/move.d.ts +2 -0
  163. package/dist/tools/move.d.ts.map +1 -0
  164. package/dist/tools/move.js +321 -0
  165. package/dist/tools/move.js.map +1 -0
  166. package/dist/tools/patch.d.ts +2 -0
  167. package/dist/tools/patch.d.ts.map +1 -0
  168. package/dist/tools/patch.js +155 -0
  169. package/dist/tools/patch.js.map +1 -0
  170. package/dist/tools/progress.d.ts +52 -0
  171. package/dist/tools/progress.d.ts.map +1 -0
  172. package/dist/tools/progress.js +172 -0
  173. package/dist/tools/progress.js.map +1 -0
  174. package/dist/tools/read.d.ts +2 -4
  175. package/dist/tools/read.d.ts.map +1 -0
  176. package/dist/tools/read.js +398 -152
  177. package/dist/tools/read.js.map +1 -0
  178. package/dist/tools/replace-in-files.d.ts +2 -4
  179. package/dist/tools/replace-in-files.d.ts.map +1 -0
  180. package/dist/tools/replace-in-files.js +435 -264
  181. package/dist/tools/replace-in-files.js.map +1 -0
  182. package/dist/tools/roots.d.ts +2 -4
  183. package/dist/tools/roots.d.ts.map +1 -0
  184. package/dist/tools/roots.js +29 -52
  185. package/dist/tools/roots.js.map +1 -0
  186. package/dist/tools/search-content.d.ts +2 -4
  187. package/dist/tools/search-content.d.ts.map +1 -0
  188. package/dist/tools/search-content.js +262 -228
  189. package/dist/tools/search-content.js.map +1 -0
  190. package/dist/tools/search-files.d.ts +2 -4
  191. package/dist/tools/search-files.d.ts.map +1 -0
  192. package/dist/tools/search-files.js +162 -161
  193. package/dist/tools/search-files.js.map +1 -0
  194. package/dist/tools/stat.d.ts +2 -4
  195. package/dist/tools/stat.d.ts.map +1 -0
  196. package/dist/tools/stat.js +202 -62
  197. package/dist/tools/stat.js.map +1 -0
  198. package/dist/transport/http.d.ts +5 -0
  199. package/dist/transport/http.d.ts.map +1 -0
  200. package/dist/transport/http.js +276 -0
  201. package/dist/transport/http.js.map +1 -0
  202. package/dist/transport/shared.d.ts +45 -0
  203. package/dist/transport/shared.d.ts.map +1 -0
  204. package/dist/transport/shared.js +65 -0
  205. package/dist/transport/shared.js.map +1 -0
  206. package/dist/transport/stdio.d.ts +32 -0
  207. package/dist/transport/stdio.d.ts.map +1 -0
  208. package/dist/transport/stdio.js +279 -0
  209. package/dist/transport/stdio.js.map +1 -0
  210. package/dist/transport.d.ts +5 -0
  211. package/dist/transport.d.ts.map +1 -0
  212. package/dist/transport.js +4 -0
  213. package/dist/transport.js.map +1 -0
  214. package/package.json +37 -46
  215. package/dist/assets/logo.svg +0 -35
  216. package/dist/completions.d.ts +0 -2
  217. package/dist/completions.js +0 -572
  218. package/dist/config.d.ts +0 -119
  219. package/dist/config.js +0 -31
  220. package/dist/lib/abort.d.ts +0 -7
  221. package/dist/lib/abort.js +0 -81
  222. package/dist/lib/constants.d.ts +0 -42
  223. package/dist/lib/constants.js +0 -313
  224. package/dist/lib/errors.d.ts +0 -28
  225. package/dist/lib/errors.js +0 -301
  226. package/dist/lib/file-operations/core.d.ts +0 -53
  227. package/dist/lib/file-operations/core.js +0 -144
  228. package/dist/lib/file-operations/metadata.d.ts +0 -77
  229. package/dist/lib/file-operations/metadata.js +0 -878
  230. package/dist/lib/file-operations/search.d.ts +0 -46
  231. package/dist/lib/file-operations/search.js +0 -1194
  232. package/dist/lib/file-operations/traversal.d.ts +0 -40
  233. package/dist/lib/file-operations/traversal.js +0 -310
  234. package/dist/lib/fs-helpers.d.ts +0 -46
  235. package/dist/lib/fs-helpers.js +0 -606
  236. package/dist/lib/globs.d.ts +0 -2
  237. package/dist/lib/globs.js +0 -19
  238. package/dist/lib/logger.d.ts +0 -27
  239. package/dist/lib/logger.js +0 -91
  240. package/dist/lib/observability.d.ts +0 -33
  241. package/dist/lib/observability.js +0 -373
  242. package/dist/lib/paths.d.ts +0 -35
  243. package/dist/lib/paths.js +0 -634
  244. package/dist/lib/resource-store.d.ts +0 -28
  245. package/dist/lib/resource-store.js +0 -195
  246. package/dist/lib/utils.d.ts +0 -7
  247. package/dist/lib/utils.js +0 -37
  248. package/dist/lib/zod-codecs.d.ts +0 -2
  249. package/dist/lib/zod-codecs.js +0 -18
  250. package/dist/pkg-info.d.ts +0 -7
  251. package/dist/pkg-info.js +0 -9
  252. package/dist/resources/generated-instructions.d.ts +0 -1
  253. package/dist/resources/generated-instructions.js +0 -105
  254. package/dist/resources/tool-catalog.d.ts +0 -2
  255. package/dist/resources/tool-catalog.js +0 -78
  256. package/dist/resources/tool-info.d.ts +0 -9
  257. package/dist/resources/tool-info.js +0 -206
  258. package/dist/resources/workflows.d.ts +0 -1
  259. package/dist/resources/workflows.js +0 -72
  260. package/dist/schemas.d.ts +0 -505
  261. package/dist/schemas.js +0 -676
  262. package/dist/server/bootstrap.d.ts +0 -6
  263. package/dist/server/bootstrap.js +0 -563
  264. package/dist/server/event-store.d.ts +0 -18
  265. package/dist/server/event-store.js +0 -71
  266. package/dist/server/roots-manager.d.ts +0 -28
  267. package/dist/server/roots-manager.js +0 -227
  268. package/dist/server/task-store.d.ts +0 -10
  269. package/dist/server/task-store.js +0 -91
  270. package/dist/tools/apply-patch.d.ts +0 -4
  271. package/dist/tools/apply-patch.js +0 -235
  272. package/dist/tools/calculate-hash.d.ts +0 -4
  273. package/dist/tools/calculate-hash.js +0 -187
  274. package/dist/tools/contract.d.ts +0 -50
  275. package/dist/tools/contract.js +0 -1
  276. package/dist/tools/create-directory.d.ts +0 -4
  277. package/dist/tools/create-directory.js +0 -68
  278. package/dist/tools/diff-files.d.ts +0 -4
  279. package/dist/tools/diff-files.js +0 -136
  280. package/dist/tools/edit-file.d.ts +0 -4
  281. package/dist/tools/edit-file.js +0 -256
  282. package/dist/tools/icons.d.ts +0 -15
  283. package/dist/tools/icons.js +0 -24
  284. package/dist/tools/list-directory.d.ts +0 -4
  285. package/dist/tools/list-directory.js +0 -218
  286. package/dist/tools/move-file.d.ts +0 -4
  287. package/dist/tools/move-file.js +0 -178
  288. package/dist/tools/read-multiple.d.ts +0 -4
  289. package/dist/tools/read-multiple.js +0 -207
  290. package/dist/tools/shared.d.ts +0 -172
  291. package/dist/tools/shared.js +0 -599
  292. package/dist/tools/stat-many.d.ts +0 -4
  293. package/dist/tools/stat-many.js +0 -104
  294. package/dist/tools/task-support.d.ts +0 -29
  295. package/dist/tools/task-support.js +0 -472
  296. package/dist/tools/tree.d.ts +0 -4
  297. package/dist/tools/tree.js +0 -102
  298. package/dist/tools/write-file.d.ts +0 -4
  299. package/dist/tools/write-file.js +0 -60
  300. package/dist/tools.d.ts +0 -5
  301. package/dist/tools.js +0 -54
package/dist/schemas.js DELETED
@@ -1,676 +0,0 @@
1
- import { z } from 'zod';
2
- import { DEFAULT_LIST_MAX_ENTRIES, DEFAULT_SEARCH_CONTENT_RESULTS, DEFAULT_SEARCH_RESULTS, DEFAULT_TREE_DEPTH, DEFAULT_TREE_ENTRIES, MAX_LIST_ENTRIES, MAX_SEARCH_DEPTH, MAX_SEARCH_RESULTS, MAX_TREE_DEPTH, MAX_TREE_ENTRIES, } from './lib/constants.js';
3
- import { ErrorCode } from './lib/errors.js';
4
- import { isSafeGlobPattern } from './lib/globs.js';
5
- const MAX_PATH_LENGTH = 4096;
6
- const DESC_PATH_ROOT = 'Base directory (default: root). Absolute path required if multiple roots.';
7
- const DESC_PATH_REQUIRED = 'Absolute path to file or directory.';
8
- function defaultFalseBoolean(description) {
9
- return z.boolean().optional().default(false).describe(description);
10
- }
11
- const SuccessFlagSchema = z.literal(true);
12
- const NonNegativeIntegerSchema = z.int().min(0, 'Min: 0');
13
- const PositiveIntegerSchema = z.int().min(1, 'Min: 1');
14
- const IsoDateTimeSchema = z.iso.datetime();
15
- const Sha256HexSchema = z
16
- .string()
17
- .regex(/^[a-f0-9]{64}$/u, 'Expected SHA-256 hex digest');
18
- const PathSchemaBase = z
19
- .string()
20
- .max(MAX_PATH_LENGTH, `Path too long (max ${MAX_PATH_LENGTH} chars)`);
21
- const OptionalPathSchema = PathSchemaBase.optional();
22
- const RequiredPathSchema = PathSchemaBase.min(1, 'Path required');
23
- const SafeGlobPatternSchema = z
24
- .string()
25
- .min(1, 'Pattern required')
26
- .max(1000, 'Max 1000 chars')
27
- .refine((val) => isSafeGlobPattern(val), {
28
- error: 'Invalid glob or unsafe path (absolute/.. forbidden)',
29
- });
30
- const FileTypeSchema = z.enum(['file', 'directory', 'symlink', 'other']);
31
- const ListDirectorySortSchema = z.enum(['name', 'size', 'modified', 'type']);
32
- const SearchFilesSortSchema = z.enum(['name', 'size', 'modified', 'path']);
33
- const SearchStopReasonSchema = z
34
- .enum(['maxResults', 'maxFiles', 'timeout'])
35
- .describe('maxResults: result limit hit; maxFiles: file count limit hit; timeout: time limit exceeded');
36
- const ListDirectoryStopReasonSchema = z
37
- .enum(['maxEntries', 'aborted'])
38
- .describe('maxEntries: entry limit hit; aborted: operation was cancelled');
39
- const TreeEntrySchema = z.lazy(() => z.strictObject({
40
- name: z.string().describe('Name'),
41
- type: FileTypeSchema.describe('Type'),
42
- relativePath: z.string().describe('Relative path'),
43
- size: z.number().optional().describe('File size bytes (when includeSizes)'),
44
- children: z.array(TreeEntrySchema).optional().describe('Children'),
45
- }));
46
- const ErrorSchema = z.strictObject({
47
- code: z.enum(ErrorCode).describe('Error code (e.g. NOT_FOUND)'),
48
- message: z.string().describe('Human-readable message'),
49
- path: z.string().optional().describe('Relevant path'),
50
- suggestion: z.string().optional().describe('Fix suggestion'),
51
- });
52
- const HeadLinesSchema = z
53
- .int({ error: 'Must be integer' })
54
- .min(1, 'Min: 1')
55
- .max(100000, 'Max: 100,000')
56
- .optional()
57
- .describe('Read first N lines');
58
- const TailLinesSchema = z
59
- .int({ error: 'Must be integer' })
60
- .min(1, 'Min: 1')
61
- .max(100000, 'Max: 100,000')
62
- .optional()
63
- .describe('Read last N lines');
64
- const LineNumberSchema = z.int({ error: 'Must be integer' }).min(1, 'Min: 1');
65
- function addReadRangeIssue(ctx, input, path, message) {
66
- ctx.addIssue({
67
- code: 'custom',
68
- path: [path],
69
- message,
70
- input,
71
- });
72
- }
73
- const validateReadRange = (value, ctx) => {
74
- const hasHead = value.head !== undefined;
75
- const hasTail = value.tail !== undefined;
76
- const hasStart = value.startLine !== undefined;
77
- const hasEnd = value.endLine !== undefined;
78
- if (hasHead && (hasStart || hasEnd)) {
79
- addReadRangeIssue(ctx, value, 'head', "Cannot use 'head' with 'startLine'/'endLine'");
80
- }
81
- if (hasTail && (hasHead || hasStart || hasEnd)) {
82
- addReadRangeIssue(ctx, value, 'tail', "Cannot use 'tail' with 'head'/'startLine'/'endLine'");
83
- }
84
- const effectiveStart = value.startLine ?? 1;
85
- if (value.endLine !== undefined && value.endLine < effectiveStart) {
86
- addReadRangeIssue(ctx, value, 'endLine', "'endLine' must be >= 'startLine'");
87
- }
88
- };
89
- function createReadRangeInputFields(descriptions) {
90
- return {
91
- head: HeadLinesSchema.describe(descriptions.head),
92
- tail: TailLinesSchema.describe(descriptions.tail),
93
- startLine: LineNumberSchema.optional().describe(descriptions.startLine),
94
- endLine: LineNumberSchema.optional().describe(descriptions.endLine),
95
- };
96
- }
97
- const FileInfoSchema = z.strictObject({
98
- name: z.string().describe('Name'),
99
- path: z.string().describe('Absolute path'),
100
- type: FileTypeSchema.describe('Type'),
101
- size: NonNegativeIntegerSchema.describe('Size (bytes)'),
102
- tokenEstimate: NonNegativeIntegerSchema.optional().describe('Est. tokens (size/4)'),
103
- created: IsoDateTimeSchema.describe('Created'),
104
- modified: IsoDateTimeSchema.describe('Modified'),
105
- accessed: IsoDateTimeSchema.describe('Accessed'),
106
- permissions: z.string().describe('Permissions'),
107
- isHidden: z.boolean().describe('Hidden?'),
108
- mimeType: z.string().optional().describe('MIME type'),
109
- symlinkTarget: z.string().optional().describe('Target (symlink)'),
110
- });
111
- const OperationSummarySchema = z.strictObject({
112
- total: NonNegativeIntegerSchema.describe('Total'),
113
- succeeded: NonNegativeIntegerSchema.describe('Succeeded'),
114
- failed: NonNegativeIntegerSchema.describe('Failed'),
115
- });
116
- export const ListDirectoryInputSchema = z.strictObject({
117
- path: OptionalPathSchema.describe(DESC_PATH_ROOT),
118
- includeHidden: defaultFalseBoolean('Include hidden items (starting with .)'),
119
- includeIgnored: defaultFalseBoolean('Include ignored items (node_modules, .git, etc).'),
120
- maxDepth: z
121
- .int({ error: 'Must be integer' })
122
- .min(1, 'Min: 1')
123
- .max(MAX_TREE_DEPTH, `Max: ${MAX_TREE_DEPTH}`)
124
- .optional()
125
- .describe('Max recursion depth when pattern is provided'),
126
- maxEntries: z
127
- .int({ error: 'Must be integer' })
128
- .min(1, 'Min: 1')
129
- .max(MAX_LIST_ENTRIES, `Max: ${MAX_LIST_ENTRIES}`)
130
- .optional()
131
- .default(DEFAULT_LIST_MAX_ENTRIES)
132
- .describe(`Maximum entries to return before truncation. Default: ${DEFAULT_LIST_MAX_ENTRIES}`),
133
- sortBy: ListDirectorySortSchema.optional()
134
- .default('name')
135
- .describe('Sort field (name, size, modified, type)'),
136
- pattern: SafeGlobPatternSchema.optional().describe('Optional glob pattern filter (e.g. "**/*.ts")'),
137
- includeSymlinkTargets: defaultFalseBoolean('Resolve and include symlink targets in results'),
138
- cursor: z
139
- .string()
140
- .optional()
141
- .describe('Pagination cursor from a previous response'),
142
- });
143
- export const ListAllowedDirectoriesInputSchema = z
144
- .strictObject({})
145
- .describe('No input parameters.');
146
- export const SearchFilesInputSchema = z.strictObject({
147
- path: OptionalPathSchema.describe(DESC_PATH_ROOT),
148
- pattern: SafeGlobPatternSchema.describe('Glob pattern (e.g. "**/*.ts", "src/*.js")'),
149
- maxResults: z
150
- .int({ error: 'Must be integer' })
151
- .min(1, 'Min: 1')
152
- .max(MAX_SEARCH_RESULTS, `Max: ${MAX_SEARCH_RESULTS}`)
153
- .optional()
154
- .default(DEFAULT_SEARCH_RESULTS)
155
- .describe(`Max results (1-${MAX_SEARCH_RESULTS}). Default: ${DEFAULT_SEARCH_RESULTS}`),
156
- includeIgnored: defaultFalseBoolean('Include ignored items (node_modules, etc).'),
157
- includeHidden: defaultFalseBoolean('Include hidden items (starting with .)'),
158
- sortBy: SearchFilesSortSchema.optional()
159
- .default('path')
160
- .describe('Sort by path, name, size, or modified'),
161
- maxDepth: z
162
- .int({ error: 'Must be integer' })
163
- .min(0, 'Min: 0')
164
- .max(MAX_SEARCH_DEPTH, `Max: ${MAX_SEARCH_DEPTH}`)
165
- .optional()
166
- .describe('Maximum directory depth to scan'),
167
- cursor: z
168
- .string()
169
- .optional()
170
- .describe('Pagination cursor from a previous response'),
171
- });
172
- export const TreeInputSchema = z.strictObject({
173
- path: OptionalPathSchema.describe(DESC_PATH_ROOT),
174
- maxDepth: z
175
- .int({ error: 'Must be integer' })
176
- .min(0, 'Min: 0')
177
- .max(MAX_TREE_DEPTH, `Max: ${MAX_TREE_DEPTH}`)
178
- .optional()
179
- .default(DEFAULT_TREE_DEPTH)
180
- .describe(`Depth (0=root node only, no children). Default: ${DEFAULT_TREE_DEPTH}`),
181
- maxEntries: z
182
- .int({ error: 'Must be integer' })
183
- .min(1, 'Min: 1')
184
- .max(MAX_TREE_ENTRIES, `Max: ${MAX_TREE_ENTRIES}`)
185
- .optional()
186
- .default(DEFAULT_TREE_ENTRIES)
187
- .describe(`Max entries. Default: ${DEFAULT_TREE_ENTRIES}`),
188
- includeHidden: defaultFalseBoolean('Include hidden items (starting with .)'),
189
- includeIgnored: defaultFalseBoolean('Include ignored items. Disables .gitignore.'),
190
- includeSizes: defaultFalseBoolean('Include file sizes in tree entries'),
191
- });
192
- export const SearchContentInputSchema = z.strictObject({
193
- path: OptionalPathSchema.describe(DESC_PATH_ROOT),
194
- pattern: z
195
- .string()
196
- .min(1, 'Pattern required')
197
- .max(1000, 'Max 1000 chars')
198
- .describe('Search text. RE2 regex when `isRegex=true`.'),
199
- isRegex: defaultFalseBoolean('Treat pattern as RE2 regex (no lookahead/lookbehind/backrefs).'),
200
- caseSensitive: defaultFalseBoolean('Case-sensitive matching. Default: case-insensitive.'),
201
- wholeWord: defaultFalseBoolean('Match whole words only'),
202
- contextLines: z
203
- .int({ error: 'Must be integer' })
204
- .min(0, 'Min: 0')
205
- .max(50, 'Max: 50')
206
- .optional()
207
- .default(0)
208
- .describe('Include N lines of context before/after matches'),
209
- maxResults: z
210
- .int({ error: 'Must be integer' })
211
- .min(0, 'Min: 0')
212
- .max(MAX_SEARCH_RESULTS, `Max: ${MAX_SEARCH_RESULTS}`)
213
- .optional()
214
- .default(DEFAULT_SEARCH_CONTENT_RESULTS)
215
- .describe(`Maximum match rows to return. Default: ${DEFAULT_SEARCH_CONTENT_RESULTS}`),
216
- filePattern: SafeGlobPatternSchema.optional()
217
- .default('**/*')
218
- .describe('Glob for candidate files (e.g. "**/*.ts")'),
219
- includeHidden: defaultFalseBoolean('Include hidden items (starting with .)'),
220
- includeIgnored: defaultFalseBoolean('Include ignored items (node_modules, etc).'),
221
- });
222
- export const ReadFileInputSchema = z
223
- .strictObject({
224
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
225
- ...createReadRangeInputFields({
226
- head: 'Read first N lines (preview)',
227
- tail: 'Read last N lines',
228
- startLine: 'Start line (1-based, inclusive). Defaults to 1 when endLine is set.',
229
- endLine: 'End line (1-based, inclusive). Defaults to last line when startLine is set.',
230
- }),
231
- includeHash: defaultFalseBoolean('Include SHA-256 hash of full file content'),
232
- })
233
- .superRefine(validateReadRange)
234
- .describe("Use one read mode only: 'head', 'tail', or 'startLine'/'endLine'.");
235
- export const ReadMultipleFilesInputSchema = z
236
- .strictObject({
237
- paths: z
238
- .array(RequiredPathSchema)
239
- .min(1, 'Min 1 path required')
240
- .max(100, 'Max 100 files')
241
- .describe('Files to read. e.g. ["src/index.ts"]'),
242
- ...createReadRangeInputFields({
243
- head: 'Read first N lines of each file',
244
- tail: 'Read last N lines of each file',
245
- startLine: 'Start line (1-based, inclusive) per file. Defaults to 1 when endLine is set.',
246
- endLine: 'End line (1-based, inclusive) per file. Defaults to last line when startLine is set.',
247
- }),
248
- })
249
- .superRefine(validateReadRange)
250
- .describe("Use one read mode only: 'head', 'tail', or 'startLine'/'endLine'.");
251
- export const GetFileInfoInputSchema = z.strictObject({
252
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
253
- });
254
- export const GetMultipleFileInfoInputSchema = z.strictObject({
255
- paths: z
256
- .array(RequiredPathSchema)
257
- .min(1, 'Min 1 path required')
258
- .max(100, 'Max 100 files')
259
- .describe('File/directory paths. e.g. ["src", "lib"]'),
260
- });
261
- export const ListAllowedDirectoriesOutputSchema = z.strictObject({
262
- ok: SuccessFlagSchema,
263
- directories: z.array(z.string()).optional().describe('Allowed directories'),
264
- });
265
- export const ListDirectoryOutputSchema = z.strictObject({
266
- ok: SuccessFlagSchema,
267
- path: z.string().optional(),
268
- entries: z
269
- .array(z.strictObject({
270
- name: z.string().describe('Entry name'),
271
- relativePath: z.string().optional(),
272
- type: FileTypeSchema,
273
- size: NonNegativeIntegerSchema.optional(),
274
- modified: IsoDateTimeSchema.optional(),
275
- }))
276
- .optional(),
277
- totalEntries: NonNegativeIntegerSchema.optional(),
278
- truncated: z.boolean().optional(),
279
- totalFiles: NonNegativeIntegerSchema.optional(),
280
- totalDirectories: NonNegativeIntegerSchema.optional(),
281
- stoppedReason: ListDirectoryStopReasonSchema.optional(),
282
- skippedInaccessible: NonNegativeIntegerSchema.optional(),
283
- nextCursor: z
284
- .string()
285
- .optional()
286
- .describe('Cursor for the next page; absent on the final page'),
287
- });
288
- const SearchSummarySchema = z.strictObject({
289
- totalMatches: NonNegativeIntegerSchema.optional().describe('Total matches found'),
290
- truncated: z.boolean().optional().describe('Results truncated?'),
291
- resourceUri: z.string().optional().describe('Full results URI'),
292
- });
293
- export const SearchFilesOutputSchema = SearchSummarySchema.extend({
294
- ok: SuccessFlagSchema,
295
- root: z.string().optional().describe('Search root'),
296
- results: z
297
- .array(z.strictObject({
298
- path: z.string().describe('Relative path'),
299
- size: NonNegativeIntegerSchema.optional(),
300
- modified: IsoDateTimeSchema.optional(),
301
- }))
302
- .optional(),
303
- filesScanned: NonNegativeIntegerSchema.optional().describe('Files scanned'),
304
- skippedInaccessible: NonNegativeIntegerSchema.optional().describe('Inaccessible files'),
305
- stoppedReason: SearchStopReasonSchema.optional().describe('Why search stopped'),
306
- nextCursor: z
307
- .string()
308
- .optional()
309
- .describe('Cursor for the next page; absent on the final page'),
310
- });
311
- export const SearchContentOutputSchema = SearchSummarySchema.extend({
312
- ok: SuccessFlagSchema,
313
- matches: z
314
- .array(z.strictObject({
315
- file: z.string().describe('Relative path'),
316
- line: PositiveIntegerSchema,
317
- column: NonNegativeIntegerSchema.optional().describe('Column of first match (0-based)'),
318
- content: z.string(),
319
- matchCount: PositiveIntegerSchema,
320
- contextBefore: z.array(z.string()).optional(),
321
- contextAfter: z.array(z.string()).optional(),
322
- }))
323
- .optional(),
324
- filesScanned: NonNegativeIntegerSchema.optional().describe('Files scanned'),
325
- filesMatched: NonNegativeIntegerSchema.optional().describe('Files with matches'),
326
- skippedTooLarge: NonNegativeIntegerSchema.optional().describe('Files skipped: too large'),
327
- skippedBinary: NonNegativeIntegerSchema.optional().describe('Files skipped: binary'),
328
- skippedInaccessible: NonNegativeIntegerSchema.optional().describe('Files skipped: inaccessible'),
329
- stoppedReason: SearchStopReasonSchema.optional().describe('Why search stopped'),
330
- });
331
- export const TreeOutputSchema = z.strictObject({
332
- ok: SuccessFlagSchema,
333
- root: z.string().optional(),
334
- tree: TreeEntrySchema.optional(),
335
- ascii: z.string().optional(),
336
- truncated: z.boolean().optional(),
337
- totalEntries: NonNegativeIntegerSchema.optional(),
338
- });
339
- const ReadResultSchema = z.strictObject({
340
- content: z.string().optional().describe('Content'),
341
- truncated: z.boolean().optional().describe('Truncated?'),
342
- resourceUri: z.string().optional().describe('Full content URI'),
343
- totalLines: NonNegativeIntegerSchema.optional().describe('Total lines'),
344
- head: PositiveIntegerSchema.optional().describe('Head lines'),
345
- tail: PositiveIntegerSchema.optional().describe('Tail lines'),
346
- startLine: PositiveIntegerSchema.optional().describe('Start line'),
347
- endLine: PositiveIntegerSchema.optional().describe('End line'),
348
- linesRead: NonNegativeIntegerSchema.optional().describe('Lines read'),
349
- hasMoreLines: z.boolean().optional().describe('More lines?'),
350
- });
351
- export const ReadFileOutputSchema = ReadResultSchema.extend({
352
- ok: SuccessFlagSchema,
353
- path: z.string().optional(),
354
- contentHash: Sha256HexSchema.optional().describe('SHA-256 of full file content'),
355
- });
356
- const ReadMultipleFileResultSchema = ReadResultSchema.extend({
357
- path: z.string().describe('File path'),
358
- truncationReason: z
359
- .enum(['head', 'tail', 'range', 'externalized'])
360
- .optional()
361
- .describe('Why content was truncated'),
362
- error: ErrorSchema.optional().describe('Structured error details'),
363
- });
364
- export const ReadMultipleFilesOutputSchema = z.strictObject({
365
- ok: SuccessFlagSchema,
366
- results: z.array(ReadMultipleFileResultSchema).optional(),
367
- summary: OperationSummarySchema.optional(),
368
- });
369
- export const GetFileInfoOutputSchema = z.strictObject({
370
- ok: SuccessFlagSchema,
371
- info: FileInfoSchema.optional(),
372
- });
373
- export const GetMultipleFileInfoOutputSchema = z.strictObject({
374
- ok: SuccessFlagSchema,
375
- results: z
376
- .array(z.strictObject({
377
- path: z.string(),
378
- info: FileInfoSchema.optional(),
379
- error: ErrorSchema.optional(),
380
- }))
381
- .optional(),
382
- summary: OperationSummarySchema.optional(),
383
- });
384
- export const CreateDirectoryInputSchema = z
385
- .strictObject({
386
- path: RequiredPathSchema.optional().describe(DESC_PATH_REQUIRED),
387
- paths: z
388
- .array(RequiredPathSchema)
389
- .min(1, 'Min 1 path required')
390
- .optional()
391
- .describe('Absolute paths to directories to create'),
392
- })
393
- .superRefine((data, ctx) => {
394
- const hasPath = data.path !== undefined;
395
- const hasPaths = data.paths !== undefined;
396
- if (!hasPath && !hasPaths) {
397
- ctx.addIssue({
398
- code: 'custom',
399
- path: ['path'],
400
- message: "Either 'path' or 'paths' must be provided",
401
- input: data,
402
- });
403
- }
404
- if (hasPath && hasPaths) {
405
- ctx.addIssue({
406
- code: 'custom',
407
- path: ['path'],
408
- message: "Provide either 'path' or 'paths', not both",
409
- input: data,
410
- });
411
- ctx.addIssue({
412
- code: 'custom',
413
- path: ['paths'],
414
- message: "Provide either 'path' or 'paths', not both",
415
- input: data,
416
- });
417
- }
418
- })
419
- .describe("Provide either 'path' or 'paths'.");
420
- export const CreateDirectoryOutputSchema = z.strictObject({
421
- ok: SuccessFlagSchema,
422
- path: z.string().optional(),
423
- paths: z.array(z.string()).optional(),
424
- });
425
- export const WriteFileInputSchema = z.strictObject({
426
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
427
- content: z.string().describe('Content to write'),
428
- });
429
- export const WriteFileOutputSchema = z.strictObject({
430
- ok: SuccessFlagSchema,
431
- path: z.string().optional(),
432
- bytesWritten: NonNegativeIntegerSchema.optional(),
433
- });
434
- export const EditFileInputSchema = z.strictObject({
435
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
436
- edits: z
437
- .array(z.strictObject({
438
- oldText: z
439
- .string()
440
- .min(1, 'oldText required')
441
- .max(102400, 'Max 100KB')
442
- .describe('Exact literal string to replace (character-for-character). Include 3–5 lines of context for unique targeting.'),
443
- newText: z
444
- .string()
445
- .describe('Replacement string. Preserve surrounding indentation style.'),
446
- }))
447
- .min(1, 'Min 1 edit required')
448
- .describe('List of replacements to apply sequentially. Each edit replaces the first occurrence of oldText.'),
449
- dryRun: defaultFalseBoolean('Preview edits without writing. Check `unmatchedEdits` in response.'),
450
- ignoreWhitespace: defaultFalseBoolean('Treat all whitespace sequences as equivalent when matching oldText.'),
451
- });
452
- export const EditFileOutputSchema = z.strictObject({
453
- ok: z.boolean(),
454
- path: z.string().optional(),
455
- appliedEdits: NonNegativeIntegerSchema.optional(),
456
- linesAdded: NonNegativeIntegerSchema.optional().describe('Lines added'),
457
- linesRemoved: NonNegativeIntegerSchema.optional().describe('Lines removed'),
458
- lineRange: z
459
- .tuple([PositiveIntegerSchema, PositiveIntegerSchema])
460
- .optional()
461
- .describe('Line range modified [start, end] (1-based)'),
462
- unmatchedEdits: z
463
- .array(z.string())
464
- .optional()
465
- .describe('Edits that could not be applied'),
466
- diff: z.string().optional().describe('Unified diff of changes (dryRun)'),
467
- });
468
- export const MoveFileInputSchema = z
469
- .strictObject({
470
- source: RequiredPathSchema.optional().describe('Path to move (deprecated: use sources)'),
471
- sources: z
472
- .array(RequiredPathSchema)
473
- .min(1, 'Min 1 source required')
474
- .optional()
475
- .describe('Paths to move'),
476
- destination: RequiredPathSchema.describe('New path'),
477
- })
478
- .superRefine((data, ctx) => {
479
- const hasSource = data.source !== undefined;
480
- const hasSources = data.sources !== undefined;
481
- if (!hasSource && !hasSources) {
482
- ctx.addIssue({
483
- code: 'custom',
484
- path: ['source'],
485
- message: "Either 'source' or 'sources' must be provided",
486
- input: data,
487
- });
488
- }
489
- if (hasSource && hasSources) {
490
- ctx.addIssue({
491
- code: 'custom',
492
- path: ['source'],
493
- message: "Provide either 'source' or 'sources', not both",
494
- input: data,
495
- });
496
- ctx.addIssue({
497
- code: 'custom',
498
- path: ['sources'],
499
- message: "Provide either 'source' or 'sources', not both",
500
- input: data,
501
- });
502
- }
503
- })
504
- .describe("Provide either 'source' or 'sources'.");
505
- export const MoveFileOutputSchema = z.strictObject({
506
- ok: z.boolean(),
507
- source: z.string().optional(),
508
- sources: z.array(z.string()).optional(),
509
- destination: z.string().optional(),
510
- failed: z
511
- .array(z.strictObject({
512
- source: z.string().describe('Source path'),
513
- error: ErrorSchema.describe('Structured error details'),
514
- }))
515
- .optional()
516
- .describe('List of files that failed to move'),
517
- });
518
- export const DeleteFileInputSchema = z.strictObject({
519
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
520
- recursive: defaultFalseBoolean('Delete non-empty directories'),
521
- ignoreIfNotExists: defaultFalseBoolean('No error if missing'),
522
- });
523
- export const DeleteFileOutputSchema = z.strictObject({
524
- ok: SuccessFlagSchema,
525
- path: z.string().optional(),
526
- });
527
- export const CalculateHashInputSchema = z.strictObject({
528
- path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
529
- });
530
- export const CalculateHashOutputSchema = z.strictObject({
531
- ok: SuccessFlagSchema,
532
- path: z.string().optional(),
533
- hash: Sha256HexSchema.optional().describe('SHA-256 hash'),
534
- isDirectory: z.boolean().optional().describe('True if path is a directory'),
535
- fileCount: NonNegativeIntegerSchema.optional().describe('Number of files hashed (directories only)'),
536
- });
537
- export const DiffFilesInputSchema = z.strictObject({
538
- original: RequiredPathSchema.describe('Path to original file'),
539
- modified: RequiredPathSchema.describe('Path to modified file'),
540
- context: z
541
- .int({ error: 'Must be integer' })
542
- .min(0, 'Min: 0')
543
- .max(10000, 'Max: 10,000')
544
- .optional()
545
- .describe('Lines of context to include in the diff'),
546
- ignoreWhitespace: z
547
- .boolean()
548
- .optional()
549
- .default(false)
550
- .describe('Ignore leading/trailing whitespace when comparing lines'),
551
- stripTrailingCr: z
552
- .boolean()
553
- .optional()
554
- .default(false)
555
- .describe('Strip trailing carriage returns before diffing'),
556
- });
557
- export const DiffFilesOutputSchema = z.strictObject({
558
- ok: SuccessFlagSchema,
559
- diff: z.string().optional().describe('Unified diff content'),
560
- isIdentical: z.boolean().optional().describe('True if files are identical'),
561
- linesAdded: NonNegativeIntegerSchema.optional().describe('Lines added'),
562
- linesRemoved: NonNegativeIntegerSchema.optional().describe('Lines removed'),
563
- hunksCount: NonNegativeIntegerSchema.optional().describe('Number of diff hunks'),
564
- truncated: z.boolean().optional().describe('Diff content truncated?'),
565
- resourceUri: z.string().optional().describe('Full diff content URI'),
566
- });
567
- export const ApplyPatchInputSchema = z.strictObject({
568
- path: RequiredPathSchema.describe('Path to file to patch'),
569
- patch: z
570
- .string()
571
- .min(1, 'Patch content required')
572
- .refine((val) => /@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/u.test(val), {
573
- error: 'Patch must include hunk headers (e.g., @@ -1,2 +1,2 @@)',
574
- })
575
- .describe('Unified diff with @@ hunk headers. Generate with `diff_files`.'),
576
- fuzzFactor: z
577
- .int({ error: 'Must be integer' })
578
- .min(0, 'Min: 0')
579
- .max(20, 'Max: 20')
580
- .optional()
581
- .describe('Maximum fuzzy mismatches per hunk'),
582
- autoConvertLineEndings: z
583
- .boolean()
584
- .optional()
585
- .default(true)
586
- .describe('Auto-convert line endings to match target file'),
587
- dryRun: z
588
- .boolean()
589
- .optional()
590
- .default(false)
591
- .describe('Validate patch without writing. Check `applied` before committing.'),
592
- });
593
- export const ApplyPatchOutputSchema = z.strictObject({
594
- ok: z.boolean(),
595
- path: z.string().optional(),
596
- applied: z.boolean().optional(),
597
- hunksApplied: NonNegativeIntegerSchema.optional().describe('Hunks applied'),
598
- linesAdded: NonNegativeIntegerSchema.optional().describe('Lines added'),
599
- linesRemoved: NonNegativeIntegerSchema.optional().describe('Lines removed'),
600
- results: z
601
- .array(z.strictObject({
602
- path: z.string().describe('File path'),
603
- applied: z.boolean().describe('Patch applied successfully'),
604
- hunksApplied: NonNegativeIntegerSchema.optional().describe('Hunks applied'),
605
- linesAdded: NonNegativeIntegerSchema.optional().describe('Lines added'),
606
- linesRemoved: NonNegativeIntegerSchema.optional().describe('Lines removed'),
607
- error: ErrorSchema.optional().describe('Structured error details'),
608
- }))
609
- .optional()
610
- .describe('Per-file results for multi-file patches'),
611
- });
612
- export const SearchAndReplaceInputSchema = z.strictObject({
613
- path: OptionalPathSchema.describe(DESC_PATH_ROOT),
614
- filePattern: SafeGlobPatternSchema.optional()
615
- .default('**/*')
616
- .describe('Glob to filter files. Default: **/*'),
617
- searchPattern: z
618
- .string()
619
- .min(1, 'Search pattern required')
620
- .max(1000, 'Max 1000 chars')
621
- .describe('Text to search for. Literal by default; RE2 regex when `isRegex=true`.'),
622
- replacement: z.string().describe('Replacement text'),
623
- isRegex: defaultFalseBoolean('Treat searchPattern as RE2 regex. Supports capture groups ($1, $2) in replacement.'),
624
- caseSensitive: z
625
- .boolean()
626
- .optional()
627
- .default(true)
628
- .describe('Case-sensitive matching. Default: true.'),
629
- dryRun: defaultFalseBoolean('Preview matches without writing. Check changedFiles and matches in the response before committing.'),
630
- includeHidden: defaultFalseBoolean('Include hidden files/directories (starting with .). Default: false.'),
631
- includeIgnored: defaultFalseBoolean('Include .gitignore-ignored files (node_modules, dist). Default: false.'),
632
- returnDiff: defaultFalseBoolean('Return unified diff of changes even if dryRun is false. Default: false.'),
633
- maxFiles: z
634
- .int({ error: 'Must be integer' })
635
- .min(1, 'Min: 1')
636
- .max(10000, 'Max: 10,000')
637
- .optional()
638
- .describe('Max files to process before stopping'),
639
- });
640
- export const SearchAndReplaceOutputSchema = z.strictObject({
641
- ok: SuccessFlagSchema,
642
- matches: NonNegativeIntegerSchema.optional().describe('Total matches found'),
643
- filesChanged: NonNegativeIntegerSchema.optional().describe('Files modified'),
644
- processedFiles: NonNegativeIntegerSchema.optional().describe('Files processed'),
645
- failedFiles: NonNegativeIntegerSchema.optional().describe('Files skipped due to errors'),
646
- failures: z
647
- .array(z.strictObject({
648
- path: z.string().describe('File path'),
649
- error: ErrorSchema.describe('Structured error details'),
650
- }))
651
- .optional()
652
- .describe('Sample of per-file errors'),
653
- changedFiles: z
654
- .array(z.strictObject({
655
- path: z.string().describe('File path'),
656
- matches: PositiveIntegerSchema.describe('Matches in file'),
657
- }))
658
- .optional()
659
- .describe('Sample of changed files'),
660
- changedFilesTruncated: z
661
- .boolean()
662
- .optional()
663
- .describe('Changed file list truncated'),
664
- diff: z
665
- .string()
666
- .optional()
667
- .describe('Unified diff of changes when `dryRun` or `returnDiff` is enabled'),
668
- diffTruncated: z
669
- .boolean()
670
- .optional()
671
- .describe('Diff was truncated to fit size limit'),
672
- stoppedReason: z
673
- .enum(['maxFiles'])
674
- .optional()
675
- .describe('Why processing stopped early'),
676
- });
@@ -1,6 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/server';
2
- import { type Server } from 'node:http';
3
- import { type ServerOptions } from './roots-manager.js';
4
- export declare function createServer(options?: ServerOptions): Promise<McpServer>;
5
- export declare function startServer(server: McpServer): Promise<void>;
6
- export declare function startHttpServer(port: number, options: ServerOptions): Promise<Server>;