Skip to main content

Overview

The get_env_map tool provides a comprehensive overview of all environment variables in your project. It scans the codebase, resolves variable definitions and usages, and returns a complete map with optional filtering by status.

Parameters

projectPath
string
Path to the project directory. Defaults to current working directory.
filter
string
Filter variables by status. Defaults to “all”.Options:
  • all - Show all environment variables
  • missing - Variables used in code but not defined anywhere
  • unused - Variables defined in .env files but never used
  • risky - Variables with critical or high risk level
  • undocumented - Variables used in code but not documented

Response

summary
object
required
Statistical summary of environment variables
variables
array
required
Array of environment variable summaries
metadata
object
required
Scan metadata

Example Response

{
  "summary": {
    "totalEnvVars": 42,
    "defined": 38,
    "used": 40,
    "missing": 2,
    "undocumented": 5,
    "dead": 2,
    "critical": 1
  },
  "variables": [
    {
      "name": "DATABASE_URL",
      "definedIn": [".env", ".env.example"],
      "usedIn": ["src/db/connection.ts", "src/config/database.ts"],
      "languages": ["typescript"],
      "hasDefault": false,
      "isDocumented": true,
      "riskLevel": "high",
      "issueCount": 0
    },
    {
      "name": "API_KEY",
      "definedIn": [],
      "usedIn": ["src/api/client.ts"],
      "languages": ["typescript"],
      "hasDefault": false,
      "isDocumented": false,
      "riskLevel": "critical",
      "issueCount": 2
    }
  ],
  "metadata": {
    "projectPath": "/Users/dev/my-project",
    "scannedFiles": 156,
    "cacheHit": false,
    "duration": 234
  }
}

Usage Example

AI assistants can call this tool to get a comprehensive overview of all environment variables:
{
  "name": "get_env_map",
  "arguments": {
    "projectPath": "/path/to/project",
    "filter": "missing"
  }
}
To find only risky variables:
{
  "name": "get_env_map",
  "arguments": {
    "filter": "risky"
  }
}

Use Cases

  • Environment Audit: Get a complete overview of all environment variables and their status
  • Finding Missing Variables: Identify variables used in code but not defined in .env files
  • Cleanup: Find unused variables that can be safely removed
  • Security Review: Filter for risky or undocumented variables
  • Documentation: Discover which variables need to be added to .env.example

Build docs developers (and LLMs) love