data_merge
Merge two configuration files by overlaying values from the second file onto the first, supporting JSON, YAML, and TOML formats with deep merging capabilities.
Instructions
Merge two files into a single deep-merged configuration.
Performs a deep merge where values from the second (overlay) file override or extend those in the first (base) file. If output_file is provided the merged result is written to that path; otherwise the merged content is returned in the response.
Parameters: file_path1 (str): Path to the base file. file_path2 (str): Path to the overlay file whose values override the base. output_format (str | None): Desired output format: "json", "yaml", or "toml". Defaults to the format of the first file. output_file (str | None): Optional path to write the merged output. When omitted, merged content is returned.
Returns: dict: A payload describing the merge. On success includes "success": True, "file1", "file2", "output_format", and either "result" (merged content) or "output_file" (written path).
Raises: ToolError: If an input file is missing, its format is not enabled, the output format is invalid, or the merge fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path1 | Yes | Path to first file (base) | |
| file_path2 | Yes | Path to second file (overlay) | |
| output_format | No | Output format (defaults to format of first file) | |
| output_file | No | Optional output file path (if not provided, returns merged content) |