Overview
Theget_duplicates tool identifies two types of issues:
- Value conflicts: Environment variables defined with different values across multiple .env files
- Similar names: Variable names that might represent the same concept (e.g., DB_URL vs DATABASE_URL)
Parameters
Path to the project directory. Defaults to current working directory.
Response
Array of duplicate groups (both value conflicts and similar names)
Number of variables with value conflicts
Number of similar name groups detected
Scan metadata
Example Response
Usage Example
AI assistants can use this tool to identify and resolve duplicate issues:Conflict Types
Value Conflicts
Occurs when the same variable name is defined in multiple .env files with different values. This can indicate:- Intentional: Environment-specific configuration (dev vs staging vs prod)
- Unintentional: Copy-paste errors or outdated values that should be synchronized
Similar Names
Detects variable names that are similar and might represent the same concept:DATABASE_URLvsDB_URLvsDATABASE_URIREDIS_HOSTvsREDIS_HOSTNAMEAPI_KEYvsAPIKEYSMTP_USERvsSMTP_USERNAME
- Inconsistent naming conventions
- Legacy variables that weren’t fully migrated
- Different developers using different conventions
Similarity Detection
The tool detects similar names using:- Edit distance: Names that differ by only a few characters
- Common variations: URL/URI, HOST/HOSTNAME, USER/USERNAME, etc.
- Abbreviations: DB/DATABASE, API/APIKEY, etc.
- Underscore variations: Different separator patterns
Use Cases
- Environment Sync: Ensure consistent configuration across development, staging, and production
- Naming Standards: Identify inconsistent variable naming that should be standardized
- Migration: Find legacy variable names during codebase refactoring
- Configuration Review: Audit all .env files for conflicts before deployment
- Team Collaboration: Prevent different team members from creating similar variables
Recommendations
For value conflicts:- If intentional (different environments), consider using different .env files per environment
- If unintentional, consolidate to a single value or ensure synchronization
- Document why different values exist
- Choose one canonical name and migrate all usages
- Update code to use the standardized name
- Add the standardized name to .env.example with documentation
- Remove or deprecate the old variations