Accelerate UML modeling in Modelio 6.1.1 by letting LangChain4j + Azure OpenAI ingest procurement PDFs, extract validated requirements, and drive the Modelio MCP server to build requirements, domain models, and use-case diagrams automatically.
- Document-to-model automation –
PipelineRunnerparses PDF tenders with PDFBox, filters/classifies requirements with multi-stage prompts, and hands PlantUML + context to the MCP tooling pipeline. - Three-phase UML synthesis –
LangchainServiceorchestrates requirement creation, class modeling, and use-case generation through pooledUmlModelingAssistantinstances so complex models stay consistent. - TMA specialization –
TmaPipelineRunnerfocuses on Tierce Maintenance Applicative dossiers, structuring SLA/competency requirements and pushing them straight into Modelio without PlantUML detours. - MCP-native execution –
ModelioMcpAgentuses the Model Context Protocol over SSE to call the same tools exposed by the Modelio MCP Server module, ensuring every element is created via official APIs. - Validation & diagnostics –
RequirementsValidatorandRequirementContextValidatorquantify coverage so you know when the LLM pipeline lost context, while rich logs/live reports land in the project-specific output folder.
- Trigger a command in Modelio –
GenerateFromPdfCommandorGenerateExigencesForTMA(see module GUI) asks you to pick a PDF and computes a project-scopedmodelioalchemist-output(ortma-analysis-output) directory. - AI pipeline –
MainwiresLangchainServiceto Azure OpenAI (PolicyAwareAzureChatModel) and, if needed, the MCP client. It runs:- PDF extraction (
PdfExtractor). - Requirement extraction + filtering + domain classification (
PipelineRunner). - Validation (
RequirementsValidator,RequirementContextValidator). - Domain/UML synthesis (multi-phase prompts in
LangchainService).
- PDF extraction (
- Model creation –
ModelioMcpAgentcalls the MCP tools to create packages, requirements, classes, associations, actors, and use cases directly inside the open Modelio project. - Artifacts – Every stage stores trace files (JSON, text, PlantUML, reports) under the computed output folder for reproducibility.
src/main/java/com/docaposte/modelioalchemist/handlers– Modelio command handlers that collect context and invoke the pipeline.src/main/java/com/docaposte/modelioalchemist/langchain/impl– Core LangChain4j integration, pooling logic, PDF tooling, validators, PlantUML utilities, and MCP bridge.src/main/java/com/docaposte/modelioalchemist/tma– TMA-focused extractor and runner.documents/– Sample cahiers des charges, processed extracts, and generated analyses you can reuse for tests.assembly.xml+pom.xml– Build descriptors that package the module into a.jmdacarchive.
- Modelio 6.1.1 (module
binaryversioninmodule.xml). - Java 17 (configured via
maven-compiler-plugin). - Maven 3.9+.
- Modelio MCP Server module running in the same workspace (provides the Streamable HTTP endpoint consumed by
ModelioMcpAgent). - Azure OpenAI access (API gateway token or Azure AD token) compatible with LangChain4j 1.3.x.
mvn clean packageThe build copies all runtime dependencies to target/lib/, assembles target/ModelioAlchemist_0.0.00.jmdac, then renames the ZIP automatically. Install the module by copying the .jmdac into your Modelio modules/ directory (or importing it through Configuration ➜ Modules).
Main and LangchainService expect the following environment variables before you run the pipeline (from Modelio or the CLI):
| Variable | Required | Purpose |
|---|---|---|
AZURE_OPENAI_AD_TOKEN |
✅ | Subscription key or AAD token used by HttpPolicies.auth() to hit your Azure OpenAI / API Gateway endpoint. |
AZURE_OPENAI_BASE_URL |
➖ (default https://apigatewayinnovation.azure-api.net/openai-api/deployments/gpt-5-4-mini) |
Base URL passed to AzureEndpointResolver. |
AZURE_OPENAI_DEPLOYMENT |
➖ | Deployment name when the base URL does not embed it (default: gpt-5-4-mini). |
MODELIO_MCP_URL |
➖ (default http://localhost:8083/mcp) |
Streamable HTTP endpoint exposed by the Modelio MCP server module. |
MODELIO_ALCHEMIST_HTTP_LOG_LEVEL |
➖ (default NONE) |
Azure HTTP log verbosity (NONE, BASIC, HEADERS, BODY_AND_HEADERS). Keep NONE for normal runs; increase only for troubleshooting. |
The module now targets Azure OpenAI API version 2026-03-17 and uses a default chat temperature of 1.0.
These can be defined globally, via a startup script, or inside Modelio’s launcher .bat/.sh so that the module inherits them.
- Install + activate ModelioAlchemist in your project.
- Ensure the MCP server module is running (the MCP status console should show
/mcpready). - Configure Azure variables in the environment used to launch Modelio.
- Open a project and right-click any element (package, root, etc.) to access the module’s contextual commands:
- Choose a PDF when prompted.
- The pipeline creates
modelioalchemist-outputinside the Modelio project directory (falls back to%USERPROFILE%/modelioalchemist-output). - Watch live status dialogs and check the output folder for:
extracted_text.txt– raw PDF text, annotated with[PAGE n]markers inserted byPdfExtractorso downstream agents can trace each requirement back to its page.extracted_agent_text.txt– curated text; the extractor agent is instructed to keep a(page n, section ...)annotation next to every requirement it extracts.filtered_requirements.json– JSON that drives requirement creation, including precise origin metadata (original_ref,source_location,source_quote) used when creating Modelio requirements.source_locationis expected to combine the section/sub-section and the page number (e.g.Section 3.2.1 - Authentification, page 14); combined with the source document name this becomes theoriginstring set on each Modelio requirement viaanalyst_createElement'sanalyst_propertiesmap.- Important:
analyst_propertieskeys are stored verbatim by the MCP server (no case-insensitive matching), so the key must match exactly what the target Modelio Analyst project'sRequirementstereotype defines. This project has been observed to define it asOrigin(capitalO); ModelioAlchemist setsOrigin,origin, andoriginesimultaneously for compatibility, but if requirements still show an empty Origin field, verify the actual property name defined in your Analyst profile and adjustLangchainService.createRequirementElementaccordingly. Verify persisted values withanalyst_queryItems(it returnsanalyst_properties) rather thananalyst_getItemDetail. classified.json,*_report.txt– category-specific analyses (technique, rssi, fonctionnel, rse, ecoconception).requirements_validation.txt,context_validation.txt– coverage diagnostics.uml_model_3phase_report.txt, PlantUML exports, and MCP execution logs.
- Pick a PDF or TXT TMA dossier.
- Outputs land in
tma-analysis-outputunder the current project (or%USERPROFILE%). - The
TmaPipelineRunnerwrites:extracted_raw_text.txt,extracted_cleaned_text.txt.tma_requirements_analysis.txt(prompted extraction).structured_tma_requirements.txt(ready-to-import format).modelio_mcp_tma_report.txt(trace of requirement creation via MCP).
All elements created in Modelio remain linked to the current selection (packages, requirements folders, etc.) through the context computed in the handlers.
You can run the AI pipeline without Modelio to verify prompts or generate offline artifacts:
# After mvn clean package
java -cp "target/lib/*;target/modelioalchemist-0.0.00.jar" \
com.docaposte.modelioalchemist.langchain.impl.Main \
path/to/requirements.pdfMain.main() uses the defaults listed earlier and writes to output/. Main.mainWithOutputDir() and Main.tmaWithOutputDir() are the entry points used by Modelio – you can call them from your own launcher if you need scripted batches.
The pipeline consistently drops machine-readable traces so you can feed downstream QA steps or auditors:
- Requirements JSON:
filtered_requirements.jsonplus category splits inclassified.json. - Context & validation:
requirements_validation.txt,context_validation.txtwith coverage stats and recommendations. - Generated diagrams: PlantUML snippets for as-built domain and use-case diagrams, along with textual summaries in
*_report.txt. - MCP execution logs:
requirements_creation_report.txt,uml_model_3phase_report.txt,modelio_mcp_tma_report.txtdescribing each tool invocation and returned UUIDs.
- Missing Azure token – the pipeline stops early with “Please set AZURE_OPENAI_AD_TOKEN” (see
Main). Export the env var before launching Modelio. - MCP connection failures –
LangchainServicelogs “Impossible de se connecter au serveur MCP Modelio”; verify the MCP server module is active and thatMODELIO_MCP_URLpoints to the right host/port. - HTTP request/response logs are too verbose – ensure
MODELIO_ALCHEMIST_HTTP_LOG_LEVELis unset (or set toNONE). UseBASIC/HEADERS/BODY_AND_HEADERSonly for temporary diagnostics. - Empty requirement sets – inspect
filtered_requirements.jsonand*_report.txt; adjust the source PDF quality or tweak prompts inPipelineRunner/TmaRequirementsExtractorif your corpus uses different markers. - Output directory issues – handlers fall back to
%USERPROFILE%when they cannot resolve the project root. Ensure your Modelio project is writable if you rely on in-project folders.
- Keep code in English/French consistently (commands are localized, prompts are in French by design).
- Reuse the pooled
LangchainServiceinstead of instantiating new MCP clients. - Add sample inputs/outputs under
documents/so reviewers can replay scenarios. - Run
mvn clean packagebefore submitting to ensure the.jmdacassembles correctly.