@perstack/base 0.0.23 → 0.0.25
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/README.md +3 -0
- package/dist/bin/server.js +2 -2
- package/dist/bin/server.js.map +1 -1
- package/dist/{chunk-H76GGP62.js → chunk-2DL5RINQ.js} +76 -96
- package/dist/chunk-2DL5RINQ.js.map +1 -0
- package/dist/src/index.d.ts +69 -99
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-H76GGP62.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Base skills (MCP tools) for Perstack agents.
|
|
4
4
|
|
|
5
|
+
For detailed documentation, see [Base Skill](https://docs.perstack.ai/making-experts/base-skill).
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -54,6 +56,7 @@ registerWriteTextFile(server)
|
|
|
54
56
|
- `exec` - Execute system commands
|
|
55
57
|
- `think` - Sequential thinking for problem analysis
|
|
56
58
|
- `todo` - Task list management
|
|
59
|
+
- `clearTodo` - Clear task list
|
|
57
60
|
- `attemptCompletion` - Signal task completion
|
|
58
61
|
|
|
59
62
|
## License
|
package/dist/bin/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { registerAttemptCompletion, registerThink, registerTodo, registerClearTodo, registerExec, registerGetFileInfo, registerReadTextFile, registerReadImageFile, registerReadPdfFile, registerWriteTextFile, registerAppendTextFile, registerEditTextFile, registerMoveFile, registerDeleteFile, registerListDirectory, registerCreateDirectory, registerDeleteDirectory } from '../chunk-
|
|
2
|
+
import { registerAttemptCompletion, registerThink, registerTodo, registerClearTodo, registerExec, registerGetFileInfo, registerReadTextFile, registerReadImageFile, registerReadPdfFile, registerWriteTextFile, registerAppendTextFile, registerEditTextFile, registerMoveFile, registerDeleteFile, registerListDirectory, registerCreateDirectory, registerDeleteDirectory } from '../chunk-2DL5RINQ.js';
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
5
|
import { Command } from 'commander';
|
|
@@ -7,7 +7,7 @@ import { Command } from 'commander';
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@perstack/base",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.25",
|
|
11
11
|
description: "Perstack base skills for agents."};
|
|
12
12
|
|
|
13
13
|
// bin/server.ts
|
package/dist/bin/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../package.json","../../bin/server.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,gBAAA;AAAA,EACR,OAAA,EAAW,QAAA;AAAA,EACX,WAAA,EAAe,kCA6CjB,CAAA;;;ACzBA,eAAe,IAAA,GAAO;AACpB,EAAA,MAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAC5B,EAAA,OAAA,CACG,KAAK,eAAA,CAAY,IAAI,EACrB,WAAA,CAAY,eAAA,CAAY,WAAW,CAAA,CACnC,OAAA,CAAQ,gBAAY,OAAA,EAAS,eAAA,EAAiB,4BAA4B,CAAA,CAC1E,MAAA,CAAO,aAAa,gBAAgB,CAAA,CACpC,OAAO,YAAY;AAClB,IAAA,MAAM,SAAS,IAAI,SAAA;AAAA,MACjB;AAAA,QACE,MAAM,eAAA,CAAY,IAAA;AAAA,QAClB,SAAS,eAAA,CAAY;AAAA,OACvB;AAAA,MACA;AAAA,QACE,YAAA,EAAc;AAAA,UACZ,OAAO;AAAC;AACV;AACF,KACF;AACA,IAAA,yBAAA,CAA0B,MAAM,CAAA;AAChC,IAAA,aAAA,CAAc,MAAM,CAAA;AACpB,IAAA,YAAA,CAAa,MAAM,CAAA;AACnB,IAAA,iBAAA,CAAkB,MAAM,CAAA;AACxB,IAAA,YAAA,CAAa,MAAM,CAAA;AACnB,IAAA,mBAAA,CAAoB,MAAM,CAAA;AAC1B,IAAA,oBAAA,CAAqB,MAAM,CAAA;AAC3B,IAAA,qBAAA,CAAsB,MAAM,CAAA;AAC5B,IAAA,mBAAA,CAAoB,MAAM,CAAA;AAC1B,IAAA,qBAAA,CAAsB,MAAM,CAAA;AAC5B,IAAA,sBAAA,CAAuB,MAAM,CAAA;AAC7B,IAAA,oBAAA,CAAqB,MAAM,CAAA;AAC3B,IAAA,gBAAA,CAAiB,MAAM,CAAA;AACvB,IAAA,kBAAA,CAAmB,MAAM,CAAA;AACzB,IAAA,qBAAA,CAAsB,MAAM,CAAA;AAC5B,IAAA,uBAAA,CAAwB,MAAM,CAAA;AAC9B,IAAA,uBAAA,CAAwB,MAAM,CAAA;AAC9B,IAAA,MAAM,SAAA,GAAY,IAAI,oBAAA,EAAqB;AAC3C,IAAA,OAAA,CAAQ,KAAA,CAAM,gCAAA,EAAkC,eAAA,CAAY,OAAO,CAAA;AACnE,IAAA,MAAM,MAAA,CAAO,QAAQ,SAAS,CAAA;AAAA,EAChC,CAAC,CAAA;AACH,EAAA,OAAA,CAAQ,KAAA,EAAM;AAChB;AACA,IAAA,EAAK","file":"server.js","sourcesContent":["{\n \"name\": \"@perstack/base\",\n \"version\": \"0.0.
|
|
1
|
+
{"version":3,"sources":["../../package.json","../../bin/server.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,eAAA,GAAA;AAAA,EACE,IAAA,EAAQ,gBAAA;AAAA,EACR,OAAA,EAAW,QAAA;AAAA,EACX,WAAA,EAAe,kCA6CjB,CAAA;;;ACzBA,eAAe,IAAA,GAAO;AACpB,EAAA,MAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAC5B,EAAA,OAAA,CACG,KAAK,eAAA,CAAY,IAAI,EACrB,WAAA,CAAY,eAAA,CAAY,WAAW,CAAA,CACnC,OAAA,CAAQ,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esContent":["{\n \"name\": \"@perstack/base\",\n \"version\": \"0.0.25\",\n \"description\": \"Perstack base skills for agents.\",\n \"author\": \"Wintermute Technologies, Inc.\",\n \"license\": \"Apache-2.0\",\n \"type\": \"module\",\n \"exports\": {\n \".\": \"./src/index.ts\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"bin\": {\n \"@perstack/base\": \"dist/bin/server.js\"\n },\n \"exports\": {\n \".\": \"./dist/src/index.js\"\n },\n \"types\": {\n \".\": \"./dist/src/index.d.ts\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@modelcontextprotocol/sdk\": \"^1.23.0\",\n \"commander\": \"^14.0.2\",\n \"mime-types\": \"^3.0.2\",\n \"ts-dedent\": \"^2.2.0\",\n \"zod\": \"^4.1.13\"\n },\n \"devDependencies\": {\n \"@tsconfig/node22\": \"^22.0.5\",\n \"@types/mime-types\": \"^3.0.1\",\n \"@types/node\": \"^24.10.1\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.9.3\",\n \"vitest\": \"^4.0.14\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n }\n}\n","#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { Command } from \"commander\"\nimport packageJson from \"../package.json\" with { type: \"json\" }\nimport { registerAppendTextFile } from \"../src/tools/append-text-file.js\"\nimport { registerAttemptCompletion } from \"../src/tools/attempt-completion.js\"\nimport { registerCreateDirectory } from \"../src/tools/create-directory.js\"\nimport { registerDeleteDirectory } from \"../src/tools/delete-directory.js\"\nimport { registerDeleteFile } from \"../src/tools/delete-file.js\"\nimport { registerEditTextFile } from \"../src/tools/edit-text-file.js\"\nimport { registerExec } from \"../src/tools/exec.js\"\nimport { registerGetFileInfo } from \"../src/tools/get-file-info.js\"\nimport { registerListDirectory } from \"../src/tools/list-directory.js\"\nimport { registerMoveFile } from \"../src/tools/move-file.js\"\nimport { registerReadImageFile } from \"../src/tools/read-image-file.js\"\nimport { registerReadPdfFile } from \"../src/tools/read-pdf-file.js\"\nimport { registerReadTextFile } from \"../src/tools/read-text-file.js\"\nimport { registerThink } from \"../src/tools/think.js\"\nimport { registerClearTodo, registerTodo } from \"../src/tools/todo.js\"\nimport { registerWriteTextFile } from \"../src/tools/write-text-file.js\"\n\nasync function main() {\n const program = new Command()\n program\n .name(packageJson.name)\n .description(packageJson.description)\n .version(packageJson.version, \"-v, --version\", \"display the version number\")\n .option(\"--verbose\", \"verbose output\")\n .action(async () => {\n const server = new McpServer(\n {\n name: packageJson.name,\n version: packageJson.version,\n },\n {\n capabilities: {\n tools: {},\n },\n },\n )\n registerAttemptCompletion(server)\n registerThink(server)\n registerTodo(server)\n registerClearTodo(server)\n registerExec(server)\n registerGetFileInfo(server)\n registerReadTextFile(server)\n registerReadImageFile(server)\n registerReadPdfFile(server)\n registerWriteTextFile(server)\n registerAppendTextFile(server)\n registerEditTextFile(server)\n registerMoveFile(server)\n registerDeleteFile(server)\n registerListDirectory(server)\n registerCreateDirectory(server)\n registerDeleteDirectory(server)\n const transport = new StdioServerTransport()\n console.error(\"Running @perstack/base version\", packageJson.version)\n await server.connect(transport)\n })\n program.parse()\n}\nmain()\n"]}
|
|
@@ -3,7 +3,7 @@ import fs, { appendFile, mkdir, rm, rmdir, unlink, readFile, writeFile, readdir,
|
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import path, { dirname, extname, basename, resolve, join } from 'path';
|
|
5
5
|
import { dedent } from 'ts-dedent';
|
|
6
|
-
import { z } from 'zod';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
7
|
import { execFile } from 'child_process';
|
|
8
8
|
import { promisify } from 'util';
|
|
9
9
|
import mime from 'mime-types';
|
|
@@ -56,14 +56,7 @@ function errorToolResult(e) {
|
|
|
56
56
|
content: [{ type: "text", text: JSON.stringify({ error: e.name, message: e.message }) }]
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
// src/tools/append-text-file.ts
|
|
61
|
-
var inputSchema = z.object({
|
|
62
|
-
path: z.string().describe("Target file path to append to."),
|
|
63
|
-
text: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters.")
|
|
64
|
-
});
|
|
65
|
-
async function appendTextFile(input) {
|
|
66
|
-
const { path: path2, text } = input;
|
|
59
|
+
async function appendTextFile({ path: path2, text }) {
|
|
67
60
|
const validatedPath = await validatePath(path2);
|
|
68
61
|
if (!existsSync(validatedPath)) {
|
|
69
62
|
throw new Error(`File ${path2} does not exist.`);
|
|
@@ -102,11 +95,14 @@ function registerAppendTextFile(server) {
|
|
|
102
95
|
- THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT APPEND ALL THE CONTENT AT ONCE
|
|
103
96
|
- IF YOU WANT TO APPEND MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES
|
|
104
97
|
`,
|
|
105
|
-
inputSchema:
|
|
98
|
+
inputSchema: {
|
|
99
|
+
path: z.string().describe("Target file path to append to."),
|
|
100
|
+
text: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters.")
|
|
101
|
+
}
|
|
106
102
|
},
|
|
107
|
-
async (
|
|
103
|
+
async ({ path: path2, text }) => {
|
|
108
104
|
try {
|
|
109
|
-
return successToolResult(await appendTextFile(
|
|
105
|
+
return successToolResult(await appendTextFile({ path: path2, text }));
|
|
110
106
|
} catch (e) {
|
|
111
107
|
if (e instanceof Error) return errorToolResult(e);
|
|
112
108
|
throw e;
|
|
@@ -114,8 +110,7 @@ function registerAppendTextFile(server) {
|
|
|
114
110
|
}
|
|
115
111
|
);
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
async function attemptCompletion(_input) {
|
|
113
|
+
async function attemptCompletion() {
|
|
119
114
|
return {
|
|
120
115
|
message: "End the agent loop and provide a final report"
|
|
121
116
|
};
|
|
@@ -141,11 +136,11 @@ function registerAttemptCompletion(server) {
|
|
|
141
136
|
- Should only be used when task is fully complete
|
|
142
137
|
- Cannot be reverted once called
|
|
143
138
|
`,
|
|
144
|
-
inputSchema:
|
|
139
|
+
inputSchema: {}
|
|
145
140
|
},
|
|
146
|
-
async (
|
|
141
|
+
async () => {
|
|
147
142
|
try {
|
|
148
|
-
return successToolResult(await attemptCompletion(
|
|
143
|
+
return successToolResult(await attemptCompletion());
|
|
149
144
|
} catch (e) {
|
|
150
145
|
if (e instanceof Error) return errorToolResult(e);
|
|
151
146
|
throw e;
|
|
@@ -153,9 +148,6 @@ function registerAttemptCompletion(server) {
|
|
|
153
148
|
}
|
|
154
149
|
);
|
|
155
150
|
}
|
|
156
|
-
var inputSchema3 = z.object({
|
|
157
|
-
path: z.string()
|
|
158
|
-
});
|
|
159
151
|
async function createDirectory(input) {
|
|
160
152
|
const { path: path2 } = input;
|
|
161
153
|
const validatedPath = await validatePath(path2);
|
|
@@ -198,7 +190,9 @@ function registerCreateDirectory(server) {
|
|
|
198
190
|
Parameters:
|
|
199
191
|
- path: Directory path to create
|
|
200
192
|
`,
|
|
201
|
-
inputSchema:
|
|
193
|
+
inputSchema: {
|
|
194
|
+
path: z.string()
|
|
195
|
+
}
|
|
202
196
|
},
|
|
203
197
|
async (input) => {
|
|
204
198
|
try {
|
|
@@ -210,10 +204,6 @@ function registerCreateDirectory(server) {
|
|
|
210
204
|
}
|
|
211
205
|
);
|
|
212
206
|
}
|
|
213
|
-
var inputSchema4 = z.object({
|
|
214
|
-
path: z.string(),
|
|
215
|
-
recursive: z.boolean().optional().describe("Whether to delete contents recursively. Required for non-empty directories.")
|
|
216
|
-
});
|
|
217
207
|
async function deleteDirectory(input) {
|
|
218
208
|
const { path: path2, recursive } = input;
|
|
219
209
|
const validatedPath = await validatePath(path2);
|
|
@@ -258,7 +248,10 @@ function registerDeleteDirectory(server) {
|
|
|
258
248
|
- path: Directory path to delete
|
|
259
249
|
- recursive: Set to true to delete non-empty directories
|
|
260
250
|
`,
|
|
261
|
-
inputSchema:
|
|
251
|
+
inputSchema: {
|
|
252
|
+
path: z.string(),
|
|
253
|
+
recursive: z.boolean().optional().describe("Whether to delete contents recursively. Required for non-empty directories.")
|
|
254
|
+
}
|
|
262
255
|
},
|
|
263
256
|
async (input) => {
|
|
264
257
|
try {
|
|
@@ -270,9 +263,6 @@ function registerDeleteDirectory(server) {
|
|
|
270
263
|
}
|
|
271
264
|
);
|
|
272
265
|
}
|
|
273
|
-
var inputSchema5 = z.object({
|
|
274
|
-
path: z.string()
|
|
275
|
-
});
|
|
276
266
|
async function deleteFile(input) {
|
|
277
267
|
const { path: path2 } = input;
|
|
278
268
|
const validatedPath = await validatePath(path2);
|
|
@@ -313,7 +303,9 @@ function registerDeleteFile(server) {
|
|
|
313
303
|
Parameters:
|
|
314
304
|
- path: File path to delete
|
|
315
305
|
`,
|
|
316
|
-
inputSchema:
|
|
306
|
+
inputSchema: {
|
|
307
|
+
path: z.string()
|
|
308
|
+
}
|
|
317
309
|
},
|
|
318
310
|
async (input) => {
|
|
319
311
|
try {
|
|
@@ -325,11 +317,6 @@ function registerDeleteFile(server) {
|
|
|
325
317
|
}
|
|
326
318
|
);
|
|
327
319
|
}
|
|
328
|
-
var inputSchema6 = z.object({
|
|
329
|
-
path: z.string().describe("Target file path to edit."),
|
|
330
|
-
newText: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters."),
|
|
331
|
-
oldText: z.string().min(1).max(2e3).describe("Exact text to find and replace. Max 2000 characters.")
|
|
332
|
-
});
|
|
333
320
|
async function editTextFile(input) {
|
|
334
321
|
const { path: path2, newText, oldText } = input;
|
|
335
322
|
const validatedPath = await validatePath(path2);
|
|
@@ -387,7 +374,11 @@ function registerEditTextFile(server) {
|
|
|
387
374
|
- IF YOU WANT TO EDIT MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES
|
|
388
375
|
- DO NOT USE THIS TOOL FOR APPENDING TEXT TO FILES - USE appendTextFile TOOL INSTEAD
|
|
389
376
|
`,
|
|
390
|
-
inputSchema:
|
|
377
|
+
inputSchema: {
|
|
378
|
+
path: z.string().describe("Target file path to edit."),
|
|
379
|
+
newText: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters."),
|
|
380
|
+
oldText: z.string().min(1).max(2e3).describe("Exact text to find and replace. Max 2000 characters.")
|
|
381
|
+
}
|
|
391
382
|
},
|
|
392
383
|
async (input) => {
|
|
393
384
|
try {
|
|
@@ -400,15 +391,6 @@ function registerEditTextFile(server) {
|
|
|
400
391
|
);
|
|
401
392
|
}
|
|
402
393
|
var execFileAsync = promisify(execFile);
|
|
403
|
-
var inputSchema7 = z.object({
|
|
404
|
-
command: z.string().describe("The command to execute"),
|
|
405
|
-
args: z.array(z.string()).describe("The arguments to pass to the command"),
|
|
406
|
-
env: z.record(z.string(), z.string()).describe("The environment variables to set"),
|
|
407
|
-
cwd: z.string().describe("The working directory to execute the command in"),
|
|
408
|
-
stdout: z.boolean().describe("Whether to capture the standard output"),
|
|
409
|
-
stderr: z.boolean().describe("Whether to capture the standard error"),
|
|
410
|
-
timeout: z.number().optional().describe("Timeout in milliseconds")
|
|
411
|
-
});
|
|
412
394
|
async function exec(input) {
|
|
413
395
|
const validatedCwd = await validatePath(input.cwd);
|
|
414
396
|
const { stdout, stderr } = await execFileAsync(input.command, input.args, {
|
|
@@ -460,7 +442,15 @@ function registerExec(server) {
|
|
|
460
442
|
- Do not execute long-running foreground commands (e.g., tail -f)
|
|
461
443
|
- Be cautious with resource-intensive commands
|
|
462
444
|
`,
|
|
463
|
-
inputSchema:
|
|
445
|
+
inputSchema: {
|
|
446
|
+
command: z.string().describe("The command to execute"),
|
|
447
|
+
args: z.array(z.string()).describe("The arguments to pass to the command"),
|
|
448
|
+
env: z.record(z.string(), z.string()).describe("The environment variables to set"),
|
|
449
|
+
cwd: z.string().describe("The working directory to execute the command in"),
|
|
450
|
+
stdout: z.boolean().describe("Whether to capture the standard output"),
|
|
451
|
+
stderr: z.boolean().describe("Whether to capture the standard error"),
|
|
452
|
+
timeout: z.number().optional().describe("Timeout in milliseconds")
|
|
453
|
+
}
|
|
464
454
|
},
|
|
465
455
|
async (input) => {
|
|
466
456
|
try {
|
|
@@ -491,9 +481,6 @@ function registerExec(server) {
|
|
|
491
481
|
}
|
|
492
482
|
);
|
|
493
483
|
}
|
|
494
|
-
var inputSchema8 = z.object({
|
|
495
|
-
path: z.string()
|
|
496
|
-
});
|
|
497
484
|
async function getFileInfo(input) {
|
|
498
485
|
const { path: path2 } = input;
|
|
499
486
|
const validatedPath = await validatePath(path2);
|
|
@@ -553,7 +540,9 @@ function registerGetFileInfo(server) {
|
|
|
553
540
|
Parameters:
|
|
554
541
|
- path: File or directory path to inspect
|
|
555
542
|
`,
|
|
556
|
-
inputSchema:
|
|
543
|
+
inputSchema: {
|
|
544
|
+
path: z.string()
|
|
545
|
+
}
|
|
557
546
|
},
|
|
558
547
|
async (input) => {
|
|
559
548
|
try {
|
|
@@ -565,9 +554,6 @@ function registerGetFileInfo(server) {
|
|
|
565
554
|
}
|
|
566
555
|
);
|
|
567
556
|
}
|
|
568
|
-
var inputSchema9 = z.object({
|
|
569
|
-
path: z.string()
|
|
570
|
-
});
|
|
571
557
|
async function listDirectory(input) {
|
|
572
558
|
const { path: path2 } = input;
|
|
573
559
|
const validatedPath = await validatePath(path2);
|
|
@@ -627,7 +613,9 @@ function registerListDirectory(server) {
|
|
|
627
613
|
Parameters:
|
|
628
614
|
- path: Directory path to list (optional, defaults to workspace root)
|
|
629
615
|
`,
|
|
630
|
-
inputSchema:
|
|
616
|
+
inputSchema: {
|
|
617
|
+
path: z.string()
|
|
618
|
+
}
|
|
631
619
|
},
|
|
632
620
|
async (input) => {
|
|
633
621
|
try {
|
|
@@ -639,10 +627,6 @@ function registerListDirectory(server) {
|
|
|
639
627
|
}
|
|
640
628
|
);
|
|
641
629
|
}
|
|
642
|
-
var inputSchema10 = z.object({
|
|
643
|
-
source: z.string(),
|
|
644
|
-
destination: z.string()
|
|
645
|
-
});
|
|
646
630
|
async function moveFile(input) {
|
|
647
631
|
const { source, destination } = input;
|
|
648
632
|
const validatedSource = await validatePath(source);
|
|
@@ -689,7 +673,10 @@ function registerMoveFile(server) {
|
|
|
689
673
|
- source: Current file path
|
|
690
674
|
- destination: Target file path
|
|
691
675
|
`,
|
|
692
|
-
inputSchema:
|
|
676
|
+
inputSchema: {
|
|
677
|
+
source: z.string(),
|
|
678
|
+
destination: z.string()
|
|
679
|
+
}
|
|
693
680
|
},
|
|
694
681
|
async (input) => {
|
|
695
682
|
try {
|
|
@@ -702,9 +689,6 @@ function registerMoveFile(server) {
|
|
|
702
689
|
);
|
|
703
690
|
}
|
|
704
691
|
var MAX_IMAGE_SIZE = 15 * 1024 * 1024;
|
|
705
|
-
var inputSchema11 = z.object({
|
|
706
|
-
path: z.string()
|
|
707
|
-
});
|
|
708
692
|
async function readImageFile(input) {
|
|
709
693
|
const { path: path2 } = input;
|
|
710
694
|
const validatedPath = await validatePath(path2);
|
|
@@ -757,7 +741,9 @@ function registerReadImageFile(server) {
|
|
|
757
741
|
Notes:
|
|
758
742
|
- Maximum file size: 15MB (larger files will be rejected)
|
|
759
743
|
`,
|
|
760
|
-
inputSchema:
|
|
744
|
+
inputSchema: {
|
|
745
|
+
path: z.string()
|
|
746
|
+
}
|
|
761
747
|
},
|
|
762
748
|
async (input) => {
|
|
763
749
|
try {
|
|
@@ -770,9 +756,6 @@ function registerReadImageFile(server) {
|
|
|
770
756
|
);
|
|
771
757
|
}
|
|
772
758
|
var MAX_PDF_SIZE = 30 * 1024 * 1024;
|
|
773
|
-
var inputSchema12 = z.object({
|
|
774
|
-
path: z.string()
|
|
775
|
-
});
|
|
776
759
|
async function readPdfFile(input) {
|
|
777
760
|
const { path: path2 } = input;
|
|
778
761
|
const validatedPath = await validatePath(path2);
|
|
@@ -821,7 +804,9 @@ function registerReadPdfFile(server) {
|
|
|
821
804
|
- Maximum file size: 30MB (larger files will be rejected)
|
|
822
805
|
- Text extraction not performed, returns raw PDF data
|
|
823
806
|
`,
|
|
824
|
-
inputSchema:
|
|
807
|
+
inputSchema: {
|
|
808
|
+
path: z.string()
|
|
809
|
+
}
|
|
825
810
|
},
|
|
826
811
|
async (input) => {
|
|
827
812
|
try {
|
|
@@ -833,11 +818,6 @@ function registerReadPdfFile(server) {
|
|
|
833
818
|
}
|
|
834
819
|
);
|
|
835
820
|
}
|
|
836
|
-
var inputSchema13 = z.object({
|
|
837
|
-
path: z.string(),
|
|
838
|
-
from: z.number().optional().describe("The line number to start reading from."),
|
|
839
|
-
to: z.number().optional().describe("The line number to stop reading at.")
|
|
840
|
-
});
|
|
841
821
|
async function readTextFile(input) {
|
|
842
822
|
const { path: path2, from, to } = input;
|
|
843
823
|
const validatedPath = await validatePath(path2);
|
|
@@ -884,7 +864,11 @@ function registerReadTextFile(server) {
|
|
|
884
864
|
- Configuration: .json, .yaml, .toml, .ini
|
|
885
865
|
- Data files: .csv, .log, .sql
|
|
886
866
|
`,
|
|
887
|
-
inputSchema:
|
|
867
|
+
inputSchema: {
|
|
868
|
+
path: z.string(),
|
|
869
|
+
from: z.number().optional().describe("The line number to start reading from."),
|
|
870
|
+
to: z.number().optional().describe("The line number to stop reading at.")
|
|
871
|
+
}
|
|
888
872
|
},
|
|
889
873
|
async (input) => {
|
|
890
874
|
try {
|
|
@@ -896,10 +880,6 @@ function registerReadTextFile(server) {
|
|
|
896
880
|
}
|
|
897
881
|
);
|
|
898
882
|
}
|
|
899
|
-
var inputSchema14 = z.object({
|
|
900
|
-
thought: z.string().describe("Your current thinking step"),
|
|
901
|
-
nextThoughtNeeded: z.boolean().optional().describe("true if you need more thinking, even if at what seemed like the end")
|
|
902
|
-
});
|
|
903
883
|
var Thought = class {
|
|
904
884
|
thoughtHistory = [];
|
|
905
885
|
processThought(input) {
|
|
@@ -946,7 +926,10 @@ function registerThink(server) {
|
|
|
946
926
|
- Engage in reflective introspection and constructive self-critique
|
|
947
927
|
- Set nextThoughtNeeded to false only when fully satisfied with the solution
|
|
948
928
|
`,
|
|
949
|
-
inputSchema:
|
|
929
|
+
inputSchema: {
|
|
930
|
+
thought: z.string().describe("Your current thinking step"),
|
|
931
|
+
nextThoughtNeeded: z.boolean().optional().describe("true if you need more thinking, even if at what seemed like the end")
|
|
932
|
+
}
|
|
950
933
|
},
|
|
951
934
|
async (input) => {
|
|
952
935
|
try {
|
|
@@ -958,11 +941,6 @@ function registerThink(server) {
|
|
|
958
941
|
}
|
|
959
942
|
);
|
|
960
943
|
}
|
|
961
|
-
var todoInputSchema = z.object({
|
|
962
|
-
newTodos: z.array(z.string()).describe("New todos to add").optional(),
|
|
963
|
-
completedTodos: z.array(z.number()).describe("Todo ids that are completed").optional()
|
|
964
|
-
});
|
|
965
|
-
var clearTodoInputSchema = z.object({});
|
|
966
944
|
var Todo = class {
|
|
967
945
|
currentTodoId = 0;
|
|
968
946
|
todos = [];
|
|
@@ -995,7 +973,7 @@ var todoSingleton = new Todo();
|
|
|
995
973
|
async function todo(input) {
|
|
996
974
|
return todoSingleton.processTodo(input);
|
|
997
975
|
}
|
|
998
|
-
async function clearTodo(
|
|
976
|
+
async function clearTodo() {
|
|
999
977
|
return todoSingleton.clearTodo();
|
|
1000
978
|
}
|
|
1001
979
|
function registerTodo(server) {
|
|
@@ -1020,7 +998,10 @@ function registerTodo(server) {
|
|
|
1020
998
|
- newTodos: Array of task descriptions to add
|
|
1021
999
|
- completedTodos: Array of todo IDs to mark as completed
|
|
1022
1000
|
`,
|
|
1023
|
-
inputSchema:
|
|
1001
|
+
inputSchema: {
|
|
1002
|
+
newTodos: z.array(z.string()).describe("New todos to add").optional(),
|
|
1003
|
+
completedTodos: z.array(z.number()).describe("Todo ids that are completed").optional()
|
|
1004
|
+
}
|
|
1024
1005
|
},
|
|
1025
1006
|
async (input) => {
|
|
1026
1007
|
try {
|
|
@@ -1049,11 +1030,11 @@ function registerClearTodo(server) {
|
|
|
1049
1030
|
- Resets the todo list to an empty state
|
|
1050
1031
|
- Returns an empty todo list
|
|
1051
1032
|
`,
|
|
1052
|
-
inputSchema:
|
|
1033
|
+
inputSchema: {}
|
|
1053
1034
|
},
|
|
1054
|
-
async (
|
|
1035
|
+
async () => {
|
|
1055
1036
|
try {
|
|
1056
|
-
return successToolResult(await clearTodo(
|
|
1037
|
+
return successToolResult(await clearTodo());
|
|
1057
1038
|
} catch (e) {
|
|
1058
1039
|
if (e instanceof Error) return errorToolResult(e);
|
|
1059
1040
|
throw e;
|
|
@@ -1061,10 +1042,6 @@ function registerClearTodo(server) {
|
|
|
1061
1042
|
}
|
|
1062
1043
|
);
|
|
1063
1044
|
}
|
|
1064
|
-
var inputSchema15 = z.object({
|
|
1065
|
-
path: z.string().describe("Target file path (relative or absolute)."),
|
|
1066
|
-
text: z.string().max(1e4).describe("Text to write to the file. Max 10000 characters.")
|
|
1067
|
-
});
|
|
1068
1045
|
async function writeTextFile(input) {
|
|
1069
1046
|
const { path: path2, text } = input;
|
|
1070
1047
|
const validatedPath = await validatePath(path2);
|
|
@@ -1106,7 +1083,10 @@ function registerWriteTextFile(server) {
|
|
|
1106
1083
|
- THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)
|
|
1107
1084
|
- IF YOU WANT TO WRITE MORE THAN 10,000 CHARACTERS, USE "appendTextFile" TOOL AFTER THIS ONE
|
|
1108
1085
|
`,
|
|
1109
|
-
inputSchema:
|
|
1086
|
+
inputSchema: {
|
|
1087
|
+
path: z.string().describe("Target file path (relative or absolute)."),
|
|
1088
|
+
text: z.string().max(1e4).describe("Text to write to the file. Max 10000 characters.")
|
|
1089
|
+
}
|
|
1110
1090
|
},
|
|
1111
1091
|
async (input) => {
|
|
1112
1092
|
try {
|
|
@@ -1119,6 +1099,6 @@ function registerWriteTextFile(server) {
|
|
|
1119
1099
|
);
|
|
1120
1100
|
}
|
|
1121
1101
|
|
|
1122
|
-
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, think, todo, validatePath, writeTextFile };
|
|
1123
|
-
//# sourceMappingURL=chunk-
|
|
1124
|
-
//# sourceMappingURL=chunk-
|
|
1102
|
+
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, errorToolResult, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, successToolResult, think, todo, validatePath, writeTextFile };
|
|
1103
|
+
//# sourceMappingURL=chunk-2DL5RINQ.js.map
|
|
1104
|
+
//# sourceMappingURL=chunk-2DL5RINQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/path.ts","../src/lib/tool-result.ts","../src/tools/append-text-file.ts","../src/tools/attempt-completion.ts","../src/tools/create-directory.ts","../src/tools/delete-directory.ts","../src/tools/delete-file.ts","../src/tools/edit-text-file.ts","../src/tools/exec.ts","../src/tools/get-file-info.ts","../src/tools/list-directory.ts","../src/tools/move-file.ts","../src/tools/read-image-file.ts","../src/tools/read-pdf-file.ts","../src/tools/read-text-file.ts","../src/tools/think.ts","../src/tools/todo.ts","../src/tools/write-text-file.ts"],"names":["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AO,CAAA;AAC5C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN;AAAA,GACF;AACF;AAEO,SAAS,sBAAsB,MAAA,EAAmB;AACvD,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,eAAA;AAAA,IACA;AAAA,MACE,KAAA,EAAO,eAAA;AAAA,MACP,WAAA,EAAaV,MAAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAA,CAAA;AAAA,MAmBb,WAAA,EAAa;AAAA,QACX,IAAA,EAAMG,CAAAA,CAAE,MAAA,EAAO,CAAE,SAAS,0CAA0C,CAAA;AAAA,QACpE,IAAA,EAAMA,EAAE,MAAA,EAAO,CAAE,IAAI,GAAM,CAAA,CAAE,SAAS,kDAAkD;AAAA;AAC1F,KACF;AAAA,IACA,OAAO,KAAA,KAA0C;AAC/C,MAAA,IAAI;AACF,QAAA,OAAO,iBAAA,CAAkB,MAAM,aAAA,CAAc,KAAK,CAAC,CAAA;AAAA,MACrD,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,CAAA,YAAa,KAAA,EAAO,OAAO,eAAA,CAAgB,CAAC,CAAA;AAChD,QAAA,MAAM,CAAA;AAAA,MACR;AAAA,IACF;AAAA,GACF;AACF","file":"chunk-2DL5RINQ.js","sourcesContent":["import { realpathSync } from \"node:fs\"\nimport fs from \"node:fs/promises\"\nimport os from \"node:os\"\nimport path from \"node:path\"\n\nexport const workspacePath = realpathSync(expandHome(process.cwd()))\n\nfunction expandHome(filepath: string): string {\n if (filepath.startsWith(\"~/\") || filepath === \"~\") {\n return path.join(os.homedir(), filepath.slice(1))\n }\n return filepath\n}\n\nexport async function validatePath(requestedPath: string): Promise<string> {\n const expandedPath = expandHome(requestedPath)\n const absolute = path.isAbsolute(expandedPath)\n ? path.resolve(expandedPath)\n : path.resolve(process.cwd(), expandedPath)\n if (absolute === `${workspacePath}/perstack`) {\n throw new Error(\"Access denied - perstack directory is not allowed\")\n }\n try {\n const realAbsolute = await fs.realpath(absolute)\n if (!realAbsolute.startsWith(workspacePath)) {\n throw new Error(\"Access denied - symlink target outside allowed directories\")\n }\n return realAbsolute\n } catch (error) {\n const parentDir = path.dirname(absolute)\n try {\n const realParentPath = await fs.realpath(parentDir)\n if (!realParentPath.startsWith(workspacePath)) {\n throw new Error(\"Access denied - parent directory outside allowed directories\")\n }\n return absolute\n } catch {\n if (!absolute.startsWith(workspacePath)) {\n throw new Error(\n `Access denied - path outside allowed directories: ${absolute} not in ${workspacePath}`,\n )\n }\n throw new Error(`Parent directory does not exist: ${parentDir}`)\n }\n }\n}\n","import type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\"\n\nexport function successToolResult(result: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(result) }] }\n}\n\nexport function errorToolResult(e: Error): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: e.name, message: e.message }) }],\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { appendFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nexport async function appendTextFile({ path, text }: { path: string; text: string }) {\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await appendFile(validatedPath, text)\n return { path: validatedPath, text }\n}\n\nexport function registerAppendTextFile(server: McpServer) {\n server.registerTool(\n \"appendTextFile\",\n {\n title: \"Append text file\",\n description: dedent`\n Adding content to the end of existing files.\n\n Use cases:\n - Adding entries to log files\n - Appending data to CSV or JSON files\n - Adding new sections to documentation\n - Extending configuration files\n - Building files incrementally\n\n How it works:\n - Appends text to the end of an existing file\n - Does not modify existing content\n - Creates a new line before appending if needed\n - Returns the appended file path\n\n Rules:\n - FILE MUST EXIST BEFORE APPENDING\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT APPEND ALL THE CONTENT AT ONCE\n - IF YOU WANT TO APPEND MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n `,\n inputSchema: {\n path: z.string().describe(\"Target file path to append to.\"),\n text: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Text to append to the file. Max 2000 characters.\"),\n },\n },\n async ({ path, text }: { path: string; text: string }) => {\n try {\n return successToolResult(await appendTextFile({ path, text }))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function attemptCompletion() {\n return {\n message: \"End the agent loop and provide a final report\",\n }\n}\n\nexport function registerAttemptCompletion(server: McpServer) {\n server.registerTool(\n \"attemptCompletion\",\n {\n title: \"Attempt completion\",\n description: dedent`\n Task completion signal that triggers immediate final report generation.\n Use cases:\n - Signaling task completion to Perstack runtime\n - Triggering final report generation\n - Ending the current expert's work cycle\n How it works:\n - Sends completion signal to Perstack runtime\n - Runtime immediately proceeds to final report generation\n - No confirmation or approval step required\n - No parameters needed for this signal\n Notes:\n - Triggers immediate transition to final report\n - Should only be used when task is fully complete\n - Cannot be reverted once called\n `,\n inputSchema: {},\n },\n async () => {\n try {\n return successToolResult(await attemptCompletion())\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function createDirectory(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const exists = existsSync(validatedPath)\n if (exists) {\n throw new Error(`Directory ${path} already exists`)\n }\n const parentDir = dirname(validatedPath)\n if (existsSync(parentDir)) {\n const parentStats = statSync(parentDir)\n if (!(parentStats.mode & 0o200)) {\n throw new Error(`Parent directory ${parentDir} is not writable`)\n }\n }\n await mkdir(validatedPath, { recursive: true })\n return {\n path: validatedPath,\n }\n}\n\nexport function registerCreateDirectory(server: McpServer) {\n server.registerTool(\n \"createDirectory\",\n {\n title: \"Create directory\",\n description: dedent`\n Directory creator for establishing folder structures in the workspace.\n\n Use cases:\n - Setting up project directory structure\n - Creating output folders for generated content\n - Organizing files into logical groups\n - Preparing directory hierarchies\n\n How it works:\n - Creates directories recursively\n - Handles existing directories gracefully\n - Creates parent directories as needed\n - Returns creation status\n \n Parameters:\n - path: Directory path to create\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await createDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { rm, rmdir } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function deleteDirectory(input: { path: string; recursive?: boolean }) {\n const { path, recursive } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`Directory ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!stats.isDirectory()) {\n throw new Error(`Path ${path} is not a directory. Use deleteFile tool instead.`)\n }\n if (!(stats.mode & 0o200)) {\n throw new Error(`Directory ${path} is not writable`)\n }\n if (recursive) {\n await rm(validatedPath, { recursive: true })\n } else {\n await rmdir(validatedPath)\n }\n return {\n path: validatedPath,\n }\n}\n\nexport function registerDeleteDirectory(server: McpServer) {\n server.registerTool(\n \"deleteDirectory\",\n {\n title: \"Delete directory\",\n description: dedent`\n Directory deleter for removing directories from the workspace.\n\n Use cases:\n - Removing temporary directories\n - Cleaning up build artifacts\n - Deleting empty directories after moving files\n\n How it works:\n - Validates directory existence and permissions\n - Removes directory (and contents if recursive is true)\n - Returns deletion status\n\n Parameters:\n - path: Directory path to delete\n - recursive: Set to true to delete non-empty directories\n `,\n inputSchema: {\n path: z.string(),\n recursive: z\n .boolean()\n .optional()\n .describe(\"Whether to delete contents recursively. Required for non-empty directories.\"),\n },\n },\n async (input: { path: string; recursive?: boolean }) => {\n try {\n return successToolResult(await deleteDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { unlink } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function deleteFile(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (stats.isDirectory()) {\n throw new Error(`Path ${path} is a directory. Use delete directory tool instead.`)\n }\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await unlink(validatedPath)\n return {\n path: validatedPath,\n }\n}\n\nexport function registerDeleteFile(server: McpServer) {\n server.registerTool(\n \"deleteFile\",\n {\n title: \"Delete file\",\n description: dedent`\n File deleter for removing files from the workspace.\n\n Use cases:\n - Removing temporary files\n - Cleaning up generated files\n - Deleting outdated configuration files\n - Removing unwanted artifacts\n\n How it works:\n - Validates file existence and permissions\n - Performs atomic delete operation\n - Returns deletion status\n \n Parameters:\n - path: File path to delete\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await deleteFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readFile, writeFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function editTextFile(input: { path: string; newText: string; oldText: string }) {\n const { path, newText, oldText } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await applyFileEdit(validatedPath, newText, oldText)\n return {\n path: validatedPath,\n newText,\n oldText,\n }\n}\n\nfunction normalizeLineEndings(text: string): string {\n return text.replace(/\\r\\n/g, \"\\n\")\n}\n\nasync function applyFileEdit(filePath: string, newText: string, oldText: string) {\n const content = normalizeLineEndings(await readFile(filePath, \"utf-8\"))\n const normalizedOld = normalizeLineEndings(oldText)\n const normalizedNew = normalizeLineEndings(newText)\n if (!content.includes(normalizedOld)) {\n throw new Error(`Could not find exact match for oldText in file ${filePath}`)\n }\n const modifiedContent = content.replace(normalizedOld, normalizedNew)\n await writeFile(filePath, modifiedContent, \"utf-8\")\n}\n\nexport function registerEditTextFile(server: McpServer) {\n server.registerTool(\n \"editTextFile\",\n {\n title: \"Edit text file\",\n description: dedent`\n Text file editor for modifying existing files with precise text replacement.\n\n Use cases:\n - Updating configuration values\n - Modifying code snippets\n - Replacing specific text blocks\n - Making targeted edits to files\n\n How it works:\n - Reads existing file content\n - Performs exact text replacement of oldText with newText\n - Normalizes line endings for consistent behavior\n - Returns summary of changes made\n - For appending text to files, use the appendTextFile tool instead\n \n Rules:\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO EDIT MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n - DO NOT USE THIS TOOL FOR APPENDING TEXT TO FILES - USE appendTextFile TOOL INSTEAD\n `,\n inputSchema: {\n path: z.string().describe(\"Target file path to edit.\"),\n newText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Text to append to the file. Max 2000 characters.\"),\n oldText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Exact text to find and replace. Max 2000 characters.\"),\n },\n },\n async (input: { path: string; newText: string; oldText: string }) => {\n try {\n return successToolResult(await editTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { execFile } from \"node:child_process\"\nimport { promisify } from \"node:util\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { successToolResult } from \"../lib/tool-result.js\"\n\nconst execFileAsync = promisify(execFile)\ntype ExecInput = {\n command: string\n args: string[]\n env: Record<string, string>\n cwd: string\n stdout: boolean\n stderr: boolean\n timeout?: number\n}\nexport async function exec(input: ExecInput) {\n const validatedCwd = await validatePath(input.cwd)\n const { stdout, stderr } = await execFileAsync(input.command, input.args, {\n cwd: validatedCwd,\n env: { ...process.env, ...input.env },\n timeout: input.timeout,\n })\n let output = \"\"\n if (input.stdout) {\n output += stdout\n }\n if (input.stderr) {\n output += stderr\n }\n if (!output.trim()) {\n output = \"Command executed successfully, but produced no output.\"\n }\n return { output }\n}\n\nexport function registerExec(server: McpServer) {\n server.registerTool(\n \"exec\",\n {\n title: \"Execute Command\",\n description: dedent`\n Command executor for running system commands and scripts.\n\n Use cases:\n - Running system tasks or scripts\n - Automating command-line tools or utilities\n - Executing build commands or test runners\n\n How it works:\n - Executes the specified command with arguments\n - Captures stdout and/or stderr based on flags\n - Returns command output or error information\n\n Parameters:\n - command: The command to execute (e.g., ls, python)\n - args: Arguments to pass to the command\n - env: Environment variables for the execution\n - cwd: Working directory for command execution\n - stdout: Whether to capture standard output\n - stderr: Whether to capture standard error\n - timeout: Timeout in milliseconds (optional)\n\n Rules:\n - Only execute commands from trusted sources\n - Do not execute long-running foreground commands (e.g., tail -f)\n - Be cautious with resource-intensive commands\n `,\n inputSchema: {\n command: z.string().describe(\"The command to execute\"),\n args: z.array(z.string()).describe(\"The arguments to pass to the command\"),\n env: z.record(z.string(), z.string()).describe(\"The environment variables to set\"),\n cwd: z.string().describe(\"The working directory to execute the command in\"),\n stdout: z.boolean().describe(\"Whether to capture the standard output\"),\n stderr: z.boolean().describe(\"Whether to capture the standard error\"),\n timeout: z.number().optional().describe(\"Timeout in milliseconds\"),\n },\n },\n async (input: ExecInput) => {\n try {\n return successToolResult(await exec(input))\n } catch (error: unknown) {\n const execError = error as {\n message?: string\n stdout?: string\n stderr?: string\n killed?: boolean\n signal?: string\n }\n let message = \"\"\n if (\n execError &&\n (execError.killed || execError.signal === \"SIGTERM\") &&\n typeof input.timeout === \"number\"\n ) {\n message = `Command timed out after ${input.timeout}ms.`\n } else if (error instanceof Error) {\n if (error.message.includes(\"timeout\")) {\n message = `Command timed out after ${input.timeout}ms.`\n } else {\n message = error.message\n }\n } else {\n message = \"An unknown error occurred.\"\n }\n const result: { error: string; stdout?: string; stderr?: string } = { error: message }\n if (execError.stdout && input.stdout) {\n result.stdout = execError.stdout\n }\n if (execError.stderr && input.stderr) {\n result.stderr = execError.stderr\n }\n return { content: [{ type: \"text\", text: JSON.stringify(result) }] }\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { basename, dirname, extname, resolve } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function getFileInfo(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File or directory ${path} does not exist`)\n }\n const stats = statSync(validatedPath)\n const isDirectory = stats.isDirectory()\n const mimeType = isDirectory ? null : mime.lookup(validatedPath) || \"application/octet-stream\"\n const formatSize = (bytes: number): string => {\n if (bytes === 0) return \"0 B\"\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"]\n const i = Math.floor(Math.log(bytes) / Math.log(1024))\n return `${(bytes / 1024 ** i).toFixed(2)} ${units[i]}`\n }\n return {\n exists: true,\n path: validatedPath,\n absolutePath: resolve(validatedPath),\n name: basename(validatedPath),\n directory: dirname(validatedPath),\n extension: isDirectory ? null : extname(validatedPath),\n type: isDirectory ? \"directory\" : \"file\",\n mimeType,\n size: stats.size,\n sizeFormatted: formatSize(stats.size),\n created: stats.birthtime.toISOString(),\n modified: stats.mtime.toISOString(),\n accessed: stats.atime.toISOString(),\n permissions: {\n readable: true,\n writable: Boolean(stats.mode & 0o200),\n executable: Boolean(stats.mode & 0o100),\n },\n }\n}\n\nexport function registerGetFileInfo(server: McpServer) {\n server.registerTool(\n \"getFileInfo\",\n {\n title: \"Get file info\",\n description: dedent`\n File information retriever for detailed metadata about files and directories.\n\n Use cases:\n - Checking file existence and type\n - Getting file size and timestamps\n - Determining MIME types\n - Validating file accessibility\n\n How it works:\n - Retrieves comprehensive file system metadata\n - Detects MIME type from file extension\n - Provides both absolute and relative paths\n - Returns human-readable file sizes\n \n Parameters:\n - path: File or directory path to inspect\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await getFileInfo(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readdir } from \"node:fs/promises\"\nimport { join } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\ninterface DirectoryItem {\n name: string\n path: string\n type: \"directory\" | \"file\"\n size: number\n modified: string\n}\nexport async function listDirectory(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`Directory ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!stats.isDirectory()) {\n throw new Error(`Path ${path} is not a directory.`)\n }\n const entries = await readdir(validatedPath)\n const items: DirectoryItem[] = []\n for (const entry of entries.sort()) {\n try {\n const fullPath = await validatePath(join(validatedPath, entry))\n const entryStats = statSync(fullPath)\n const item: DirectoryItem = {\n name: entry,\n path: entry,\n type: entryStats.isDirectory() ? \"directory\" : \"file\",\n size: entryStats.size,\n modified: entryStats.mtime.toISOString(),\n }\n items.push(item)\n } catch (e) {\n if (e instanceof Error && e.message.includes(\"perstack directory is not allowed\")) {\n continue\n }\n throw e\n }\n }\n return {\n path: validatedPath,\n items,\n }\n}\n\nexport function registerListDirectory(server: McpServer) {\n server.registerTool(\n \"listDirectory\",\n {\n title: \"List directory\",\n description: dedent`\n Directory content lister with detailed file information.\n\n Use cases:\n - Exploring project structure\n - Finding files in a directory\n - Checking directory contents before operations\n - Understanding file organization\n\n How it works:\n - Lists all files and subdirectories in specified directory only\n - Provides file type, size, and modification time\n - Sorts entries alphabetically\n - Handles empty directories\n \n Parameters:\n - path: Directory path to list (optional, defaults to workspace root)\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await listDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, rename } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function moveFile(input: { source: string; destination: string }) {\n const { source, destination } = input\n const validatedSource = await validatePath(source)\n const validatedDestination = await validatePath(destination)\n if (!existsSync(validatedSource)) {\n throw new Error(`Source file ${source} does not exist.`)\n }\n const sourceStats = statSync(validatedSource)\n if (!(sourceStats.mode & 0o200)) {\n throw new Error(`Source file ${source} is not writable`)\n }\n if (existsSync(validatedDestination)) {\n throw new Error(`Destination ${destination} already exists.`)\n }\n const destDir = dirname(validatedDestination)\n await mkdir(destDir, { recursive: true })\n await rename(validatedSource, validatedDestination)\n return {\n source: validatedSource,\n destination: validatedDestination,\n }\n}\n\nexport function registerMoveFile(server: McpServer) {\n server.registerTool(\n \"moveFile\",\n {\n title: \"Move file\",\n description: dedent`\n File mover for relocating or renaming files within the workspace.\n\n Use cases:\n - Renaming files to follow naming conventions\n - Moving files to different directories\n - Organizing project structure\n - Backing up files before modifications\n\n How it works:\n - Validates source file existence\n - Creates destination directory if needed\n - Performs atomic move operation\n - Preserves file permissions and timestamps\n \n Parameters:\n - source: Current file path\n - destination: Target file path\n `,\n inputSchema: {\n source: z.string(),\n destination: z.string(),\n },\n },\n async (input: { source: string; destination: string }) => {\n try {\n return successToolResult(await moveFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst MAX_IMAGE_SIZE = 15 * 1024 * 1024\nexport async function readImageFile(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (!mimeType || ![\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"].includes(mimeType)) {\n throw new Error(`File ${path} is not supported.`)\n }\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_IMAGE_SIZE) {\n throw new Error(\n `Image file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_IMAGE_SIZE / (1024 * 1024)}MB. Please use a smaller image file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n\nexport function registerReadImageFile(server: McpServer) {\n server.registerTool(\n \"readImageFile\",\n {\n title: \"Read image file\",\n description: dedent`\n Image file reader that converts images to base64 encoded strings with MIME type validation.\n\n Use cases:\n - Loading images for LLM to process\n - Retrieving image data for analysis or display\n - Converting workspace image files to base64 format\n\n How it works:\n - Validates file existence and MIME type before reading\n - Encodes file content as base64 string\n - Returns image data with correct MIME type for proper handling\n - Rejects unsupported formats with clear error messages\n\n Supported formats:\n - PNG (image/png)\n - JPEG/JPG (image/jpeg)\n - GIF (image/gif) - static only, animated not supported\n - WebP (image/webp)\n \n Notes:\n - Maximum file size: 15MB (larger files will be rejected)\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await readImageFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst MAX_PDF_SIZE = 30 * 1024 * 1024\nexport async function readPdfFile(input: { path: string }) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (mimeType !== \"application/pdf\") {\n throw new Error(`File ${path} is not a PDF file.`)\n }\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_PDF_SIZE) {\n throw new Error(\n `PDF file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_PDF_SIZE / (1024 * 1024)}MB. Please use a smaller PDF file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n\nexport function registerReadPdfFile(server: McpServer) {\n server.registerTool(\n \"readPdfFile\",\n {\n title: \"Read PDF file\",\n description: dedent`\n PDF file reader that converts documents to base64 encoded resources.\n\n Use cases:\n - Extracting content from PDF documents for analysis\n - Loading PDF files for LLM processing\n - Retrieving PDF data for conversion or manipulation\n\n How it works:\n - Validates file existence and MIME type (application/pdf)\n - Encodes PDF content as base64 blob\n - Returns as resource type with proper MIME type and URI\n - Rejects non-PDF files with clear error messages\n\n Notes:\n - Returns entire PDF content, no page range support\n - Maximum file size: 30MB (larger files will be rejected)\n - Text extraction not performed, returns raw PDF data\n `,\n inputSchema: {\n path: z.string(),\n },\n },\n async (input: { path: string }) => {\n try {\n return successToolResult(await readPdfFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { readFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function readTextFile(input: { path: string; from?: number; to?: number }) {\n const { path, from, to } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const fileContent = await readFile(validatedPath, \"utf-8\")\n const lines = fileContent.split(\"\\n\")\n const fromLine = from ?? 0\n const toLine = to ?? lines.length\n const selectedLines = lines.slice(fromLine, toLine)\n const content = selectedLines.join(\"\\n\")\n return {\n path,\n content,\n from: fromLine,\n to: toLine,\n }\n}\n\nexport function registerReadTextFile(server: McpServer) {\n server.registerTool(\n \"readTextFile\",\n {\n title: \"Read text file\",\n description: dedent`\n Text file reader with line range support for UTF-8 encoded files.\n\n Use cases:\n - Reading source code files for analysis\n - Extracting specific sections from large text files\n - Loading configuration or documentation files\n - Viewing log files or data files\n\n How it works:\n - Reads files as UTF-8 encoded text without format validation\n - Supports partial file reading via line number ranges\n - Returns content wrapped in JSON with metadata\n - WARNING: Binary files will cause errors or corrupted output\n\n Common file types:\n - Source code: .ts, .js, .py, .java, .cpp, etc.\n - Documentation: .md, .txt, .rst\n - Configuration: .json, .yaml, .toml, .ini\n - Data files: .csv, .log, .sql\n `,\n inputSchema: {\n path: z.string(),\n from: z.number().optional().describe(\"The line number to start reading from.\"),\n to: z.number().optional().describe(\"The line number to stop reading at.\"),\n },\n },\n async (input: { path: string; from?: number; to?: number }) => {\n try {\n return successToolResult(await readTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nclass Thought {\n thoughtHistory: { thought: string; nextThoughtNeeded?: boolean }[] = []\n public processThought(input: { thought: string; nextThoughtNeeded?: boolean }) {\n const { nextThoughtNeeded } = input\n this.thoughtHistory.push(input)\n return {\n nextThoughtNeeded,\n thoughtHistoryLength: this.thoughtHistory.length,\n }\n }\n}\nconst thought = new Thought()\nexport async function think(input: { thought: string; nextThoughtNeeded?: boolean }) {\n return thought.processThought(input)\n}\n\nexport function registerThink(server: McpServer) {\n server.registerTool(\n \"think\",\n {\n title: \"think\",\n description: dedent`\n Sequential thinking tool for step-by-step problem analysis and solution development.\n\n Use cases:\n - Breaking down complex problems into manageable steps\n - Developing solutions through iterative reasoning\n - Analyzing problems that require multiple perspectives\n - Planning tasks with dependencies and considerations\n\n How it works:\n - Records each thinking step sequentially\n - Maintains thought history for context\n - Continues until solution is reached\n - Returns thought count and continuation status\n\n Parameters:\n - thought: Current reasoning step or analysis\n - nextThoughtNeeded: Whether additional thinking is required (optional)\n\n Best practices:\n - Use multiple calls for sophisticated reasoning chains\n - Progress from high-level overview to detailed analysis (drill-down approach)\n - Capture insights and eureka moments as they emerge\n - Engage in reflective introspection and constructive self-critique\n - Set nextThoughtNeeded to false only when fully satisfied with the solution\n `,\n inputSchema: {\n thought: z.string().describe(\"Your current thinking step\"),\n nextThoughtNeeded: z\n .boolean()\n .optional()\n .describe(\"true if you need more thinking, even if at what seemed like the end\"),\n },\n },\n async (input: { thought: string; nextThoughtNeeded?: boolean }) => {\n try {\n return successToolResult(await think(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nclass Todo {\n currentTodoId = 0\n todos: { id: number; title: string; completed: boolean }[] = []\n public processTodo(input: { newTodos?: string[]; completedTodos?: number[] }) {\n const { newTodos, completedTodos } = input\n if (newTodos) {\n this.todos.push(\n ...newTodos.map((title) => ({ id: this.currentTodoId++, title, completed: false })),\n )\n }\n if (completedTodos) {\n this.todos = this.todos.map((todo) => ({\n ...todo,\n completed: todo.completed || completedTodos.includes(todo.id),\n }))\n }\n return {\n todos: this.todos,\n }\n }\n public clearTodo() {\n this.todos = []\n this.currentTodoId = 0\n return {\n todos: this.todos,\n }\n }\n}\nconst todoSingleton = new Todo()\nexport async function todo(input: { newTodos?: string[]; completedTodos?: number[] }) {\n return todoSingleton.processTodo(input)\n}\nexport async function clearTodo() {\n return todoSingleton.clearTodo()\n}\n\nexport function registerTodo(server: McpServer) {\n server.registerTool(\n \"todo\",\n {\n title: \"todo\",\n description: dedent`\n Todo list manager that tracks tasks and their completion status.\n\n Use cases:\n - Creating new tasks or action items\n - Marking tasks as completed\n - Viewing current task list and status\n\n How it works:\n - Each todo gets a unique ID when created\n - Returns the full todo list after every operation\n - Maintains state across multiple calls\n\n Parameters:\n - newTodos: Array of task descriptions to add\n - completedTodos: Array of todo IDs to mark as completed\n `,\n inputSchema: {\n newTodos: z.array(z.string()).describe(\"New todos to add\").optional(),\n completedTodos: z.array(z.number()).describe(\"Todo ids that are completed\").optional(),\n },\n },\n async (input: { newTodos?: string[]; completedTodos?: number[] }) => {\n try {\n return successToolResult(await todo(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n\nexport function registerClearTodo(server: McpServer) {\n server.registerTool(\n \"clearTodo\",\n {\n title: \"clearTodo\",\n description: dedent`\n Clears the todo list.\n\n Use cases:\n - Resetting the todo list to an empty state\n - Starting fresh with a new task list\n - Clearing all tasks for a new day or project\n\n How it works:\n - Resets the todo list to an empty state\n - Returns an empty todo list\n `,\n inputSchema: {},\n },\n async () => {\n try {\n return successToolResult(await clearTodo())\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, writeFile } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod/v4\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\nexport async function writeTextFile(input: { path: string; text: string }) {\n const { path, text } = input\n const validatedPath = await validatePath(path)\n if (existsSync(validatedPath)) {\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n }\n const dir = dirname(validatedPath)\n await mkdir(dir, { recursive: true })\n await writeFile(validatedPath, text, \"utf-8\")\n return {\n path: validatedPath,\n text,\n }\n}\n\nexport function registerWriteTextFile(server: McpServer) {\n server.registerTool(\n \"writeTextFile\",\n {\n title: \"writeTextFile\",\n description: dedent`\n Text file writer that creates or overwrites files with UTF-8 content.\n\n Use cases:\n - Creating new configuration files\n - Writing generated code or documentation\n - Saving processed data or results\n - Creating log files or reports\n\n How it works:\n - Writes content as UTF-8 encoded text\n - Returns success status with file path\n\n Rules:\n - IF THE FILE ALREADY EXISTS, IT WILL BE OVERWRITTEN\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO WRITE MORE THAN 10,000 CHARACTERS, USE \"appendTextFile\" TOOL AFTER THIS ONE\n `,\n inputSchema: {\n path: z.string().describe(\"Target file path (relative or absolute).\"),\n text: z.string().max(10_000).describe(\"Text to write to the file. Max 10000 characters.\"),\n },\n },\n async (input: { path: string; text: string }) => {\n try {\n return successToolResult(await writeTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,87 +1,75 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
1
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare function validatePath(requestedPath: string): Promise<string>;
|
|
5
5
|
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
declare function successToolResult(result: unknown): CallToolResult;
|
|
7
|
+
declare function errorToolResult(e: Error): CallToolResult;
|
|
8
|
+
|
|
9
|
+
declare function appendTextFile({ path, text }: {
|
|
10
|
+
path: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}): Promise<{
|
|
12
13
|
path: string;
|
|
13
14
|
text: string;
|
|
14
15
|
}>;
|
|
15
16
|
declare function registerAppendTextFile(server: McpServer): void;
|
|
16
17
|
|
|
17
|
-
declare
|
|
18
|
-
type InputSchema$d = z.infer<typeof inputSchema$d>;
|
|
19
|
-
declare function attemptCompletion(_input: InputSchema$d): Promise<{
|
|
18
|
+
declare function attemptCompletion(): Promise<{
|
|
20
19
|
message: string;
|
|
21
20
|
}>;
|
|
22
21
|
declare function registerAttemptCompletion(server: McpServer): void;
|
|
23
22
|
|
|
24
|
-
declare
|
|
25
|
-
path:
|
|
26
|
-
}
|
|
27
|
-
type InputSchema$c = z.infer<typeof inputSchema$c>;
|
|
28
|
-
declare function createDirectory(input: InputSchema$c): Promise<{
|
|
23
|
+
declare function createDirectory(input: {
|
|
24
|
+
path: string;
|
|
25
|
+
}): Promise<{
|
|
29
26
|
path: string;
|
|
30
27
|
}>;
|
|
31
28
|
declare function registerCreateDirectory(server: McpServer): void;
|
|
32
29
|
|
|
33
|
-
declare
|
|
34
|
-
path:
|
|
35
|
-
recursive
|
|
36
|
-
}
|
|
37
|
-
type InputSchema$b = z.infer<typeof inputSchema$b>;
|
|
38
|
-
declare function deleteDirectory(input: InputSchema$b): Promise<{
|
|
30
|
+
declare function deleteDirectory(input: {
|
|
31
|
+
path: string;
|
|
32
|
+
recursive?: boolean;
|
|
33
|
+
}): Promise<{
|
|
39
34
|
path: string;
|
|
40
35
|
}>;
|
|
41
36
|
declare function registerDeleteDirectory(server: McpServer): void;
|
|
42
37
|
|
|
43
|
-
declare
|
|
44
|
-
path:
|
|
45
|
-
}
|
|
46
|
-
type InputSchema$a = z.infer<typeof inputSchema$a>;
|
|
47
|
-
declare function deleteFile(input: InputSchema$a): Promise<{
|
|
38
|
+
declare function deleteFile(input: {
|
|
39
|
+
path: string;
|
|
40
|
+
}): Promise<{
|
|
48
41
|
path: string;
|
|
49
42
|
}>;
|
|
50
43
|
declare function registerDeleteFile(server: McpServer): void;
|
|
51
44
|
|
|
52
|
-
declare
|
|
53
|
-
path:
|
|
54
|
-
newText:
|
|
55
|
-
oldText:
|
|
56
|
-
}
|
|
57
|
-
type InputSchema$9 = z.infer<typeof inputSchema$9>;
|
|
58
|
-
declare function editTextFile(input: InputSchema$9): Promise<{
|
|
45
|
+
declare function editTextFile(input: {
|
|
46
|
+
path: string;
|
|
47
|
+
newText: string;
|
|
48
|
+
oldText: string;
|
|
49
|
+
}): Promise<{
|
|
59
50
|
path: string;
|
|
60
51
|
newText: string;
|
|
61
52
|
oldText: string;
|
|
62
53
|
}>;
|
|
63
54
|
declare function registerEditTextFile(server: McpServer): void;
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
command:
|
|
67
|
-
args:
|
|
68
|
-
env:
|
|
69
|
-
cwd:
|
|
70
|
-
stdout:
|
|
71
|
-
stderr:
|
|
72
|
-
timeout
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
declare function exec(input: InputSchema$8): Promise<{
|
|
56
|
+
type ExecInput = {
|
|
57
|
+
command: string;
|
|
58
|
+
args: string[];
|
|
59
|
+
env: Record<string, string>;
|
|
60
|
+
cwd: string;
|
|
61
|
+
stdout: boolean;
|
|
62
|
+
stderr: boolean;
|
|
63
|
+
timeout?: number;
|
|
64
|
+
};
|
|
65
|
+
declare function exec(input: ExecInput): Promise<{
|
|
76
66
|
output: string;
|
|
77
67
|
}>;
|
|
78
68
|
declare function registerExec(server: McpServer): void;
|
|
79
69
|
|
|
80
|
-
declare
|
|
81
|
-
path:
|
|
82
|
-
}
|
|
83
|
-
type InputSchema$7 = z.infer<typeof inputSchema$7>;
|
|
84
|
-
declare function getFileInfo(input: InputSchema$7): Promise<{
|
|
70
|
+
declare function getFileInfo(input: {
|
|
71
|
+
path: string;
|
|
72
|
+
}): Promise<{
|
|
85
73
|
exists: boolean;
|
|
86
74
|
path: string;
|
|
87
75
|
absolutePath: string;
|
|
@@ -103,10 +91,6 @@ declare function getFileInfo(input: InputSchema$7): Promise<{
|
|
|
103
91
|
}>;
|
|
104
92
|
declare function registerGetFileInfo(server: McpServer): void;
|
|
105
93
|
|
|
106
|
-
declare const inputSchema$6: z.ZodObject<{
|
|
107
|
-
path: z.ZodString;
|
|
108
|
-
}, z.core.$strip>;
|
|
109
|
-
type InputSchema$6 = z.infer<typeof inputSchema$6>;
|
|
110
94
|
interface DirectoryItem {
|
|
111
95
|
name: string;
|
|
112
96
|
path: string;
|
|
@@ -114,52 +98,46 @@ interface DirectoryItem {
|
|
|
114
98
|
size: number;
|
|
115
99
|
modified: string;
|
|
116
100
|
}
|
|
117
|
-
declare function listDirectory(input:
|
|
101
|
+
declare function listDirectory(input: {
|
|
102
|
+
path: string;
|
|
103
|
+
}): Promise<{
|
|
118
104
|
path: string;
|
|
119
105
|
items: DirectoryItem[];
|
|
120
106
|
}>;
|
|
121
107
|
declare function registerListDirectory(server: McpServer): void;
|
|
122
108
|
|
|
123
|
-
declare
|
|
124
|
-
source:
|
|
125
|
-
destination:
|
|
126
|
-
}
|
|
127
|
-
type InputSchema$5 = z.infer<typeof inputSchema$5>;
|
|
128
|
-
declare function moveFile(input: InputSchema$5): Promise<{
|
|
109
|
+
declare function moveFile(input: {
|
|
110
|
+
source: string;
|
|
111
|
+
destination: string;
|
|
112
|
+
}): Promise<{
|
|
129
113
|
source: string;
|
|
130
114
|
destination: string;
|
|
131
115
|
}>;
|
|
132
116
|
declare function registerMoveFile(server: McpServer): void;
|
|
133
117
|
|
|
134
|
-
declare
|
|
135
|
-
path:
|
|
136
|
-
}
|
|
137
|
-
type InputSchema$4 = z.infer<typeof inputSchema$4>;
|
|
138
|
-
declare function readImageFile(input: InputSchema$4): Promise<{
|
|
118
|
+
declare function readImageFile(input: {
|
|
119
|
+
path: string;
|
|
120
|
+
}): Promise<{
|
|
139
121
|
path: string;
|
|
140
122
|
mimeType: string;
|
|
141
123
|
size: number;
|
|
142
124
|
}>;
|
|
143
125
|
declare function registerReadImageFile(server: McpServer): void;
|
|
144
126
|
|
|
145
|
-
declare
|
|
146
|
-
path:
|
|
147
|
-
}
|
|
148
|
-
type InputSchema$3 = z.infer<typeof inputSchema$3>;
|
|
149
|
-
declare function readPdfFile(input: InputSchema$3): Promise<{
|
|
127
|
+
declare function readPdfFile(input: {
|
|
128
|
+
path: string;
|
|
129
|
+
}): Promise<{
|
|
150
130
|
path: string;
|
|
151
131
|
mimeType: string;
|
|
152
132
|
size: number;
|
|
153
133
|
}>;
|
|
154
134
|
declare function registerReadPdfFile(server: McpServer): void;
|
|
155
135
|
|
|
156
|
-
declare
|
|
157
|
-
path:
|
|
158
|
-
from
|
|
159
|
-
to
|
|
160
|
-
}
|
|
161
|
-
type InputSchema$2 = z.infer<typeof inputSchema$2>;
|
|
162
|
-
declare function readTextFile(input: InputSchema$2): Promise<{
|
|
136
|
+
declare function readTextFile(input: {
|
|
137
|
+
path: string;
|
|
138
|
+
from?: number;
|
|
139
|
+
to?: number;
|
|
140
|
+
}): Promise<{
|
|
163
141
|
path: string;
|
|
164
142
|
content: string;
|
|
165
143
|
from: number;
|
|
@@ -167,32 +145,26 @@ declare function readTextFile(input: InputSchema$2): Promise<{
|
|
|
167
145
|
}>;
|
|
168
146
|
declare function registerReadTextFile(server: McpServer): void;
|
|
169
147
|
|
|
170
|
-
declare
|
|
171
|
-
thought:
|
|
172
|
-
nextThoughtNeeded
|
|
173
|
-
}
|
|
174
|
-
type InputSchema$1 = z.infer<typeof inputSchema$1>;
|
|
175
|
-
declare function think(input: InputSchema$1): Promise<{
|
|
148
|
+
declare function think(input: {
|
|
149
|
+
thought: string;
|
|
150
|
+
nextThoughtNeeded?: boolean;
|
|
151
|
+
}): Promise<{
|
|
176
152
|
nextThoughtNeeded: boolean | undefined;
|
|
177
153
|
thoughtHistoryLength: number;
|
|
178
154
|
}>;
|
|
179
155
|
declare function registerThink(server: McpServer): void;
|
|
180
156
|
|
|
181
|
-
declare
|
|
182
|
-
newTodos
|
|
183
|
-
completedTodos
|
|
184
|
-
}
|
|
185
|
-
type TodoInputSchema = z.infer<typeof todoInputSchema>;
|
|
186
|
-
declare const clearTodoInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
187
|
-
type ClearTodoInputSchema = z.infer<typeof clearTodoInputSchema>;
|
|
188
|
-
declare function todo(input: TodoInputSchema): Promise<{
|
|
157
|
+
declare function todo(input: {
|
|
158
|
+
newTodos?: string[];
|
|
159
|
+
completedTodos?: number[];
|
|
160
|
+
}): Promise<{
|
|
189
161
|
todos: {
|
|
190
162
|
id: number;
|
|
191
163
|
title: string;
|
|
192
164
|
completed: boolean;
|
|
193
165
|
}[];
|
|
194
166
|
}>;
|
|
195
|
-
declare function clearTodo(
|
|
167
|
+
declare function clearTodo(): Promise<{
|
|
196
168
|
todos: {
|
|
197
169
|
id: number;
|
|
198
170
|
title: string;
|
|
@@ -202,15 +174,13 @@ declare function clearTodo(_input: ClearTodoInputSchema): Promise<{
|
|
|
202
174
|
declare function registerTodo(server: McpServer): void;
|
|
203
175
|
declare function registerClearTodo(server: McpServer): void;
|
|
204
176
|
|
|
205
|
-
declare
|
|
206
|
-
path:
|
|
207
|
-
text:
|
|
208
|
-
}
|
|
209
|
-
type InputSchema = z.infer<typeof inputSchema>;
|
|
210
|
-
declare function writeTextFile(input: InputSchema): Promise<{
|
|
177
|
+
declare function writeTextFile(input: {
|
|
178
|
+
path: string;
|
|
179
|
+
text: string;
|
|
180
|
+
}): Promise<{
|
|
211
181
|
path: string;
|
|
212
182
|
text: string;
|
|
213
183
|
}>;
|
|
214
184
|
declare function registerWriteTextFile(server: McpServer): void;
|
|
215
185
|
|
|
216
|
-
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, think, todo, validatePath, writeTextFile };
|
|
186
|
+
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, errorToolResult, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, successToolResult, think, todo, validatePath, writeTextFile };
|
package/dist/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, think, todo, validatePath, writeTextFile } from '../chunk-
|
|
1
|
+
export { appendTextFile, attemptCompletion, clearTodo, createDirectory, deleteDirectory, deleteFile, editTextFile, errorToolResult, exec, getFileInfo, listDirectory, moveFile, readImageFile, readPdfFile, readTextFile, registerAppendTextFile, registerAttemptCompletion, registerClearTodo, registerCreateDirectory, registerDeleteDirectory, registerDeleteFile, registerEditTextFile, registerExec, registerGetFileInfo, registerListDirectory, registerMoveFile, registerReadImageFile, registerReadPdfFile, registerReadTextFile, registerThink, registerTodo, registerWriteTextFile, successToolResult, think, todo, validatePath, writeTextFile } from '../chunk-2DL5RINQ.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/path.ts","../src/lib/tool-result.ts","../src/tools/append-text-file.ts","../src/tools/attempt-completion.ts","../src/tools/create-directory.ts","../src/tools/delete-directory.ts","../src/tools/delete-file.ts","../src/tools/edit-text-file.ts","../src/tools/exec.ts","../src/tools/get-file-info.ts","../src/tools/list-directory.ts","../src/tools/move-file.ts","../src/tools/read-image-file.ts","../src/tools/read-pdf-file.ts","../src/tools/read-text-file.ts","../src/tools/think.ts","../src/tools/todo.ts","../src/tools/write-text-file.ts"],"names":["path","inputSchema","z","dedent","existsSync","statSync","dirname","mkdir","mime","stat","readFile","todo","writeFile"],"mappings":";;;;;;;;;;;AAKO,IAAM,gBAAgB,YAAA,CAAa,UAAA,CAAW,OAAA,CAAQ,GAAA,EAAK,CAAC,CAAA;AAEnE,SAAS,WAAW,QAAA,EAA0B;AAC5C,EAAA,IAAI,QAAA,CAAS,UAAA,CAAW,IAAI,CAAA,IAAK,aAAa,GAAA,EAAK;AACjD,IAAA,OAAO,IAAA,CAAK,KAAK,EAAA,CAAG,OAAA,IAAW,QAAA,CAAS,KAAA,CAAM,CAAC,CAAC,CAAA;AAAA,EAClD;AACA,EAAA,OAAO,QAAA;AACT;A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ACP,WAAA,EAAaT,MAAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAA,CAAA;AAAA,MAmBb,aAAaF,aAAAA,CAAY;AAAA,KAC3B;AAAA,IACA,OAAO,KAAA,KAAuB;AAC5B,MAAA,IAAI;AACF,QAAA,OAAO,iBAAA,CAAkB,MAAM,aAAA,CAAc,KAAK,CAAC,CAAA;AAAA,MACrD,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,CAAA,YAAa,KAAA,EAAO,OAAO,eAAA,CAAgB,CAAC,CAAA;AAChD,QAAA,MAAM,CAAA;AAAA,MACR;AAAA,IACF;AAAA,GACF;AACF","file":"chunk-H76GGP62.js","sourcesContent":["import { realpathSync } from \"node:fs\"\nimport fs from \"node:fs/promises\"\nimport os from \"node:os\"\nimport path from \"node:path\"\n\nexport const workspacePath = realpathSync(expandHome(process.cwd()))\n\nfunction expandHome(filepath: string): string {\n if (filepath.startsWith(\"~/\") || filepath === \"~\") {\n return path.join(os.homedir(), filepath.slice(1))\n }\n return filepath\n}\n\nexport async function validatePath(requestedPath: string): Promise<string> {\n const expandedPath = expandHome(requestedPath)\n const absolute = path.isAbsolute(expandedPath)\n ? path.resolve(expandedPath)\n : path.resolve(process.cwd(), expandedPath)\n if (absolute === `${workspacePath}/perstack`) {\n throw new Error(\"Access denied - perstack directory is not allowed\")\n }\n try {\n const realAbsolute = await fs.realpath(absolute)\n if (!realAbsolute.startsWith(workspacePath)) {\n throw new Error(\"Access denied - symlink target outside allowed directories\")\n }\n return realAbsolute\n } catch (error) {\n const parentDir = path.dirname(absolute)\n try {\n const realParentPath = await fs.realpath(parentDir)\n if (!realParentPath.startsWith(workspacePath)) {\n throw new Error(\"Access denied - parent directory outside allowed directories\")\n }\n return absolute\n } catch {\n if (!absolute.startsWith(workspacePath)) {\n throw new Error(\n `Access denied - path outside allowed directories: ${absolute} not in ${workspacePath}`,\n )\n }\n throw new Error(`Parent directory does not exist: ${parentDir}`)\n }\n }\n}\n","import type { CallToolResult } from \"@modelcontextprotocol/sdk/types.js\"\n\nexport function successToolResult(result: unknown): CallToolResult {\n return { content: [{ type: \"text\", text: JSON.stringify(result) }] }\n}\n\nexport function errorToolResult(e: Error): CallToolResult {\n return {\n content: [{ type: \"text\", text: JSON.stringify({ error: e.name, message: e.message }) }],\n }\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { appendFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string().describe(\"Target file path to append to.\"),\n text: z.string().min(1).max(2_000).describe(\"Text to append to the file. Max 2000 characters.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function appendTextFile(input: InputSchema) {\n const { path, text } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await appendFile(validatedPath, text)\n return { path: validatedPath, text }\n}\n\nexport function registerAppendTextFile(server: McpServer) {\n server.registerTool(\n \"appendTextFile\",\n {\n title: \"Append text file\",\n description: dedent`\n Adding content to the end of existing files.\n\n Use cases:\n - Adding entries to log files\n - Appending data to CSV or JSON files\n - Adding new sections to documentation\n - Extending configuration files\n - Building files incrementally\n\n How it works:\n - Appends text to the end of an existing file\n - Does not modify existing content\n - Creates a new line before appending if needed\n - Returns the appended file path\n\n Rules:\n - FILE MUST EXIST BEFORE APPENDING\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT APPEND ALL THE CONTENT AT ONCE\n - IF YOU WANT TO APPEND MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await appendTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function attemptCompletion(_input: InputSchema) {\n return {\n message: \"End the agent loop and provide a final report\",\n }\n}\n\nexport function registerAttemptCompletion(server: McpServer) {\n server.registerTool(\n \"attemptCompletion\",\n {\n title: \"Attempt completion\",\n description: dedent`\n Task completion signal that triggers immediate final report generation.\n Use cases:\n - Signaling task completion to Perstack runtime\n - Triggering final report generation\n - Ending the current expert's work cycle\n How it works:\n - Sends completion signal to Perstack runtime\n - Runtime immediately proceeds to final report generation\n - No confirmation or approval step required\n - No parameters needed for this signal\n Notes:\n - Triggers immediate transition to final report\n - Should only be used when task is fully complete\n - Cannot be reverted once called\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await attemptCompletion(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function createDirectory(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const exists = existsSync(validatedPath)\n if (exists) {\n throw new Error(`Directory ${path} already exists`)\n }\n const parentDir = dirname(validatedPath)\n if (existsSync(parentDir)) {\n const parentStats = statSync(parentDir)\n if (!(parentStats.mode & 0o200)) {\n throw new Error(`Parent directory ${parentDir} is not writable`)\n }\n }\n await mkdir(validatedPath, { recursive: true })\n return {\n path: validatedPath,\n }\n}\n\nexport function registerCreateDirectory(server: McpServer) {\n server.registerTool(\n \"createDirectory\",\n {\n title: \"Create directory\",\n description: dedent`\n Directory creator for establishing folder structures in the workspace.\n\n Use cases:\n - Setting up project directory structure\n - Creating output folders for generated content\n - Organizing files into logical groups\n - Preparing directory hierarchies\n\n How it works:\n - Creates directories recursively\n - Handles existing directories gracefully\n - Creates parent directories as needed\n - Returns creation status\n \n Parameters:\n - path: Directory path to create\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await createDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { rm, rmdir } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n recursive: z\n .boolean()\n .optional()\n .describe(\"Whether to delete contents recursively. Required for non-empty directories.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function deleteDirectory(input: InputSchema) {\n const { path, recursive } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`Directory ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!stats.isDirectory()) {\n throw new Error(`Path ${path} is not a directory. Use deleteFile tool instead.`)\n }\n if (!(stats.mode & 0o200)) {\n throw new Error(`Directory ${path} is not writable`)\n }\n if (recursive) {\n await rm(validatedPath, { recursive: true })\n } else {\n await rmdir(validatedPath)\n }\n return {\n path: validatedPath,\n }\n}\n\nexport function registerDeleteDirectory(server: McpServer) {\n server.registerTool(\n \"deleteDirectory\",\n {\n title: \"Delete directory\",\n description: dedent`\n Directory deleter for removing directories from the workspace.\n\n Use cases:\n - Removing temporary directories\n - Cleaning up build artifacts\n - Deleting empty directories after moving files\n\n How it works:\n - Validates directory existence and permissions\n - Removes directory (and contents if recursive is true)\n - Returns deletion status\n\n Parameters:\n - path: Directory path to delete\n - recursive: Set to true to delete non-empty directories\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await deleteDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { unlink } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function deleteFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (stats.isDirectory()) {\n throw new Error(`Path ${path} is a directory. Use delete directory tool instead.`)\n }\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await unlink(validatedPath)\n return {\n path: validatedPath,\n }\n}\n\nexport function registerDeleteFile(server: McpServer) {\n server.registerTool(\n \"deleteFile\",\n {\n title: \"Delete file\",\n description: dedent`\n File deleter for removing files from the workspace.\n\n Use cases:\n - Removing temporary files\n - Cleaning up generated files\n - Deleting outdated configuration files\n - Removing unwanted artifacts\n\n How it works:\n - Validates file existence and permissions\n - Performs atomic delete operation\n - Returns deletion status\n \n Parameters:\n - path: File path to delete\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await deleteFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readFile, writeFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string().describe(\"Target file path to edit.\"),\n newText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Text to append to the file. Max 2000 characters.\"),\n oldText: z\n .string()\n .min(1)\n .max(2_000)\n .describe(\"Exact text to find and replace. Max 2000 characters.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function editTextFile(input: InputSchema) {\n const { path, newText, oldText } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n await applyFileEdit(validatedPath, newText, oldText)\n return {\n path: validatedPath,\n newText,\n oldText,\n }\n}\n\nfunction normalizeLineEndings(text: string): string {\n return text.replace(/\\r\\n/g, \"\\n\")\n}\n\nasync function applyFileEdit(filePath: string, newText: string, oldText: string) {\n const content = normalizeLineEndings(await readFile(filePath, \"utf-8\"))\n const normalizedOld = normalizeLineEndings(oldText)\n const normalizedNew = normalizeLineEndings(newText)\n if (!content.includes(normalizedOld)) {\n throw new Error(`Could not find exact match for oldText in file ${filePath}`)\n }\n const modifiedContent = content.replace(normalizedOld, normalizedNew)\n await writeFile(filePath, modifiedContent, \"utf-8\")\n}\n\nexport function registerEditTextFile(server: McpServer) {\n server.registerTool(\n \"editTextFile\",\n {\n title: \"Edit text file\",\n description: dedent`\n Text file editor for modifying existing files with precise text replacement.\n\n Use cases:\n - Updating configuration values\n - Modifying code snippets\n - Replacing specific text blocks\n - Making targeted edits to files\n\n How it works:\n - Reads existing file content\n - Performs exact text replacement of oldText with newText\n - Normalizes line endings for consistent behavior\n - Returns summary of changes made\n - For appending text to files, use the appendTextFile tool instead\n \n Rules:\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO EDIT MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES\n - DO NOT USE THIS TOOL FOR APPENDING TEXT TO FILES - USE appendTextFile TOOL INSTEAD\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await editTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { execFile } from \"node:child_process\"\nimport { promisify } from \"node:util\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { successToolResult } from \"../lib/tool-result.js\"\n\nconst execFileAsync = promisify(execFile)\n\nconst inputSchema = z.object({\n command: z.string().describe(\"The command to execute\"),\n args: z.array(z.string()).describe(\"The arguments to pass to the command\"),\n env: z.record(z.string(), z.string()).describe(\"The environment variables to set\"),\n cwd: z.string().describe(\"The working directory to execute the command in\"),\n stdout: z.boolean().describe(\"Whether to capture the standard output\"),\n stderr: z.boolean().describe(\"Whether to capture the standard error\"),\n timeout: z.number().optional().describe(\"Timeout in milliseconds\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function exec(input: InputSchema) {\n const validatedCwd = await validatePath(input.cwd)\n const { stdout, stderr } = await execFileAsync(input.command, input.args, {\n cwd: validatedCwd,\n env: { ...process.env, ...input.env },\n timeout: input.timeout,\n })\n let output = \"\"\n if (input.stdout) {\n output += stdout\n }\n if (input.stderr) {\n output += stderr\n }\n if (!output.trim()) {\n output = \"Command executed successfully, but produced no output.\"\n }\n return { output }\n}\n\nexport function registerExec(server: McpServer) {\n server.registerTool(\n \"exec\",\n {\n title: \"Execute Command\",\n description: dedent`\n Command executor for running system commands and scripts.\n\n Use cases:\n - Running system tasks or scripts\n - Automating command-line tools or utilities\n - Executing build commands or test runners\n\n How it works:\n - Executes the specified command with arguments\n - Captures stdout and/or stderr based on flags\n - Returns command output or error information\n\n Parameters:\n - command: The command to execute (e.g., ls, python)\n - args: Arguments to pass to the command\n - env: Environment variables for the execution\n - cwd: Working directory for command execution\n - stdout: Whether to capture standard output\n - stderr: Whether to capture standard error\n - timeout: Timeout in milliseconds (optional)\n\n Rules:\n - Only execute commands from trusted sources\n - Do not execute long-running foreground commands (e.g., tail -f)\n - Be cautious with resource-intensive commands\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await exec(input))\n } catch (error: unknown) {\n const execError = error as {\n message?: string\n stdout?: string\n stderr?: string\n killed?: boolean\n signal?: string\n }\n let message = \"\"\n if (\n execError &&\n (execError.killed || execError.signal === \"SIGTERM\") &&\n typeof input.timeout === \"number\"\n ) {\n message = `Command timed out after ${input.timeout}ms.`\n } else if (error instanceof Error) {\n if (error.message.includes(\"timeout\")) {\n message = `Command timed out after ${input.timeout}ms.`\n } else {\n message = error.message\n }\n } else {\n message = \"An unknown error occurred.\"\n }\n const result: { error: string; stdout?: string; stderr?: string } = { error: message }\n if (execError.stdout && input.stdout) {\n result.stdout = execError.stdout\n }\n if (execError.stderr && input.stderr) {\n result.stderr = execError.stderr\n }\n return { content: [{ type: \"text\", text: JSON.stringify(result) }] }\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { basename, dirname, extname, resolve } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function getFileInfo(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`File or directory ${path} does not exist`)\n }\n const stats = statSync(validatedPath)\n const isDirectory = stats.isDirectory()\n const mimeType = isDirectory ? null : mime.lookup(validatedPath) || \"application/octet-stream\"\n const formatSize = (bytes: number): string => {\n if (bytes === 0) return \"0 B\"\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"]\n const i = Math.floor(Math.log(bytes) / Math.log(1024))\n return `${(bytes / 1024 ** i).toFixed(2)} ${units[i]}`\n }\n return {\n exists: true,\n path: validatedPath,\n absolutePath: resolve(validatedPath),\n name: basename(validatedPath),\n directory: dirname(validatedPath),\n extension: isDirectory ? null : extname(validatedPath),\n type: isDirectory ? \"directory\" : \"file\",\n mimeType,\n size: stats.size,\n sizeFormatted: formatSize(stats.size),\n created: stats.birthtime.toISOString(),\n modified: stats.mtime.toISOString(),\n accessed: stats.atime.toISOString(),\n permissions: {\n readable: true,\n writable: Boolean(stats.mode & 0o200),\n executable: Boolean(stats.mode & 0o100),\n },\n }\n}\n\nexport function registerGetFileInfo(server: McpServer) {\n server.registerTool(\n \"getFileInfo\",\n {\n title: \"Get file info\",\n description: dedent`\n File information retriever for detailed metadata about files and directories.\n\n Use cases:\n - Checking file existence and type\n - Getting file size and timestamps\n - Determining MIME types\n - Validating file accessibility\n\n How it works:\n - Retrieves comprehensive file system metadata\n - Detects MIME type from file extension\n - Provides both absolute and relative paths\n - Returns human-readable file sizes\n \n Parameters:\n - path: File or directory path to inspect\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await getFileInfo(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { readdir } from \"node:fs/promises\"\nimport { join } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\ninterface DirectoryItem {\n name: string\n path: string\n type: \"directory\" | \"file\"\n size: number\n modified: string\n}\n\nexport async function listDirectory(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n if (!existsSync(validatedPath)) {\n throw new Error(`Directory ${path} does not exist.`)\n }\n const stats = statSync(validatedPath)\n if (!stats.isDirectory()) {\n throw new Error(`Path ${path} is not a directory.`)\n }\n const entries = await readdir(validatedPath)\n const items: DirectoryItem[] = []\n for (const entry of entries.sort()) {\n try {\n const fullPath = await validatePath(join(validatedPath, entry))\n const entryStats = statSync(fullPath)\n const item: DirectoryItem = {\n name: entry,\n path: entry,\n type: entryStats.isDirectory() ? \"directory\" : \"file\",\n size: entryStats.size,\n modified: entryStats.mtime.toISOString(),\n }\n items.push(item)\n } catch (e) {\n if (e instanceof Error && e.message.includes(\"perstack directory is not allowed\")) {\n continue\n }\n throw e\n }\n }\n return {\n path: validatedPath,\n items,\n }\n}\n\nexport function registerListDirectory(server: McpServer) {\n server.registerTool(\n \"listDirectory\",\n {\n title: \"List directory\",\n description: dedent`\n Directory content lister with detailed file information.\n\n Use cases:\n - Exploring project structure\n - Finding files in a directory\n - Checking directory contents before operations\n - Understanding file organization\n\n How it works:\n - Lists all files and subdirectories in specified directory only\n - Provides file type, size, and modification time\n - Sorts entries alphabetically\n - Handles empty directories\n \n Parameters:\n - path: Directory path to list (optional, defaults to workspace root)\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await listDirectory(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, rename } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n source: z.string(),\n destination: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function moveFile(input: InputSchema) {\n const { source, destination } = input\n const validatedSource = await validatePath(source)\n const validatedDestination = await validatePath(destination)\n if (!existsSync(validatedSource)) {\n throw new Error(`Source file ${source} does not exist.`)\n }\n const sourceStats = statSync(validatedSource)\n if (!(sourceStats.mode & 0o200)) {\n throw new Error(`Source file ${source} is not writable`)\n }\n if (existsSync(validatedDestination)) {\n throw new Error(`Destination ${destination} already exists.`)\n }\n const destDir = dirname(validatedDestination)\n await mkdir(destDir, { recursive: true })\n await rename(validatedSource, validatedDestination)\n return {\n source: validatedSource,\n destination: validatedDestination,\n }\n}\n\nexport function registerMoveFile(server: McpServer) {\n server.registerTool(\n \"moveFile\",\n {\n title: \"Move file\",\n description: dedent`\n File mover for relocating or renaming files within the workspace.\n\n Use cases:\n - Renaming files to follow naming conventions\n - Moving files to different directories\n - Organizing project structure\n - Backing up files before modifications\n\n How it works:\n - Validates source file existence\n - Creates destination directory if needed\n - Performs atomic move operation\n - Preserves file permissions and timestamps\n \n Parameters:\n - source: Current file path\n - destination: Target file path\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await moveFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst MAX_IMAGE_SIZE = 15 * 1024 * 1024\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function readImageFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (!mimeType || ![\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\"].includes(mimeType)) {\n throw new Error(`File ${path} is not supported.`)\n }\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_IMAGE_SIZE) {\n throw new Error(\n `Image file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_IMAGE_SIZE / (1024 * 1024)}MB. Please use a smaller image file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n\nexport function registerReadImageFile(server: McpServer) {\n server.registerTool(\n \"readImageFile\",\n {\n title: \"Read image file\",\n description: dedent`\n Image file reader that converts images to base64 encoded strings with MIME type validation.\n\n Use cases:\n - Loading images for LLM to process\n - Retrieving image data for analysis or display\n - Converting workspace image files to base64 format\n\n How it works:\n - Validates file existence and MIME type before reading\n - Encodes file content as base64 string\n - Returns image data with correct MIME type for proper handling\n - Rejects unsupported formats with clear error messages\n\n Supported formats:\n - PNG (image/png)\n - JPEG/JPG (image/jpeg)\n - GIF (image/gif) - static only, animated not supported\n - WebP (image/webp)\n \n Notes:\n - Maximum file size: 15MB (larger files will be rejected)\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await readImageFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { stat } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport mime from \"mime-types\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst MAX_PDF_SIZE = 30 * 1024 * 1024\nconst inputSchema = z.object({\n path: z.string(),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function readPdfFile(input: InputSchema) {\n const { path } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const mimeType = mime.lookup(validatedPath)\n if (mimeType !== \"application/pdf\") {\n throw new Error(`File ${path} is not a PDF file.`)\n }\n const fileStats = await stat(validatedPath)\n const fileSizeMB = fileStats.size / (1024 * 1024)\n if (fileStats.size > MAX_PDF_SIZE) {\n throw new Error(\n `PDF file too large (${fileSizeMB.toFixed(1)}MB). Maximum supported size is ${MAX_PDF_SIZE / (1024 * 1024)}MB. Please use a smaller PDF file.`,\n )\n }\n return {\n path: validatedPath,\n mimeType,\n size: fileStats.size,\n }\n}\n\nexport function registerReadPdfFile(server: McpServer) {\n server.registerTool(\n \"readPdfFile\",\n {\n title: \"Read PDF file\",\n description: dedent`\n PDF file reader that converts documents to base64 encoded resources.\n\n Use cases:\n - Extracting content from PDF documents for analysis\n - Loading PDF files for LLM processing\n - Retrieving PDF data for conversion or manipulation\n\n How it works:\n - Validates file existence and MIME type (application/pdf)\n - Encodes PDF content as base64 blob\n - Returns as resource type with proper MIME type and URI\n - Rejects non-PDF files with clear error messages\n\n Notes:\n - Returns entire PDF content, no page range support\n - Maximum file size: 30MB (larger files will be rejected)\n - Text extraction not performed, returns raw PDF data\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await readPdfFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync } from \"node:fs\"\nimport { readFile } from \"node:fs/promises\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string(),\n from: z.number().optional().describe(\"The line number to start reading from.\"),\n to: z.number().optional().describe(\"The line number to stop reading at.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function readTextFile(input: InputSchema) {\n const { path, from, to } = input\n const validatedPath = await validatePath(path)\n const isFile = existsSync(validatedPath)\n if (!isFile) {\n throw new Error(`File ${path} does not exist.`)\n }\n const fileContent = await readFile(validatedPath, \"utf-8\")\n const lines = fileContent.split(\"\\n\")\n const fromLine = from ?? 0\n const toLine = to ?? lines.length\n const selectedLines = lines.slice(fromLine, toLine)\n const content = selectedLines.join(\"\\n\")\n return {\n path,\n content,\n from: fromLine,\n to: toLine,\n }\n}\n\nexport function registerReadTextFile(server: McpServer) {\n server.registerTool(\n \"readTextFile\",\n {\n title: \"Read text file\",\n description: dedent`\n Text file reader with line range support for UTF-8 encoded files.\n\n Use cases:\n - Reading source code files for analysis\n - Extracting specific sections from large text files\n - Loading configuration or documentation files\n - Viewing log files or data files\n\n How it works:\n - Reads files as UTF-8 encoded text without format validation\n - Supports partial file reading via line number ranges\n - Returns content wrapped in JSON with metadata\n - WARNING: Binary files will cause errors or corrupted output\n\n Common file types:\n - Source code: .ts, .js, .py, .java, .cpp, etc.\n - Documentation: .md, .txt, .rst\n - Configuration: .json, .yaml, .toml, .ini\n - Data files: .csv, .log, .sql\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await readTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n thought: z.string().describe(\"Your current thinking step\"),\n nextThoughtNeeded: z\n .boolean()\n .optional()\n .describe(\"true if you need more thinking, even if at what seemed like the end\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nclass Thought {\n thoughtHistory: InputSchema[] = []\n public processThought(input: InputSchema) {\n const { nextThoughtNeeded } = input\n this.thoughtHistory.push(input)\n return {\n nextThoughtNeeded,\n thoughtHistoryLength: this.thoughtHistory.length,\n }\n }\n}\n// Singleton instance: MCP server runs as a subprocess per Expert session,\n// so process-level state is effectively session-scoped.\nconst thought = new Thought()\n\nexport async function think(input: InputSchema) {\n return thought.processThought(input)\n}\n\nexport function registerThink(server: McpServer) {\n server.registerTool(\n \"think\",\n {\n title: \"think\",\n description: dedent`\n Sequential thinking tool for step-by-step problem analysis and solution development.\n\n Use cases:\n - Breaking down complex problems into manageable steps\n - Developing solutions through iterative reasoning\n - Analyzing problems that require multiple perspectives\n - Planning tasks with dependencies and considerations\n\n How it works:\n - Records each thinking step sequentially\n - Maintains thought history for context\n - Continues until solution is reached\n - Returns thought count and continuation status\n\n Parameters:\n - thought: Current reasoning step or analysis\n - nextThoughtNeeded: Whether additional thinking is required (optional)\n\n Best practices:\n - Use multiple calls for sophisticated reasoning chains\n - Progress from high-level overview to detailed analysis (drill-down approach)\n - Capture insights and eureka moments as they emerge\n - Engage in reflective introspection and constructive self-critique\n - Set nextThoughtNeeded to false only when fully satisfied with the solution\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await think(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst todoInputSchema = z.object({\n newTodos: z.array(z.string()).describe(\"New todos to add\").optional(),\n completedTodos: z.array(z.number()).describe(\"Todo ids that are completed\").optional(),\n})\ntype TodoInputSchema = z.infer<typeof todoInputSchema>\n\nconst clearTodoInputSchema = z.object({})\ntype ClearTodoInputSchema = z.infer<typeof clearTodoInputSchema>\n\nclass Todo {\n currentTodoId = 0\n todos: { id: number; title: string; completed: boolean }[] = []\n public processTodo(input: TodoInputSchema) {\n const { newTodos, completedTodos } = input\n if (newTodos) {\n this.todos.push(\n ...newTodos.map((title) => ({ id: this.currentTodoId++, title, completed: false })),\n )\n }\n if (completedTodos) {\n this.todos = this.todos.map((todo) => ({\n ...todo,\n completed: todo.completed || completedTodos.includes(todo.id),\n }))\n }\n return {\n todos: this.todos,\n }\n }\n public clearTodo() {\n this.todos = []\n this.currentTodoId = 0\n return {\n todos: this.todos,\n }\n }\n}\n// Singleton instance: MCP server runs as a subprocess per Expert session,\n// so process-level state is effectively session-scoped.\nconst todoSingleton = new Todo()\n\nexport async function todo(input: TodoInputSchema) {\n return todoSingleton.processTodo(input)\n}\n\nexport async function clearTodo(_input: ClearTodoInputSchema) {\n return todoSingleton.clearTodo()\n}\n\nexport function registerTodo(server: McpServer) {\n server.registerTool(\n \"todo\",\n {\n title: \"todo\",\n description: dedent`\n Todo list manager that tracks tasks and their completion status.\n\n Use cases:\n - Creating new tasks or action items\n - Marking tasks as completed\n - Viewing current task list and status\n\n How it works:\n - Each todo gets a unique ID when created\n - Returns the full todo list after every operation\n - Maintains state across multiple calls\n\n Parameters:\n - newTodos: Array of task descriptions to add\n - completedTodos: Array of todo IDs to mark as completed\n `,\n inputSchema: todoInputSchema.shape,\n },\n async (input: TodoInputSchema) => {\n try {\n return successToolResult(await todo(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n\nexport function registerClearTodo(server: McpServer) {\n server.registerTool(\n \"clearTodo\",\n {\n title: \"clearTodo\",\n description: dedent`\n Clears the todo list.\n\n Use cases:\n - Resetting the todo list to an empty state\n - Starting fresh with a new task list\n - Clearing all tasks for a new day or project\n\n How it works:\n - Resets the todo list to an empty state\n - Returns an empty todo list\n `,\n inputSchema: clearTodoInputSchema.shape,\n },\n async (input: ClearTodoInputSchema) => {\n try {\n return successToolResult(await clearTodo(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n","import { existsSync, statSync } from \"node:fs\"\nimport { mkdir, writeFile } from \"node:fs/promises\"\nimport { dirname } from \"node:path\"\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { dedent } from \"ts-dedent\"\nimport { z } from \"zod\"\nimport { validatePath } from \"../lib/path.js\"\nimport { errorToolResult, successToolResult } from \"../lib/tool-result.js\"\n\nconst inputSchema = z.object({\n path: z.string().describe(\"Target file path (relative or absolute).\"),\n text: z.string().max(10_000).describe(\"Text to write to the file. Max 10000 characters.\"),\n})\ntype InputSchema = z.infer<typeof inputSchema>\n\nexport async function writeTextFile(input: InputSchema) {\n const { path, text } = input\n const validatedPath = await validatePath(path)\n if (existsSync(validatedPath)) {\n const stats = statSync(validatedPath)\n if (!(stats.mode & 0o200)) {\n throw new Error(`File ${path} is not writable`)\n }\n }\n const dir = dirname(validatedPath)\n await mkdir(dir, { recursive: true })\n await writeFile(validatedPath, text, \"utf-8\")\n return {\n path: validatedPath,\n text,\n }\n}\n\nexport function registerWriteTextFile(server: McpServer) {\n server.registerTool(\n \"writeTextFile\",\n {\n title: \"writeTextFile\",\n description: dedent`\n Text file writer that creates or overwrites files with UTF-8 content.\n\n Use cases:\n - Creating new configuration files\n - Writing generated code or documentation\n - Saving processed data or results\n - Creating log files or reports\n\n How it works:\n - Writes content as UTF-8 encoded text\n - Returns success status with file path\n\n Rules:\n - IF THE FILE ALREADY EXISTS, IT WILL BE OVERWRITTEN\n - YOU MUST PROVIDE A VALID UTF-8 STRING FOR THE TEXT\n - THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT WRITE ALL THE CONTENT AT ONCE (IT WILL CAUSE AN ERROR)\n - IF YOU WANT TO WRITE MORE THAN 10,000 CHARACTERS, USE \"appendTextFile\" TOOL AFTER THIS ONE\n `,\n inputSchema: inputSchema.shape,\n },\n async (input: InputSchema) => {\n try {\n return successToolResult(await writeTextFile(input))\n } catch (e) {\n if (e instanceof Error) return errorToolResult(e)\n throw e\n }\n },\n )\n}\n"]}
|