Skip to main content
Glama

update_contam_project_references

Edit weather, contaminant, and library file references in CONTAM project files to update simulation inputs and configurations.

Instructions

Use this when you need to edit the referenced weather, contaminant, or library files inside a CONTAM .prj file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYes
weatherFileNo
contaminantFileNo
continuousValuesFileNo
discreteValuesFileNo
wpcFileNo
ewcFileNo
createBackupNo

Implementation Reference

  • The tool "update_contam_project_references" implementation, which reads a project file, updates the file paths for external dependencies (weather, contaminant, etc.), and saves the updated project file.
      "update_contam_project_references",
      "Use this when you need to edit the referenced weather, contaminant, or library files inside a CONTAM .prj file.",
      {
        projectPath: z.string(),
        weatherFile: z.string().nullable().optional(),
        contaminantFile: z.string().nullable().optional(),
        continuousValuesFile: z.string().nullable().optional(),
        discreteValuesFile: z.string().nullable().optional(),
        wpcFile: z.string().nullable().optional(),
        ewcFile: z.string().nullable().optional(),
        createBackup: z.boolean().optional()
      },
      async ({
        projectPath,
        weatherFile,
        contaminantFile,
        continuousValuesFile,
        discreteValuesFile,
        wpcFile,
        ewcFile,
        createBackup
      }) => {
        const resolvedProjectPath = asAbsolutePath(projectPath);
        if (!(await fileExists(resolvedProjectPath))) {
          throw new Error(`Project file not found: ${resolvedProjectPath}`);
        }
    
        const requestedUpdates = {
          weatherFile,
          contaminantFile,
          continuousValuesFile,
          discreteValuesFile,
          wpcFile,
          ewcFile
        };
        const keysToUpdate = Object.keys(requestedUpdates).filter(
          (key) => Object.prototype.hasOwnProperty.call(requestedUpdates, key) && requestedUpdates[key] !== undefined
        );
    
        if (keysToUpdate.length === 0) {
          throw new Error("No reference updates were provided.");
        }
    
        const lines = await readProjectLines(resolvedProjectPath);
        const inspectionBefore = inspectContamProjectLines(lines);
    
        for (const key of keysToUpdate) {
          const descriptor = projectReferenceDescriptors.find((item) => item.key === key);
          const reference = inspectionBefore.references[key];
    
          if (!descriptor || !reference || reference.lineNumber === null) {
            throw new Error(`Could not find a '${key}' line inside ${resolvedProjectPath}.`);
          }
    
          const lineIndex = reference.lineNumber - 1;
          lines[lineIndex] = buildReferenceLine(lines[lineIndex], reference.comment, requestedUpdates[key]);
        }
    
        if (createBackup !== false) {
          const backupPath = `${resolvedProjectPath}.mcp.bak`;
          if (!(await fileExists(backupPath))) {
            await copyFile(resolvedProjectPath, backupPath);
          }
        }
    
        await writeFile(resolvedProjectPath, `${lines.join("\r\n")}\r\n`, { encoding: "utf8" });
        const inspectionAfter = await inspectContamProject(resolvedProjectPath);
    
        return toolResponse("Updated CONTAM project references.", {
          projectPath: resolvedProjectPath,
          backupCreated: createBackup !== false,
          requestedUpdates,
          before: inspectionBefore.references,
          after: inspectionAfter.references
        });
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'edit' implies mutation, the description fails to mention critical safety aspects: the existence of the createBackup parameter, whether invalid file paths are validated, if the operation is atomic, or side effects on simulation state. For a tool that mutates project files, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundancy. However, given the complexity (8 undocumented parameters) and mutation risk, it is arguably underspecified rather than optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 8 parameters with 0% schema coverage, no annotations, and no output schema, the description is inadequate. It fails to explain the majority of parameters, the return value, error conditions, or backup behavior necessary for safely invoking a file-mutation operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, requiring the description to compensate. It implicitly maps 'weather' and 'contaminant' to weatherFile and contaminantFile, and vaguely groups the remaining file parameters as 'library files.' However, it completely omits projectPath (required) and createBackup (boolean), and provides no guidance on parameter formats, valid paths, or that null values likely remove references.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool edits 'referenced weather, contaminant, or library files inside a CONTAM .prj file,' which identifies the resource and action. However, it is ambiguous whether 'edit the referenced files' means modifying the external files' contents or updating the references/pointers within the project file (the latter is correct based on the tool name). It does not explicitly differentiate from siblings like inspect_contam_project or upgrade_contam_project.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear 'Use this when...' trigger for editing specific file references. However, it lacks guidance on when NOT to use the tool (e.g., for editing project geometry) and does not mention alternatives like inspect_contam_project for viewing current references versus updating them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/summer521521/contam_MCP'

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