@adeu/mcp-server 1.6.7 → 1.6.9

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/src/index.ts CHANGED
@@ -1,39 +1,60 @@
1
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
- import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
- import { readFileSync } from 'node:fs';
5
- import { basename, resolve, extname, dirname } from 'node:path';
6
- import {
7
- identifyEngine,
8
- extractTextFromBuffer,
9
- DocumentObject,
10
- RedlineEngine,
11
- BatchValidationError
12
- } from '@adeu/core';
13
- import {
14
- build_paginated_response,
15
- build_outline_response,
16
- build_appendix_response
17
- } from './response-builders.js';
18
-
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import {
4
+ CallToolRequestSchema,
5
+ ListToolsRequestSchema,
6
+ } from "@modelcontextprotocol/sdk/types.js";
7
+ import { readFileSync } from "node:fs";
8
+ import { basename, resolve, extname, dirname } from "node:path";
9
+ import {
10
+ identifyEngine,
11
+ extractTextFromBuffer,
12
+ DocumentObject,
13
+ RedlineEngine,
14
+ BatchValidationError,
15
+ create_word_patch_diff,
16
+ finalize_document,
17
+ } from "@adeu/core";
18
+ import {
19
+ build_paginated_response,
20
+ build_outline_response,
21
+ build_appendix_response,
22
+ } from "./response-builders.js";
23
+ function readFileBytesOrThrow(filePath: string): Buffer {
24
+ try {
25
+ return readFileSync(filePath);
26
+ } catch (err: any) {
27
+ if (err.code === "ENOENT") {
28
+ throw new Error(`File not found: ${filePath}`);
29
+ }
30
+ throw err;
31
+ }
32
+ }
19
33
  // --- Tool Description Constants (Parity with Python) ---
20
- const READ_DOCX_COMMON_DESC = "Reads a DOCX file. Returns text with inline CriticMarkup for Tracked Changes and Comments: {++inserted++}, {--deleted--}, {==highlighted==}{>>comment<<}. Set clean_view=True for the finalized 'Accepted' text without markup.\n\n";
21
- const READ_DOCX_TAIL = "Modes:\n- 'full' (default): paginated body content. Use page=N to navigate.\n- 'outline': heading map only — start here for large docs to plan targeted reads. Defaults to L1-L2 headings; pass outline_max_level=3-6 to see deeper structure.\n- 'appendix': defined terms, anchors, and cross-reference targets. Consult before editing legal/technical docs to avoid breaking references.";
34
+ const READ_DOCX_COMMON_DESC =
35
+ "Reads a DOCX file. Returns text with inline CriticMarkup for Tracked Changes and Comments: {++inserted++}, {--deleted--}, {==highlighted==}{>>comment<<}. Set clean_view=True for the finalized 'Accepted' text without markup.\n\n";
36
+ const READ_DOCX_TAIL =
37
+ "Modes:\n- 'full' (default): paginated body content. Use page=N to navigate.\n- 'outline': heading map only — start here for large docs to plan targeted reads. Defaults to L1-L2 headings; pass outline_max_level=3-6 to see deeper structure.\n- 'appendix': defined terms, anchors, and cross-reference targets. Consult before editing legal/technical docs to avoid breaking references.";
38
+
39
+ const PROCESS_BATCH_COMMON_DESC =
40
+ "Applies a batch of edits and review actions to a DOCX.\n\nAll changes evaluate against the ORIGINAL document state — do not chain dependent edits within one batch (e.g. rename X to Y, then modify Y). Apply the rename first, then send a second batch.\n\n";
41
+ const PROCESS_BATCH_OPERATIONS_DESC =
42
+ "Each item in `changes` must specify a `type`:\n1. 'modify': Search-and-replace. `target_text` must uniquely match — include surrounding context if the phrase is ambiguous. `new_text` supports Markdown: '# Heading 1' through '###### Heading 6', '**bold**', '_italic_', and '\\n\\n' to split into multiple paragraphs. Empty `new_text` deletes. Do NOT write CriticMarkup tags ({++, {--, {>>) manually — use the `comment` parameter for comments.\n2. 'accept' / 'reject': Finalize or revert a tracked change by `target_id` (e.g. 'Chg:12').\n3. 'reply': Reply to a comment by `target_id` (e.g. 'Com:5') with `text`.\n4. 'insert_row' / 'delete_row': Table edits. Disk mode only — not supported on Live Word canvas.\n\nID VOLATILITY: 'Chg:N' and 'Com:N' shift between document states. Always call `read_docx` immediately before any accept/reject/reply — do not reuse IDs from earlier in the conversation.\n\n`author_name` is used for attribution on all tracked changes and comments, in both disk and Live Word modes.";
22
43
 
23
- const PROCESS_BATCH_COMMON_DESC = "Applies a batch of edits and review actions to a DOCX.\n\nAll changes evaluate against the ORIGINAL document state — do not chain dependent edits within one batch (e.g. rename X to Y, then modify Y). Apply the rename first, then send a second batch.\n\n";
24
- const PROCESS_BATCH_OPERATIONS_DESC = "Each item in `changes` must specify a `type`:\n1. 'modify': Search-and-replace. `target_text` must uniquely match — include surrounding context if the phrase is ambiguous. `new_text` supports Markdown: '# Heading 1' through '###### Heading 6', '**bold**', '_italic_', and '\\n\\n' to split into multiple paragraphs. Empty `new_text` deletes. Do NOT write CriticMarkup tags ({++, {--, {>>) manually — use the `comment` parameter for comments.\n2. 'accept' / 'reject': Finalize or revert a tracked change by `target_id` (e.g. 'Chg:12').\n3. 'reply': Reply to a comment by `target_id` (e.g. 'Com:5') with `text`.\n4. 'insert_row' / 'delete_row': Table edits. Disk mode only not supported on Live Word canvas.\n\nID VOLATILITY: 'Chg:N' and 'Com:N' shift between document states. Always call `read_docx` immediately before any accept/reject/reply — do not reuse IDs from earlier in the conversation.\n\n`author_name` is used for attribution on all tracked changes and comments, in both disk and Live Word modes.";
44
+ const DIFF_DOCX_DESC =
45
+ "Compares two DOCX files and returns a unified diff of their text content. Useful for analyzing differences between versions before editing.";
25
46
 
26
47
  // --- Server Setup ---
27
48
  const server = new Server(
28
49
  {
29
- name: 'adeu-redlining-service',
30
- version: '1.0.0',
50
+ name: "adeu-redlining-service",
51
+ version: "1.0.0",
31
52
  },
32
53
  {
33
54
  capabilities: {
34
55
  tools: {},
35
56
  },
36
- }
57
+ },
37
58
  );
38
59
 
39
60
  // --- Tool Registration ---
@@ -41,168 +62,381 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
41
62
  return {
42
63
  tools: [
43
64
  {
44
- name: 'read_docx',
65
+ name: "read_docx",
45
66
  description: READ_DOCX_COMMON_DESC + READ_DOCX_TAIL,
46
67
  inputSchema: {
47
- type: 'object',
68
+ type: "object",
48
69
  properties: {
49
- file_path: { type: 'string', description: 'Absolute path to the DOCX file.' },
50
- clean_view: { type: 'boolean', description: "If False (default), returns the 'Raw' text with inline CriticMarkup. If True, returns 'Accepted' text.", default: false },
51
- mode: { type: 'string', enum: ['full', 'outline', 'appendix'], description: "'full' returns body content. 'outline' returns a structural heading map. 'appendix' returns defined terms.", default: 'full' },
52
- page: { type: 'number', description: 'Page number (1-indexed) for mode=\'full\'. Defaults to 1.', default: 1 },
53
- outline_max_level: { type: 'number', description: 'For mode=\'outline\' only: cap on heading depth.', default: 2 },
54
- outline_verbose: { type: 'boolean', description: 'For mode=\'outline\' only: includes metadata.', default: false }
70
+ file_path: {
71
+ type: "string",
72
+ description: "Absolute path to the DOCX file.",
73
+ },
74
+ clean_view: {
75
+ type: "boolean",
76
+ description:
77
+ "If False (default), returns the 'Raw' text with inline CriticMarkup. If True, returns 'Accepted' text.",
78
+ default: false,
79
+ },
80
+ mode: {
81
+ type: "string",
82
+ enum: ["full", "outline", "appendix"],
83
+ description:
84
+ "'full' returns body content. 'outline' returns a structural heading map. 'appendix' returns defined terms.",
85
+ default: "full",
86
+ },
87
+ page: {
88
+ type: "number",
89
+ description:
90
+ "Page number (1-indexed) for mode='full'. Defaults to 1.",
91
+ default: 1,
92
+ },
93
+ outline_max_level: {
94
+ type: "number",
95
+ description: "For mode='outline' only: cap on heading depth.",
96
+ default: 2,
97
+ },
98
+ outline_verbose: {
99
+ type: "boolean",
100
+ description: "For mode='outline' only: includes metadata.",
101
+ default: false,
102
+ },
55
103
  },
56
- required: ['file_path']
57
- }
104
+ required: ["file_path"],
105
+ },
58
106
  },
59
107
  {
60
- name: 'process_document_batch',
108
+ name: "process_document_batch",
61
109
  description: PROCESS_BATCH_COMMON_DESC + PROCESS_BATCH_OPERATIONS_DESC,
62
110
  inputSchema: {
63
- type: 'object',
111
+ type: "object",
64
112
  properties: {
65
- original_docx_path: { type: 'string', description: 'Absolute path to the source file.' },
66
- author_name: { type: 'string', description: "Name to appear in Track Changes (e.g., 'Reviewer AI')." },
67
- changes: {
68
- type: 'array',
69
- description: "List of changes to apply. Each change must specify 'type'.",
70
- items: { type: 'object' }
71
- },
72
- output_path: { type: 'string', description: 'Optional output path.' }
113
+ original_docx_path: {
114
+ type: "string",
115
+ description: "Absolute path to the source file.",
116
+ },
117
+ author_name: {
118
+ type: "string",
119
+ description:
120
+ "Name to appear in Track Changes (e.g., 'Reviewer AI').",
121
+ },
122
+ changes: {
123
+ type: "array",
124
+ description:
125
+ "List of changes to apply. Each change must specify 'type'.",
126
+ items: { type: "object" },
127
+ },
128
+ output_path: {
129
+ type: "string",
130
+ description: "Optional output path.",
131
+ },
73
132
  },
74
- required: ['original_docx_path', 'author_name', 'changes']
75
- }
133
+ required: ["original_docx_path", "author_name", "changes"],
134
+ },
76
135
  },
77
136
  {
78
- name: 'accept_all_changes',
79
- description: "Accepts all tracked changes and removes all comments in a single operation, producing a finalized clean document. Use this when a document review is entirely complete and you want to clear all redlines.",
137
+ name: "accept_all_changes",
138
+ description:
139
+ "Accepts all tracked changes and removes all comments in a single operation, producing a finalized clean document. Use this when a document review is entirely complete and you want to clear all redlines.",
80
140
  inputSchema: {
81
- type: 'object',
141
+ type: "object",
82
142
  properties: {
83
- docx_path: { type: 'string', description: 'Absolute path to the DOCX file.' },
84
- output_path: { type: 'string', description: 'Optional output path.' }
143
+ docx_path: {
144
+ type: "string",
145
+ description: "Absolute path to the DOCX file.",
146
+ },
147
+ output_path: {
148
+ type: "string",
149
+ description: "Optional output path.",
150
+ },
85
151
  },
86
- required: ['docx_path']
87
- }
88
- }
89
- ]
152
+ required: ["docx_path"],
153
+ },
154
+ },
155
+ {
156
+ name: "diff_docx_files",
157
+ description: DIFF_DOCX_DESC,
158
+ inputSchema: {
159
+ type: "object",
160
+ properties: {
161
+ original_path: {
162
+ type: "string",
163
+ description: "Absolute path to the baseline DOCX file.",
164
+ },
165
+ modified_path: {
166
+ type: "string",
167
+ description: "Absolute path to the modified DOCX file.",
168
+ },
169
+ compare_clean: {
170
+ type: "boolean",
171
+ description:
172
+ "If True, compares 'Accepted' state. If False, compares raw text.",
173
+ default: true,
174
+ },
175
+ },
176
+ required: ["original_path", "modified_path"],
177
+ },
178
+ },
179
+ {
180
+ name: "finalize_document",
181
+ description:
182
+ "Prepares a document for external distribution or e-signature. This tool combines metadata sanitization, document locking (protection), and markup resolution into a single step. NOTE: PDF export and AES encryption are disabled in this environment.",
183
+ inputSchema: {
184
+ type: "object",
185
+ properties: {
186
+ file_path: {
187
+ type: "string",
188
+ description: "Absolute path to the DOCX file.",
189
+ },
190
+ output_path: {
191
+ type: "string",
192
+ description: "Optional output path.",
193
+ },
194
+ sanitize_mode: {
195
+ type: "string",
196
+ enum: ["full", "keep-markup"],
197
+ description:
198
+ "full removes all markup, keep-markup redacts metadata but keeps comments/redlines.",
199
+ },
200
+ accept_all: {
201
+ type: "boolean",
202
+ description:
203
+ "If true, auto-accepts all unresolved track changes before finalizing.",
204
+ },
205
+ protection_mode: {
206
+ type: "string",
207
+ enum: ["read_only", "encrypt"],
208
+ description:
209
+ "Native OOXML document locking. encrypt falls back to read_only in this environment.",
210
+ },
211
+ password: {
212
+ type: "string",
213
+ description: "Ignored in this environment.",
214
+ },
215
+ author: {
216
+ type: "string",
217
+ description:
218
+ "Replace all remaining markup authorship with this name.",
219
+ },
220
+ export_pdf: {
221
+ type: "boolean",
222
+ description: "Ignored in this environment.",
223
+ },
224
+ },
225
+ required: ["file_path"],
226
+ },
227
+ },
228
+ ],
90
229
  };
91
230
  });
92
231
 
93
232
  // --- Tool Execution ---
94
- server.setRequestHandler(CallToolRequestSchema, async (request): Promise<any> => {
95
- const { name, arguments: args } = request.params;
233
+ server.setRequestHandler(
234
+ CallToolRequestSchema,
235
+ async (request): Promise<any> => {
236
+ const { name, arguments: args } = request.params;
96
237
 
97
- try {
98
- if (name === 'read_docx') {
99
- const filePath = args?.file_path as string;
100
- const cleanView = args?.clean_view as boolean ?? false;
101
- const mode = args?.mode as string ?? 'full';
102
- const page = args?.page as number ?? 1;
103
- const outline_max_level = args?.outline_max_level as number ?? 2;
104
- const outline_verbose = args?.outline_verbose as boolean ?? false;
105
-
106
- const buf = readFileSync(filePath);
107
- const text = await extractTextFromBuffer(buf, cleanView);
108
-
109
- if (mode === 'outline') {
110
- const doc = await DocumentObject.load(buf);
111
- return build_outline_response(doc, text, filePath, outline_max_level, outline_verbose);
112
- }
113
- if (mode === 'appendix') {
114
- return build_appendix_response(text, page, filePath);
115
- }
116
- return build_paginated_response(text, page, filePath);
117
- }
238
+ try {
239
+ if (name === "read_docx") {
240
+ const filePath = args?.file_path as string;
241
+ const cleanView = (args?.clean_view as boolean) ?? false;
242
+ const mode = (args?.mode as string) ?? "full";
243
+ const page = (args?.page as number) ?? 1;
244
+ const outline_max_level = (args?.outline_max_level as number) ?? 2;
245
+ const outline_verbose = (args?.outline_verbose as boolean) ?? false;
246
+
247
+ const buf = readFileBytesOrThrow(filePath);
248
+ const text = await extractTextFromBuffer(buf, cleanView);
118
249
 
119
- if (name === 'process_document_batch') {
120
- const origPath = args?.original_docx_path as string;
121
- const authorName = args?.author_name as string;
122
- const changes = args?.changes as any[];
123
- let outPath = args?.output_path as string;
124
-
125
- if (!outPath) {
126
- const ext = extname(origPath);
127
- const base = basename(origPath, ext);
128
- const dir = dirname(origPath);
129
- outPath = resolve(dir, `${base}_processed${ext}`);
250
+ if (mode === "outline") {
251
+ const doc = await DocumentObject.load(buf);
252
+ return build_outline_response(
253
+ doc,
254
+ text,
255
+ filePath,
256
+ outline_max_level,
257
+ outline_verbose,
258
+ );
259
+ }
260
+ if (mode === "appendix") {
261
+ return build_appendix_response(text, page, filePath);
262
+ }
263
+ return build_paginated_response(text, page, filePath);
130
264
  }
265
+ if (name === "process_document_batch") {
266
+ const origPath = args?.original_docx_path as string;
267
+ const authorName = args?.author_name as string;
268
+ const changes = args?.changes as any[];
269
+ let outPath = args?.output_path as string;
270
+
271
+ if (!authorName || !authorName.trim()) {
272
+ return {
273
+ content: [
274
+ { type: "text", text: "Error: author_name cannot be empty." },
275
+ ],
276
+ };
277
+ }
131
278
 
132
- const buf = readFileSync(origPath);
133
- const doc = await DocumentObject.load(buf);
134
- const engine = new RedlineEngine(doc, authorName);
135
-
136
- let stats;
137
- try {
138
- stats = engine.process_batch(changes);
139
- } catch (e) {
140
- if (e instanceof BatchValidationError) {
279
+ if (!changes || changes.length === 0) {
141
280
  return {
142
- content: [{ type: 'text', text: `Batch rejected. Some edits failed validation:\n\n${(e as BatchValidationError).errors.join('\n\n')}` }],
143
- isError: true
281
+ content: [{ type: "text", text: "Error: No changes provided." }],
144
282
  };
145
283
  }
146
- throw e;
284
+ if (!outPath) {
285
+ const ext = extname(origPath);
286
+ const base = basename(origPath, ext);
287
+ const dir = dirname(origPath);
288
+ outPath = resolve(dir, `${base}_processed${ext}`);
289
+ }
290
+
291
+ const buf = readFileBytesOrThrow(origPath);
292
+ const doc = await DocumentObject.load(buf);
293
+ const engine = new RedlineEngine(doc, authorName);
294
+
295
+ let stats;
296
+ try {
297
+ stats = engine.process_batch(changes);
298
+ } catch (e) {
299
+ if (e instanceof BatchValidationError) {
300
+ return {
301
+ content: [
302
+ {
303
+ type: "text",
304
+ text: `Batch rejected. Some edits failed validation:\n\n${(e as BatchValidationError).errors.join("\n\n")}`,
305
+ },
306
+ ],
307
+ isError: true,
308
+ };
309
+ }
310
+ throw e;
311
+ }
312
+
313
+ const outBuf = await doc.save();
314
+ // Using dynamic import of fs/promises or just sync write
315
+ const fs = await import("node:fs");
316
+ fs.writeFileSync(outPath, outBuf);
317
+
318
+ let res = `Batch complete. Saved to: ${outPath}\nActions: ${stats.actions_applied} applied, ${stats.actions_skipped} skipped.\nEdits: ${stats.edits_applied} applied, ${stats.edits_skipped} skipped.`;
319
+ if (stats.skipped_details?.length > 0) {
320
+ res += `\n\nSkipped Details:\n${stats.skipped_details.join("\n")}`;
321
+ }
322
+
323
+ return {
324
+ content: [{ type: "text", text: res }],
325
+ };
147
326
  }
148
327
 
149
- const outBuf = await doc.save();
150
- // Using dynamic import of fs/promises or just sync write
151
- const fs = await import('node:fs');
152
- fs.writeFileSync(outPath, outBuf);
328
+ if (name === "accept_all_changes") {
329
+ const docxPath = args?.docx_path as string;
330
+ let outPath = args?.output_path as string;
331
+
332
+ if (!outPath) {
333
+ const ext = extname(docxPath);
334
+ const base = basename(docxPath, ext);
335
+ const dir = dirname(docxPath);
336
+ outPath = resolve(dir, `${base}_clean${ext}`);
337
+ }
338
+
339
+ const buf = readFileBytesOrThrow(docxPath);
340
+ const doc = await DocumentObject.load(buf);
341
+ const engine = new RedlineEngine(doc);
342
+
343
+ // We implement the public facing accept_all wrapper from python
344
+ engine.accept_all_revisions();
345
+
346
+ const outBuf = await doc.save();
347
+ const fs = await import("node:fs");
348
+ fs.writeFileSync(outPath, outBuf);
153
349
 
154
- let res = `Batch complete. Saved to: ${outPath}\nActions: ${stats.actions_applied} applied, ${stats.actions_skipped} skipped.\nEdits: ${stats.edits_applied} applied, ${stats.edits_skipped} skipped.`;
155
- if (stats.skipped_details?.length > 0) {
156
- res += `\n\nSkipped Details:\n${stats.skipped_details.join('\n')}`;
350
+ return {
351
+ content: [
352
+ {
353
+ type: "text",
354
+ text: `Accepted all changes. Saved to: ${outPath}`,
355
+ },
356
+ ],
357
+ };
157
358
  }
359
+ if (name === "diff_docx_files") {
360
+ const origPath = args?.original_path as string;
361
+ const modPath = args?.modified_path as string;
362
+ const compareClean = (args?.compare_clean as boolean) ?? true;
363
+ const origBuf = readFileBytesOrThrow(origPath);
364
+ const modBuf = readFileBytesOrThrow(modPath);
158
365
 
159
- return {
160
- content: [{ type: 'text', text: res }]
161
- };
162
- }
366
+ // Pass compareClean flag into extraction
367
+ const origText = await extractTextFromBuffer(origBuf, compareClean);
368
+ const modText = await extractTextFromBuffer(modBuf, compareClean);
163
369
 
164
- if (name === 'accept_all_changes') {
165
- const docxPath = args?.docx_path as string;
166
- let outPath = args?.output_path as string;
370
+ const diff = create_word_patch_diff(
371
+ origText,
372
+ modText,
373
+ basename(origPath),
374
+ basename(modPath)
375
+ );
167
376
 
168
- if (!outPath) {
169
- const ext = extname(docxPath);
170
- const base = basename(docxPath, ext);
171
- const dir = dirname(docxPath);
172
- outPath = resolve(dir, `${base}_clean${ext}`);
377
+ return {
378
+ content: [{ type: "text", text: diff || "No differences found." }],
379
+ };
173
380
  }
174
381
 
175
- const buf = readFileSync(docxPath);
176
- const doc = await DocumentObject.load(buf);
177
- const engine = new RedlineEngine(doc);
178
-
179
- // We implement the public facing accept_all wrapper from python
180
- engine.accept_all_revisions();
181
-
182
- const outBuf = await doc.save();
183
- const fs = await import('node:fs');
184
- fs.writeFileSync(outPath, outBuf);
382
+ if (name === "finalize_document") {
383
+ const filePath = args?.file_path as string;
384
+ let outPath = args?.output_path as string;
385
+
386
+ if (!outPath) {
387
+ const ext = extname(filePath);
388
+ const base = basename(filePath, ext);
389
+ const dir = dirname(filePath);
390
+ outPath = resolve(dir, `${base}_final${ext}`);
391
+ }
392
+
393
+ const buf = readFileBytesOrThrow(filePath);
394
+ const doc = await DocumentObject.load(buf);
395
+
396
+ const result = await finalize_document(doc, {
397
+ filename: basename(filePath),
398
+ sanitize_mode: (args?.sanitize_mode as any) || "full",
399
+ accept_all: args?.accept_all as boolean,
400
+ protection_mode: args?.protection_mode as any,
401
+ author: args?.author as string,
402
+ export_pdf: args?.export_pdf as boolean,
403
+ });
185
404
 
405
+ const fs = await import("node:fs");
406
+ fs.writeFileSync(outPath, result.outBuffer!);
407
+
408
+ return {
409
+ content: [
410
+ {
411
+ type: "text",
412
+ text: `Saved to: ${outPath}\n\n${result.reportText}`,
413
+ },
414
+ ],
415
+ };
416
+ }
417
+
418
+ throw new Error(`Unknown tool: ${name}`);
419
+ } catch (error: any) {
186
420
  return {
187
- content: [{ type: 'text', text: `Accepted all changes. Saved to: ${outPath}` }]
421
+ content: [
422
+ {
423
+ type: "text",
424
+ text: `Error executing tool ${name}: ${error.message}`,
425
+ },
426
+ ],
427
+ isError: true,
188
428
  };
189
429
  }
190
-
191
- throw new Error(`Unknown tool: ${name}`);
192
-
193
- } catch (error: any) {
194
- return {
195
- content: [{ type: 'text', text: `Error executing tool ${name}: ${error.message}` }],
196
- isError: true,
197
- };
198
- }
199
- });
430
+ },
431
+ );
200
432
 
201
433
  // --- Startup ---
202
434
  async function main() {
203
435
  const transport = new StdioServerTransport();
204
436
  await server.connect(transport);
205
- console.error(`Adeu MCP Server (Node.js Engine: ${identifyEngine()}) running on stdio`);
437
+ console.error(
438
+ `Adeu MCP Server (Node.js Engine: ${identifyEngine()}) running on stdio`,
439
+ );
206
440
  }
207
441
 
208
- main().catch(console.error);
442
+ main().catch(console.error);