run_contam_simulation
Run CONTAM airflow and contaminant transport simulations to validate building models and collect generated output files.
Instructions
Use this when you want to validate or run a CONTAM .prj model with ContamX and collect the generated files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | ||
| workingDirectory | No | ||
| timeoutSeconds | No | ||
| testInputOnly | No | ||
| bridgeAddress | No | ||
| windFromBridge | No | ||
| volumeFlowBridge | No |
Implementation Reference
- contam-mcp/src/server.js:2749-2813 (handler)The 'run_contam_simulation' tool is implemented in 'server.js'. It resolves the 'contamx' executable, prepares arguments, runs the process, and snapshots file system changes to identify generated artifacts.
"run_contam_simulation", "Use this when you want to validate or run a CONTAM .prj model with ContamX and collect the generated files.", { projectPath: z.string(), workingDirectory: z.string().optional(), timeoutSeconds: z.number().int().min(1).max(3600).optional(), testInputOnly: z.boolean().optional(), bridgeAddress: z.string().optional(), windFromBridge: z.boolean().optional(), volumeFlowBridge: z.boolean().optional() }, async ({ projectPath, workingDirectory, timeoutSeconds, testInputOnly, bridgeAddress, windFromBridge, volumeFlowBridge }) => { const executablePath = await resolveExecutable("contamx"); const resolvedProjectPath = asAbsolutePath(projectPath); if (!(await fileExists(resolvedProjectPath))) { throw new Error(`Project file not found: ${resolvedProjectPath}`); } const projectDirectory = path.dirname(resolvedProjectPath); const resolvedWorkingDirectory = asAbsolutePath(workingDirectory ?? projectDirectory); const args = [resolvedProjectPath]; if (testInputOnly) { args.push("-t"); } if (bridgeAddress) { args.push("-b", bridgeAddress); } if (windFromBridge) { args.push("-w"); } if (volumeFlowBridge) { args.push("-f"); } const before = await snapshotDirectory(projectDirectory); const result = await runProcess(executablePath, args, { cwd: resolvedWorkingDirectory, timeoutSeconds: timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS }); const after = await snapshotDirectory(projectDirectory); return toolResponse( result.ok ? "ContamX completed successfully." : "ContamX finished with errors or a non-zero exit code.", { executablePath, projectPath: resolvedProjectPath, workingDirectory: resolvedWorkingDirectory, args, ...result, fileChanges: diffSnapshots(before, after), artifacts: await collectProjectArtifacts(resolvedProjectPath) } ); } );