@perstack/base 0.0.24 → 0.0.26
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-GEO3LZFE.js → chunk-2DL5RINQ.js} +75 -93
- package/dist/chunk-2DL5RINQ.js.map +1 -0
- package/dist/src/index.d.ts +64 -98
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GEO3LZFE.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.26",
|
|
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,CA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","sourcesContent":["{\n \"name\": \"@perstack/base\",\n \"version\": \"0.0.26\",\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,12 +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
|
-
path: z.string().describe("Target file path to append to."),
|
|
61
|
-
text: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters.")
|
|
62
|
-
});
|
|
63
|
-
async function appendTextFile(input) {
|
|
64
|
-
const { path: path2, text } = input;
|
|
59
|
+
async function appendTextFile({ path: path2, text }) {
|
|
65
60
|
const validatedPath = await validatePath(path2);
|
|
66
61
|
if (!existsSync(validatedPath)) {
|
|
67
62
|
throw new Error(`File ${path2} does not exist.`);
|
|
@@ -100,11 +95,14 @@ function registerAppendTextFile(server) {
|
|
|
100
95
|
- THERE IS A LIMIT ON THE NUMBER OF TOKENS THAT CAN BE GENERATED, SO DO NOT APPEND ALL THE CONTENT AT ONCE
|
|
101
96
|
- IF YOU WANT TO APPEND MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES
|
|
102
97
|
`,
|
|
103
|
-
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
|
+
}
|
|
104
102
|
},
|
|
105
|
-
async (
|
|
103
|
+
async ({ path: path2, text }) => {
|
|
106
104
|
try {
|
|
107
|
-
return successToolResult(await appendTextFile(
|
|
105
|
+
return successToolResult(await appendTextFile({ path: path2, text }));
|
|
108
106
|
} catch (e) {
|
|
109
107
|
if (e instanceof Error) return errorToolResult(e);
|
|
110
108
|
throw e;
|
|
@@ -112,8 +110,7 @@ function registerAppendTextFile(server) {
|
|
|
112
110
|
}
|
|
113
111
|
);
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
async function attemptCompletion(_input) {
|
|
113
|
+
async function attemptCompletion() {
|
|
117
114
|
return {
|
|
118
115
|
message: "End the agent loop and provide a final report"
|
|
119
116
|
};
|
|
@@ -139,11 +136,11 @@ function registerAttemptCompletion(server) {
|
|
|
139
136
|
- Should only be used when task is fully complete
|
|
140
137
|
- Cannot be reverted once called
|
|
141
138
|
`,
|
|
142
|
-
inputSchema:
|
|
139
|
+
inputSchema: {}
|
|
143
140
|
},
|
|
144
|
-
async (
|
|
141
|
+
async () => {
|
|
145
142
|
try {
|
|
146
|
-
return successToolResult(await attemptCompletion(
|
|
143
|
+
return successToolResult(await attemptCompletion());
|
|
147
144
|
} catch (e) {
|
|
148
145
|
if (e instanceof Error) return errorToolResult(e);
|
|
149
146
|
throw e;
|
|
@@ -151,9 +148,6 @@ function registerAttemptCompletion(server) {
|
|
|
151
148
|
}
|
|
152
149
|
);
|
|
153
150
|
}
|
|
154
|
-
var inputSchema3 = z.object({
|
|
155
|
-
path: z.string()
|
|
156
|
-
});
|
|
157
151
|
async function createDirectory(input) {
|
|
158
152
|
const { path: path2 } = input;
|
|
159
153
|
const validatedPath = await validatePath(path2);
|
|
@@ -196,7 +190,9 @@ function registerCreateDirectory(server) {
|
|
|
196
190
|
Parameters:
|
|
197
191
|
- path: Directory path to create
|
|
198
192
|
`,
|
|
199
|
-
inputSchema:
|
|
193
|
+
inputSchema: {
|
|
194
|
+
path: z.string()
|
|
195
|
+
}
|
|
200
196
|
},
|
|
201
197
|
async (input) => {
|
|
202
198
|
try {
|
|
@@ -208,10 +204,6 @@ function registerCreateDirectory(server) {
|
|
|
208
204
|
}
|
|
209
205
|
);
|
|
210
206
|
}
|
|
211
|
-
var inputSchema4 = z.object({
|
|
212
|
-
path: z.string(),
|
|
213
|
-
recursive: z.boolean().optional().describe("Whether to delete contents recursively. Required for non-empty directories.")
|
|
214
|
-
});
|
|
215
207
|
async function deleteDirectory(input) {
|
|
216
208
|
const { path: path2, recursive } = input;
|
|
217
209
|
const validatedPath = await validatePath(path2);
|
|
@@ -256,7 +248,10 @@ function registerDeleteDirectory(server) {
|
|
|
256
248
|
- path: Directory path to delete
|
|
257
249
|
- recursive: Set to true to delete non-empty directories
|
|
258
250
|
`,
|
|
259
|
-
inputSchema:
|
|
251
|
+
inputSchema: {
|
|
252
|
+
path: z.string(),
|
|
253
|
+
recursive: z.boolean().optional().describe("Whether to delete contents recursively. Required for non-empty directories.")
|
|
254
|
+
}
|
|
260
255
|
},
|
|
261
256
|
async (input) => {
|
|
262
257
|
try {
|
|
@@ -268,9 +263,6 @@ function registerDeleteDirectory(server) {
|
|
|
268
263
|
}
|
|
269
264
|
);
|
|
270
265
|
}
|
|
271
|
-
var inputSchema5 = z.object({
|
|
272
|
-
path: z.string()
|
|
273
|
-
});
|
|
274
266
|
async function deleteFile(input) {
|
|
275
267
|
const { path: path2 } = input;
|
|
276
268
|
const validatedPath = await validatePath(path2);
|
|
@@ -311,7 +303,9 @@ function registerDeleteFile(server) {
|
|
|
311
303
|
Parameters:
|
|
312
304
|
- path: File path to delete
|
|
313
305
|
`,
|
|
314
|
-
inputSchema:
|
|
306
|
+
inputSchema: {
|
|
307
|
+
path: z.string()
|
|
308
|
+
}
|
|
315
309
|
},
|
|
316
310
|
async (input) => {
|
|
317
311
|
try {
|
|
@@ -323,11 +317,6 @@ function registerDeleteFile(server) {
|
|
|
323
317
|
}
|
|
324
318
|
);
|
|
325
319
|
}
|
|
326
|
-
var inputSchema6 = z.object({
|
|
327
|
-
path: z.string().describe("Target file path to edit."),
|
|
328
|
-
newText: z.string().min(1).max(2e3).describe("Text to append to the file. Max 2000 characters."),
|
|
329
|
-
oldText: z.string().min(1).max(2e3).describe("Exact text to find and replace. Max 2000 characters.")
|
|
330
|
-
});
|
|
331
320
|
async function editTextFile(input) {
|
|
332
321
|
const { path: path2, newText, oldText } = input;
|
|
333
322
|
const validatedPath = await validatePath(path2);
|
|
@@ -385,7 +374,11 @@ function registerEditTextFile(server) {
|
|
|
385
374
|
- IF YOU WANT TO EDIT MORE THAN 2000 CHARACTERS, USE THIS TOOL MULTIPLE TIMES
|
|
386
375
|
- DO NOT USE THIS TOOL FOR APPENDING TEXT TO FILES - USE appendTextFile TOOL INSTEAD
|
|
387
376
|
`,
|
|
388
|
-
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
|
+
}
|
|
389
382
|
},
|
|
390
383
|
async (input) => {
|
|
391
384
|
try {
|
|
@@ -398,15 +391,6 @@ function registerEditTextFile(server) {
|
|
|
398
391
|
);
|
|
399
392
|
}
|
|
400
393
|
var execFileAsync = promisify(execFile);
|
|
401
|
-
var inputSchema7 = z.object({
|
|
402
|
-
command: z.string().describe("The command to execute"),
|
|
403
|
-
args: z.array(z.string()).describe("The arguments to pass to the command"),
|
|
404
|
-
env: z.record(z.string(), z.string()).describe("The environment variables to set"),
|
|
405
|
-
cwd: z.string().describe("The working directory to execute the command in"),
|
|
406
|
-
stdout: z.boolean().describe("Whether to capture the standard output"),
|
|
407
|
-
stderr: z.boolean().describe("Whether to capture the standard error"),
|
|
408
|
-
timeout: z.number().optional().describe("Timeout in milliseconds")
|
|
409
|
-
});
|
|
410
394
|
async function exec(input) {
|
|
411
395
|
const validatedCwd = await validatePath(input.cwd);
|
|
412
396
|
const { stdout, stderr } = await execFileAsync(input.command, input.args, {
|
|
@@ -458,7 +442,15 @@ function registerExec(server) {
|
|
|
458
442
|
- Do not execute long-running foreground commands (e.g., tail -f)
|
|
459
443
|
- Be cautious with resource-intensive commands
|
|
460
444
|
`,
|
|
461
|
-
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
|
+
}
|
|
462
454
|
},
|
|
463
455
|
async (input) => {
|
|
464
456
|
try {
|
|
@@ -489,9 +481,6 @@ function registerExec(server) {
|
|
|
489
481
|
}
|
|
490
482
|
);
|
|
491
483
|
}
|
|
492
|
-
var inputSchema8 = z.object({
|
|
493
|
-
path: z.string()
|
|
494
|
-
});
|
|
495
484
|
async function getFileInfo(input) {
|
|
496
485
|
const { path: path2 } = input;
|
|
497
486
|
const validatedPath = await validatePath(path2);
|
|
@@ -551,7 +540,9 @@ function registerGetFileInfo(server) {
|
|
|
551
540
|
Parameters:
|
|
552
541
|
- path: File or directory path to inspect
|
|
553
542
|
`,
|
|
554
|
-
inputSchema:
|
|
543
|
+
inputSchema: {
|
|
544
|
+
path: z.string()
|
|
545
|
+
}
|
|
555
546
|
},
|
|
556
547
|
async (input) => {
|
|
557
548
|
try {
|
|
@@ -563,9 +554,6 @@ function registerGetFileInfo(server) {
|
|
|
563
554
|
}
|
|
564
555
|
);
|
|
565
556
|
}
|
|
566
|
-
var inputSchema9 = z.object({
|
|
567
|
-
path: z.string()
|
|
568
|
-
});
|
|
569
557
|
async function listDirectory(input) {
|
|
570
558
|
const { path: path2 } = input;
|
|
571
559
|
const validatedPath = await validatePath(path2);
|
|
@@ -625,7 +613,9 @@ function registerListDirectory(server) {
|
|
|
625
613
|
Parameters:
|
|
626
614
|
- path: Directory path to list (optional, defaults to workspace root)
|
|
627
615
|
`,
|
|
628
|
-
inputSchema:
|
|
616
|
+
inputSchema: {
|
|
617
|
+
path: z.string()
|
|
618
|
+
}
|
|
629
619
|
},
|
|
630
620
|
async (input) => {
|
|
631
621
|
try {
|
|
@@ -637,10 +627,6 @@ function registerListDirectory(server) {
|
|
|
637
627
|
}
|
|
638
628
|
);
|
|
639
629
|
}
|
|
640
|
-
var inputSchema10 = z.object({
|
|
641
|
-
source: z.string(),
|
|
642
|
-
destination: z.string()
|
|
643
|
-
});
|
|
644
630
|
async function moveFile(input) {
|
|
645
631
|
const { source, destination } = input;
|
|
646
632
|
const validatedSource = await validatePath(source);
|
|
@@ -687,7 +673,10 @@ function registerMoveFile(server) {
|
|
|
687
673
|
- source: Current file path
|
|
688
674
|
- destination: Target file path
|
|
689
675
|
`,
|
|
690
|
-
inputSchema:
|
|
676
|
+
inputSchema: {
|
|
677
|
+
source: z.string(),
|
|
678
|
+
destination: z.string()
|
|
679
|
+
}
|
|
691
680
|
},
|
|
692
681
|
async (input) => {
|
|
693
682
|
try {
|
|
@@ -700,9 +689,6 @@ function registerMoveFile(server) {
|
|
|
700
689
|
);
|
|
701
690
|
}
|
|
702
691
|
var MAX_IMAGE_SIZE = 15 * 1024 * 1024;
|
|
703
|
-
var inputSchema11 = z.object({
|
|
704
|
-
path: z.string()
|
|
705
|
-
});
|
|
706
692
|
async function readImageFile(input) {
|
|
707
693
|
const { path: path2 } = input;
|
|
708
694
|
const validatedPath = await validatePath(path2);
|
|
@@ -755,7 +741,9 @@ function registerReadImageFile(server) {
|
|
|
755
741
|
Notes:
|
|
756
742
|
- Maximum file size: 15MB (larger files will be rejected)
|
|
757
743
|
`,
|
|
758
|
-
inputSchema:
|
|
744
|
+
inputSchema: {
|
|
745
|
+
path: z.string()
|
|
746
|
+
}
|
|
759
747
|
},
|
|
760
748
|
async (input) => {
|
|
761
749
|
try {
|
|
@@ -768,9 +756,6 @@ function registerReadImageFile(server) {
|
|
|
768
756
|
);
|
|
769
757
|
}
|
|
770
758
|
var MAX_PDF_SIZE = 30 * 1024 * 1024;
|
|
771
|
-
var inputSchema12 = z.object({
|
|
772
|
-
path: z.string()
|
|
773
|
-
});
|
|
774
759
|
async function readPdfFile(input) {
|
|
775
760
|
const { path: path2 } = input;
|
|
776
761
|
const validatedPath = await validatePath(path2);
|
|
@@ -819,7 +804,9 @@ function registerReadPdfFile(server) {
|
|
|
819
804
|
- Maximum file size: 30MB (larger files will be rejected)
|
|
820
805
|
- Text extraction not performed, returns raw PDF data
|
|
821
806
|
`,
|
|
822
|
-
inputSchema:
|
|
807
|
+
inputSchema: {
|
|
808
|
+
path: z.string()
|
|
809
|
+
}
|
|
823
810
|
},
|
|
824
811
|
async (input) => {
|
|
825
812
|
try {
|
|
@@ -831,11 +818,6 @@ function registerReadPdfFile(server) {
|
|
|
831
818
|
}
|
|
832
819
|
);
|
|
833
820
|
}
|
|
834
|
-
var inputSchema13 = z.object({
|
|
835
|
-
path: z.string(),
|
|
836
|
-
from: z.number().optional().describe("The line number to start reading from."),
|
|
837
|
-
to: z.number().optional().describe("The line number to stop reading at.")
|
|
838
|
-
});
|
|
839
821
|
async function readTextFile(input) {
|
|
840
822
|
const { path: path2, from, to } = input;
|
|
841
823
|
const validatedPath = await validatePath(path2);
|
|
@@ -882,7 +864,11 @@ function registerReadTextFile(server) {
|
|
|
882
864
|
- Configuration: .json, .yaml, .toml, .ini
|
|
883
865
|
- Data files: .csv, .log, .sql
|
|
884
866
|
`,
|
|
885
|
-
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
|
+
}
|
|
886
872
|
},
|
|
887
873
|
async (input) => {
|
|
888
874
|
try {
|
|
@@ -894,10 +880,6 @@ function registerReadTextFile(server) {
|
|
|
894
880
|
}
|
|
895
881
|
);
|
|
896
882
|
}
|
|
897
|
-
var inputSchema14 = z.object({
|
|
898
|
-
thought: z.string().describe("Your current thinking step"),
|
|
899
|
-
nextThoughtNeeded: z.boolean().optional().describe("true if you need more thinking, even if at what seemed like the end")
|
|
900
|
-
});
|
|
901
883
|
var Thought = class {
|
|
902
884
|
thoughtHistory = [];
|
|
903
885
|
processThought(input) {
|
|
@@ -944,7 +926,10 @@ function registerThink(server) {
|
|
|
944
926
|
- Engage in reflective introspection and constructive self-critique
|
|
945
927
|
- Set nextThoughtNeeded to false only when fully satisfied with the solution
|
|
946
928
|
`,
|
|
947
|
-
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
|
+
}
|
|
948
933
|
},
|
|
949
934
|
async (input) => {
|
|
950
935
|
try {
|
|
@@ -956,11 +941,6 @@ function registerThink(server) {
|
|
|
956
941
|
}
|
|
957
942
|
);
|
|
958
943
|
}
|
|
959
|
-
var todoInputSchema = z.object({
|
|
960
|
-
newTodos: z.array(z.string()).describe("New todos to add").optional(),
|
|
961
|
-
completedTodos: z.array(z.number()).describe("Todo ids that are completed").optional()
|
|
962
|
-
});
|
|
963
|
-
var clearTodoInputSchema = z.object({});
|
|
964
944
|
var Todo = class {
|
|
965
945
|
currentTodoId = 0;
|
|
966
946
|
todos = [];
|
|
@@ -993,7 +973,7 @@ var todoSingleton = new Todo();
|
|
|
993
973
|
async function todo(input) {
|
|
994
974
|
return todoSingleton.processTodo(input);
|
|
995
975
|
}
|
|
996
|
-
async function clearTodo(
|
|
976
|
+
async function clearTodo() {
|
|
997
977
|
return todoSingleton.clearTodo();
|
|
998
978
|
}
|
|
999
979
|
function registerTodo(server) {
|
|
@@ -1018,7 +998,10 @@ function registerTodo(server) {
|
|
|
1018
998
|
- newTodos: Array of task descriptions to add
|
|
1019
999
|
- completedTodos: Array of todo IDs to mark as completed
|
|
1020
1000
|
`,
|
|
1021
|
-
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
|
+
}
|
|
1022
1005
|
},
|
|
1023
1006
|
async (input) => {
|
|
1024
1007
|
try {
|
|
@@ -1047,11 +1030,11 @@ function registerClearTodo(server) {
|
|
|
1047
1030
|
- Resets the todo list to an empty state
|
|
1048
1031
|
- Returns an empty todo list
|
|
1049
1032
|
`,
|
|
1050
|
-
inputSchema:
|
|
1033
|
+
inputSchema: {}
|
|
1051
1034
|
},
|
|
1052
|
-
async (
|
|
1035
|
+
async () => {
|
|
1053
1036
|
try {
|
|
1054
|
-
return successToolResult(await clearTodo(
|
|
1037
|
+
return successToolResult(await clearTodo());
|
|
1055
1038
|
} catch (e) {
|
|
1056
1039
|
if (e instanceof Error) return errorToolResult(e);
|
|
1057
1040
|
throw e;
|
|
@@ -1059,10 +1042,6 @@ function registerClearTodo(server) {
|
|
|
1059
1042
|
}
|
|
1060
1043
|
);
|
|
1061
1044
|
}
|
|
1062
|
-
var inputSchema15 = z.object({
|
|
1063
|
-
path: z.string().describe("Target file path (relative or absolute)."),
|
|
1064
|
-
text: z.string().max(1e4).describe("Text to write to the file. Max 10000 characters.")
|
|
1065
|
-
});
|
|
1066
1045
|
async function writeTextFile(input) {
|
|
1067
1046
|
const { path: path2, text } = input;
|
|
1068
1047
|
const validatedPath = await validatePath(path2);
|
|
@@ -1104,7 +1083,10 @@ function registerWriteTextFile(server) {
|
|
|
1104
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)
|
|
1105
1084
|
- IF YOU WANT TO WRITE MORE THAN 10,000 CHARACTERS, USE "appendTextFile" TOOL AFTER THIS ONE
|
|
1106
1085
|
`,
|
|
1107
|
-
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
|
+
}
|
|
1108
1090
|
},
|
|
1109
1091
|
async (input) => {
|
|
1110
1092
|
try {
|
|
@@ -1118,5 +1100,5 @@ function registerWriteTextFile(server) {
|
|
|
1118
1100
|
}
|
|
1119
1101
|
|
|
1120
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 };
|
|
1121
|
-
//# sourceMappingURL=chunk-
|
|
1122
|
-
//# sourceMappingURL=chunk-
|
|
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":["path","dedent","existsSync","statSync","z","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,EAA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,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,91 +1,75 @@
|
|
|
1
1
|
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
3
|
|
|
5
4
|
declare function validatePath(requestedPath: string): Promise<string>;
|
|
6
5
|
|
|
7
6
|
declare function successToolResult(result: unknown): CallToolResult;
|
|
8
7
|
declare function errorToolResult(e: Error): CallToolResult;
|
|
9
8
|
|
|
10
|
-
declare
|
|
11
|
-
path:
|
|
12
|
-
text:
|
|
13
|
-
}
|
|
14
|
-
type InputSchema$e = z.infer<typeof inputSchema$e>;
|
|
15
|
-
declare function appendTextFile(input: InputSchema$e): Promise<{
|
|
9
|
+
declare function appendTextFile({ path, text }: {
|
|
10
|
+
path: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}): Promise<{
|
|
16
13
|
path: string;
|
|
17
14
|
text: string;
|
|
18
15
|
}>;
|
|
19
16
|
declare function registerAppendTextFile(server: McpServer): void;
|
|
20
17
|
|
|
21
|
-
declare
|
|
22
|
-
type InputSchema$d = z.infer<typeof inputSchema$d>;
|
|
23
|
-
declare function attemptCompletion(_input: InputSchema$d): Promise<{
|
|
18
|
+
declare function attemptCompletion(): Promise<{
|
|
24
19
|
message: string;
|
|
25
20
|
}>;
|
|
26
21
|
declare function registerAttemptCompletion(server: McpServer): void;
|
|
27
22
|
|
|
28
|
-
declare
|
|
29
|
-
path:
|
|
30
|
-
}
|
|
31
|
-
type InputSchema$c = z.infer<typeof inputSchema$c>;
|
|
32
|
-
declare function createDirectory(input: InputSchema$c): Promise<{
|
|
23
|
+
declare function createDirectory(input: {
|
|
24
|
+
path: string;
|
|
25
|
+
}): Promise<{
|
|
33
26
|
path: string;
|
|
34
27
|
}>;
|
|
35
28
|
declare function registerCreateDirectory(server: McpServer): void;
|
|
36
29
|
|
|
37
|
-
declare
|
|
38
|
-
path:
|
|
39
|
-
recursive
|
|
40
|
-
}
|
|
41
|
-
type InputSchema$b = z.infer<typeof inputSchema$b>;
|
|
42
|
-
declare function deleteDirectory(input: InputSchema$b): Promise<{
|
|
30
|
+
declare function deleteDirectory(input: {
|
|
31
|
+
path: string;
|
|
32
|
+
recursive?: boolean;
|
|
33
|
+
}): Promise<{
|
|
43
34
|
path: string;
|
|
44
35
|
}>;
|
|
45
36
|
declare function registerDeleteDirectory(server: McpServer): void;
|
|
46
37
|
|
|
47
|
-
declare
|
|
48
|
-
path:
|
|
49
|
-
}
|
|
50
|
-
type InputSchema$a = z.infer<typeof inputSchema$a>;
|
|
51
|
-
declare function deleteFile(input: InputSchema$a): Promise<{
|
|
38
|
+
declare function deleteFile(input: {
|
|
39
|
+
path: string;
|
|
40
|
+
}): Promise<{
|
|
52
41
|
path: string;
|
|
53
42
|
}>;
|
|
54
43
|
declare function registerDeleteFile(server: McpServer): void;
|
|
55
44
|
|
|
56
|
-
declare
|
|
57
|
-
path:
|
|
58
|
-
newText:
|
|
59
|
-
oldText:
|
|
60
|
-
}
|
|
61
|
-
type InputSchema$9 = z.infer<typeof inputSchema$9>;
|
|
62
|
-
declare function editTextFile(input: InputSchema$9): Promise<{
|
|
45
|
+
declare function editTextFile(input: {
|
|
46
|
+
path: string;
|
|
47
|
+
newText: string;
|
|
48
|
+
oldText: string;
|
|
49
|
+
}): Promise<{
|
|
63
50
|
path: string;
|
|
64
51
|
newText: string;
|
|
65
52
|
oldText: string;
|
|
66
53
|
}>;
|
|
67
54
|
declare function registerEditTextFile(server: McpServer): void;
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
command:
|
|
71
|
-
args:
|
|
72
|
-
env:
|
|
73
|
-
cwd:
|
|
74
|
-
stdout:
|
|
75
|
-
stderr:
|
|
76
|
-
timeout
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
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<{
|
|
80
66
|
output: string;
|
|
81
67
|
}>;
|
|
82
68
|
declare function registerExec(server: McpServer): void;
|
|
83
69
|
|
|
84
|
-
declare
|
|
85
|
-
path:
|
|
86
|
-
}
|
|
87
|
-
type InputSchema$7 = z.infer<typeof inputSchema$7>;
|
|
88
|
-
declare function getFileInfo(input: InputSchema$7): Promise<{
|
|
70
|
+
declare function getFileInfo(input: {
|
|
71
|
+
path: string;
|
|
72
|
+
}): Promise<{
|
|
89
73
|
exists: boolean;
|
|
90
74
|
path: string;
|
|
91
75
|
absolutePath: string;
|
|
@@ -107,10 +91,6 @@ declare function getFileInfo(input: InputSchema$7): Promise<{
|
|
|
107
91
|
}>;
|
|
108
92
|
declare function registerGetFileInfo(server: McpServer): void;
|
|
109
93
|
|
|
110
|
-
declare const inputSchema$6: z.ZodObject<{
|
|
111
|
-
path: z.ZodString;
|
|
112
|
-
}, z.core.$strip>;
|
|
113
|
-
type InputSchema$6 = z.infer<typeof inputSchema$6>;
|
|
114
94
|
interface DirectoryItem {
|
|
115
95
|
name: string;
|
|
116
96
|
path: string;
|
|
@@ -118,52 +98,46 @@ interface DirectoryItem {
|
|
|
118
98
|
size: number;
|
|
119
99
|
modified: string;
|
|
120
100
|
}
|
|
121
|
-
declare function listDirectory(input:
|
|
101
|
+
declare function listDirectory(input: {
|
|
102
|
+
path: string;
|
|
103
|
+
}): Promise<{
|
|
122
104
|
path: string;
|
|
123
105
|
items: DirectoryItem[];
|
|
124
106
|
}>;
|
|
125
107
|
declare function registerListDirectory(server: McpServer): void;
|
|
126
108
|
|
|
127
|
-
declare
|
|
128
|
-
source:
|
|
129
|
-
destination:
|
|
130
|
-
}
|
|
131
|
-
type InputSchema$5 = z.infer<typeof inputSchema$5>;
|
|
132
|
-
declare function moveFile(input: InputSchema$5): Promise<{
|
|
109
|
+
declare function moveFile(input: {
|
|
110
|
+
source: string;
|
|
111
|
+
destination: string;
|
|
112
|
+
}): Promise<{
|
|
133
113
|
source: string;
|
|
134
114
|
destination: string;
|
|
135
115
|
}>;
|
|
136
116
|
declare function registerMoveFile(server: McpServer): void;
|
|
137
117
|
|
|
138
|
-
declare
|
|
139
|
-
path:
|
|
140
|
-
}
|
|
141
|
-
type InputSchema$4 = z.infer<typeof inputSchema$4>;
|
|
142
|
-
declare function readImageFile(input: InputSchema$4): Promise<{
|
|
118
|
+
declare function readImageFile(input: {
|
|
119
|
+
path: string;
|
|
120
|
+
}): Promise<{
|
|
143
121
|
path: string;
|
|
144
122
|
mimeType: string;
|
|
145
123
|
size: number;
|
|
146
124
|
}>;
|
|
147
125
|
declare function registerReadImageFile(server: McpServer): void;
|
|
148
126
|
|
|
149
|
-
declare
|
|
150
|
-
path:
|
|
151
|
-
}
|
|
152
|
-
type InputSchema$3 = z.infer<typeof inputSchema$3>;
|
|
153
|
-
declare function readPdfFile(input: InputSchema$3): Promise<{
|
|
127
|
+
declare function readPdfFile(input: {
|
|
128
|
+
path: string;
|
|
129
|
+
}): Promise<{
|
|
154
130
|
path: string;
|
|
155
131
|
mimeType: string;
|
|
156
132
|
size: number;
|
|
157
133
|
}>;
|
|
158
134
|
declare function registerReadPdfFile(server: McpServer): void;
|
|
159
135
|
|
|
160
|
-
declare
|
|
161
|
-
path:
|
|
162
|
-
from
|
|
163
|
-
to
|
|
164
|
-
}
|
|
165
|
-
type InputSchema$2 = z.infer<typeof inputSchema$2>;
|
|
166
|
-
declare function readTextFile(input: InputSchema$2): Promise<{
|
|
136
|
+
declare function readTextFile(input: {
|
|
137
|
+
path: string;
|
|
138
|
+
from?: number;
|
|
139
|
+
to?: number;
|
|
140
|
+
}): Promise<{
|
|
167
141
|
path: string;
|
|
168
142
|
content: string;
|
|
169
143
|
from: number;
|
|
@@ -171,32 +145,26 @@ declare function readTextFile(input: InputSchema$2): Promise<{
|
|
|
171
145
|
}>;
|
|
172
146
|
declare function registerReadTextFile(server: McpServer): void;
|
|
173
147
|
|
|
174
|
-
declare
|
|
175
|
-
thought:
|
|
176
|
-
nextThoughtNeeded
|
|
177
|
-
}
|
|
178
|
-
type InputSchema$1 = z.infer<typeof inputSchema$1>;
|
|
179
|
-
declare function think(input: InputSchema$1): Promise<{
|
|
148
|
+
declare function think(input: {
|
|
149
|
+
thought: string;
|
|
150
|
+
nextThoughtNeeded?: boolean;
|
|
151
|
+
}): Promise<{
|
|
180
152
|
nextThoughtNeeded: boolean | undefined;
|
|
181
153
|
thoughtHistoryLength: number;
|
|
182
154
|
}>;
|
|
183
155
|
declare function registerThink(server: McpServer): void;
|
|
184
156
|
|
|
185
|
-
declare
|
|
186
|
-
newTodos
|
|
187
|
-
completedTodos
|
|
188
|
-
}
|
|
189
|
-
type TodoInputSchema = z.infer<typeof todoInputSchema>;
|
|
190
|
-
declare const clearTodoInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
191
|
-
type ClearTodoInputSchema = z.infer<typeof clearTodoInputSchema>;
|
|
192
|
-
declare function todo(input: TodoInputSchema): Promise<{
|
|
157
|
+
declare function todo(input: {
|
|
158
|
+
newTodos?: string[];
|
|
159
|
+
completedTodos?: number[];
|
|
160
|
+
}): Promise<{
|
|
193
161
|
todos: {
|
|
194
162
|
id: number;
|
|
195
163
|
title: string;
|
|
196
164
|
completed: boolean;
|
|
197
165
|
}[];
|
|
198
166
|
}>;
|
|
199
|
-
declare function clearTodo(
|
|
167
|
+
declare function clearTodo(): Promise<{
|
|
200
168
|
todos: {
|
|
201
169
|
id: number;
|
|
202
170
|
title: string;
|
|
@@ -206,12 +174,10 @@ declare function clearTodo(_input: ClearTodoInputSchema): Promise<{
|
|
|
206
174
|
declare function registerTodo(server: McpServer): void;
|
|
207
175
|
declare function registerClearTodo(server: McpServer): void;
|
|
208
176
|
|
|
209
|
-
declare
|
|
210
|
-
path:
|
|
211
|
-
text:
|
|
212
|
-
}
|
|
213
|
-
type InputSchema = z.infer<typeof inputSchema>;
|
|
214
|
-
declare function writeTextFile(input: InputSchema): Promise<{
|
|
177
|
+
declare function writeTextFile(input: {
|
|
178
|
+
path: string;
|
|
179
|
+
text: string;
|
|
180
|
+
}): Promise<{
|
|
215
181
|
path: string;
|
|
216
182
|
text: string;
|
|
217
183
|
}>;
|
package/dist/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
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,EAA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AA,EAAM,OAAO,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,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-GEO3LZFE.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"]}
|