Skip to main content
Glama

onetech_extract_module

Extract domain models, pages, microflows, and enumerations from Mendix modules using mx.exe. Generates JSON documentation of complete module structure for local analysis.

Instructions

Extract domain model, pages, microflows, and enumerations from a Mendix module using mx.exe. Returns JSON files with complete module structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mprPathYesAbsolute path to the .mpr file (e.g., D:\Projects\OneTech.mpr)
moduleNameYesName of the module to extract (e.g., RequestHub)
outputPathYesAbsolute path to output directory for JSON files
mxPathNoOptional: Path to mx.exe (default: D:\Program Files\Mendix\11.3.0.80734\modeler\mx.exe)

Implementation Reference

  • Core implementation of the onetech_extract_module tool. Validates inputs, executes mx.exe dump-mpr for DomainModels, Pages, Microflows, and Enumerations, saves JSON outputs, removes BOM, computes sizes, handles partial failures, and returns structured result.
    async function extractModule( mprPath: string, moduleName: string, outputPath: string, mxPath: string = DEFAULT_MX_PATH ): Promise<{ success: boolean; files: Array<{ name: string; size: number }>; message: string; }> { // Validate inputs await validateMxExe(mxPath); await validateMprFile(mprPath); await ensureOutputDir(outputPath); const files: Array<{ name: string; size: number }> = []; const errors: string[] = []; // Define the 4 mx.exe commands to extract module data const commands = [ { name: "DomainModel", unitType: "DomainModels$DomainModel", outputFile: join(outputPath, `${moduleName}-DomainModel.json`), }, { name: "Pages", unitType: "Pages$Page", outputFile: join(outputPath, `${moduleName}-Pages.json`), }, { name: "Microflows", unitType: "Microflows$Microflow", outputFile: join(outputPath, `${moduleName}-Microflows.json`), }, { name: "Enumerations", unitType: "Enumerations$Enumeration", outputFile: join(outputPath, `${moduleName}-Enumerations.json`), }, ]; // Execute each command sequentially for (const cmd of commands) { try { const args = ["dump-mpr", "--unit-type", cmd.unitType, "--module-names", moduleName, "--output-file", cmd.outputFile, mprPath]; await runMxCommand(mxPath, args); // Verify file was created and get size let fileContent = await readFile(cmd.outputFile, "utf-8"); // Remove UTF-8 BOM if present (mx.exe outputs BOM) if (fileContent.charCodeAt(0) === 0xfeff) { fileContent = fileContent.substring(1); } files.push({ name: `${cmd.name}.json`, size: Buffer.byteLength(fileContent, "utf-8"), }); } catch (error: any) { errors.push(`${cmd.name}: ${error.message}`); } } // Return results if (files.length === 0) { return { success: false, files: [], message: `Failed to extract module. Errors: ${errors.join(", ")}`, }; } if (errors.length > 0) { return { success: true, files, message: `Extracted ${files.length}/4 files successfully. Partial errors: ${errors.join(", ")}`, }; } return { success: true, files, message: `Successfully extracted ${files.length} files from module '${moduleName}'`, }; }
  • JSON Schema defining the input parameters for the onetech_extract_module tool, including paths for MPR file, module name, output directory, and optional mx.exe path.
    inputSchema: { type: "object", properties: { mprPath: { type: "string", description: "Absolute path to the .mpr file (e.g., D:\\Projects\\OneTech.mpr)", }, moduleName: { type: "string", description: "Name of the module to extract (e.g., RequestHub)", }, outputPath: { type: "string", description: "Absolute path to output directory for JSON files", }, mxPath: { type: "string", description: `Optional: Path to mx.exe (default: ${DEFAULT_MX_PATH})`, }, }, required: ["mprPath", "moduleName", "outputPath"], },
  • src/index.ts:199-230 (registration)
    Registration of the tool in the ListToolsRequestHandler, including name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "onetech_extract_module", description: "Extract domain model, pages, microflows, and enumerations from a Mendix module using mx.exe. Returns JSON files with complete module structure.", inputSchema: { type: "object", properties: { mprPath: { type: "string", description: "Absolute path to the .mpr file (e.g., D:\\Projects\\OneTech.mpr)", }, moduleName: { type: "string", description: "Name of the module to extract (e.g., RequestHub)", }, outputPath: { type: "string", description: "Absolute path to output directory for JSON files", }, mxPath: { type: "string", description: `Optional: Path to mx.exe (default: ${DEFAULT_MX_PATH})`, }, }, required: ["mprPath", "moduleName", "outputPath"], }, }, ], }; });
  • src/index.ts:235-277 (registration)
    Tool dispatch and execution handler in CallToolRequestHandler. Matches tool name, extracts arguments, calls extractModule, formats response or error.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name === "onetech_extract_module") { const { mprPath, moduleName, outputPath, mxPath } = request.params.arguments as { mprPath: string; moduleName: string; outputPath: string; mxPath?: string; }; try { const result = await extractModule(mprPath, moduleName, outputPath, mxPath || DEFAULT_MX_PATH); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify( { success: false, files: [], message: `Error: ${error.message}`, }, null, 2 ), }, ], isError: true, }; } } throw new Error(`Unknown tool: ${request.params.name}`); });
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jordnlvr/onetech-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server