@vint.tri/report_gen_mcp 1.7.33 → 1.7.35
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/index.d.ts.map +1 -1
- package/dist/index.js +20 -6
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA4IA,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBjD"}
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import path from 'path';
|
|
|
6
6
|
import fs from 'fs-extra';
|
|
7
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
8
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
+
import { z } from 'zod';
|
|
9
10
|
import { pathToFileURL } from 'url';
|
|
10
11
|
import { ImageGenerator } from './mcp/imageGenerationServer.js';
|
|
11
|
-
import { reportWizardTool } from './tools/reportWizard.js';
|
|
12
12
|
const isStdioMode = process.argv.length === 2;
|
|
13
13
|
let reportsDir = undefined;
|
|
14
14
|
if (!isStdioMode) {
|
|
@@ -73,16 +73,30 @@ program
|
|
|
73
73
|
console.log(JSON.stringify(comprehensiveResult, null, 2));
|
|
74
74
|
});
|
|
75
75
|
if (isStdioMode) {
|
|
76
|
-
const mcpServer = new McpServer({ name: "report_gen_mcp", version: "1.7.
|
|
77
|
-
mcpServer.registerTool(
|
|
78
|
-
description:
|
|
79
|
-
inputSchema:
|
|
76
|
+
const mcpServer = new McpServer({ name: "report_gen_mcp", version: "1.7.35" });
|
|
77
|
+
mcpServer.registerTool("generate-report", {
|
|
78
|
+
description: "Generates an HTML report from a markdown document and a set of elements.",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
document: z.string().describe("The markdown document content."),
|
|
81
|
+
elements: z.any().describe("A JSON object or string containing chart and image configurations."),
|
|
82
|
+
outputFile: z.string().describe("The name of the output HTML file."),
|
|
83
|
+
tempDirectory: z.string().optional().describe("Optional temporary directory."),
|
|
84
|
+
},
|
|
80
85
|
}, async (params) => {
|
|
81
86
|
let processedParams = params;
|
|
82
87
|
if (params.arguments && typeof params.arguments === 'object') {
|
|
83
88
|
processedParams = params.arguments;
|
|
84
89
|
}
|
|
85
|
-
|
|
90
|
+
let { document, elements, outputFile, tempDirectory } = processedParams;
|
|
91
|
+
try {
|
|
92
|
+
if (typeof elements === 'string') {
|
|
93
|
+
elements = JSON.parse(elements);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
throw new Error('Invalid JSON format for "elements" parameter.');
|
|
98
|
+
}
|
|
99
|
+
const result = await generateReport(document, elements, outputFile, tempDirectory);
|
|
86
100
|
const fileUrl = pathToFileURL(result.filePath).href;
|
|
87
101
|
const fileContent = await fs.readFile(result.filePath, 'utf8');
|
|
88
102
|
return {
|