sad-mcp 0.1.29 → 0.1.30
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/dist/tools.js +35 -0
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
2
5
|
import { listAllFiles, downloadFile, categorizeFile } from "./drive.js";
|
|
3
6
|
import { extractText, isExtractable } from "./text-extract.js";
|
|
4
7
|
import { loadTextCache, saveTextEntry } from "./text-cache.js";
|
|
5
8
|
import { trackToolCall } from "./tracking.js";
|
|
9
|
+
const __tools_filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __tools_dirname = dirname(__tools_filename);
|
|
11
|
+
function loadSkillContent(skillId) {
|
|
12
|
+
const skillsDir = join(__tools_dirname, "..", "skills");
|
|
13
|
+
return readFileSync(join(skillsDir, skillId, "SKILL.md"), "utf-8");
|
|
14
|
+
}
|
|
6
15
|
// In-memory text cache for search (populated from disk cache + fresh extractions)
|
|
7
16
|
const textCache = new Map();
|
|
8
17
|
function isExamFile(file) {
|
|
@@ -225,6 +234,20 @@ export function registerToolHandlers(server) {
|
|
|
225
234
|
required: ["exam_id"],
|
|
226
235
|
},
|
|
227
236
|
},
|
|
237
|
+
{
|
|
238
|
+
name: "bpmn_analysis",
|
|
239
|
+
description: "Analyze a business process description and produce a structured BPMN 1.1 model. Call this tool BEFORE creating any BPMN diagram. Pass the process description and receive analysis instructions. You MUST follow the returned instructions exactly.",
|
|
240
|
+
inputSchema: {
|
|
241
|
+
type: "object",
|
|
242
|
+
properties: {
|
|
243
|
+
process_description: {
|
|
244
|
+
type: "string",
|
|
245
|
+
description: "The full business process description to analyze (in Hebrew or English)",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
required: ["process_description"],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
228
251
|
],
|
|
229
252
|
}));
|
|
230
253
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -448,6 +471,18 @@ export function registerToolHandlers(server) {
|
|
|
448
471
|
trackToolCall(name, toolArgs, { success: true, responseChars: fullResponse.length }, Date.now() - startTime);
|
|
449
472
|
return { content: [{ type: "text", text: fullResponse }] };
|
|
450
473
|
}
|
|
474
|
+
if (name === "bpmn_analysis") {
|
|
475
|
+
const processDescription = args.process_description;
|
|
476
|
+
if (!processDescription) {
|
|
477
|
+
return {
|
|
478
|
+
content: [{ type: "text", text: "Error: process_description parameter is required" }],
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
const instructions = loadSkillContent("bpmn-analysis");
|
|
482
|
+
const fullResponse = `${instructions}\n\n---\n\n## Process Description to Analyze\n\n${processDescription}`;
|
|
483
|
+
trackToolCall(name, toolArgs, { success: true, responseChars: fullResponse.length }, Date.now() - startTime);
|
|
484
|
+
return { content: [{ type: "text", text: fullResponse }] };
|
|
485
|
+
}
|
|
451
486
|
throw new Error(`Unknown tool: ${name}`);
|
|
452
487
|
});
|
|
453
488
|
}
|