Skip to main content
Glama

envalid_validate

Validate .env files against envalid schemas to catch missing variables, type mismatches, and range errors before app startup or during CI.

Instructions

Validate a project's .env files against its envalid schema — catch missing required variables, type mismatches, and values outside allowed ranges.

When to use: before booting the app locally, during CI, after a teammate adds a new required env var, or when switching between development and production configs. Pass environment to validate a specific .env.{env} file.

Side effects: reads .env, .env.local, and .env.{environment} from the project root, and reads the envalid schema (typically src/env.ts or a similar file exporting cleanEnv(...)). Does not write or transmit env values anywhere — validation is local-only.

Returns: plain-text, JSON, or markdown report listing each declared variable, whether it is present, whether its value matches the expected type, and any schema-level validation errors with file:line references. Exit 1 on any validation failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoAbsolute or relative path to the project root to scan. Defaults to the current working directory.
formatNoResponse format: "terminal" for human-readable ANSI-colored output, "json" for machine-parseable structured data, "markdown" for rendered tables (where supported). Defaults to "terminal".
environmentNoEnvironment name to validate (e.g. "production", "staging", "test"). Controls which .env.{environment} file is loaded and which conditional schema rules apply. Omit to validate the default .env/.env.local pair.
Behavior5/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 and excels. It details side effects: 'reads .env, .env.local, and .env.{environment} from the project root, and reads the envalid schema.' It explicitly states safety: 'Does not write or transmit env values anywhere — validation is local-only.' It describes output behavior: 'Returns: plain-text, JSON, or markdown report... Exit 1 on any validation failure.' This covers critical behavioral traits beyond basic functionality.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose, followed by usage guidelines, side effects, and return behavior. Every sentence adds value: the first defines the tool, the second specifies use cases, the third details side effects and safety, and the fourth describes output and exit behavior. There is no wasted text, and information is presented in a logical flow.

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

Completeness5/5

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

Given the tool's complexity (validation with side effects and conditional behavior), no annotations, and no output schema, the description provides comprehensive context. It covers purpose, usage, behavioral transparency (including safety and output), and parameter implications. The absence of an output schema is compensated by detailing the return format and exit behavior, making it complete enough for an agent to understand and invoke the tool correctly.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds meaningful context beyond the schema: it explains the purpose of the 'environment' parameter ('Controls which .env.{environment} file is loaded and which conditional schema rules apply') and implies usage of 'path' and 'format' through examples like 'project root' and output formats. However, it doesn't provide additional syntax or constraints for parameters beyond what the schema already documents.

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

Purpose5/5

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

The description clearly states the specific action ('validate .env files against envalid schema') and resource ('.env files'), with explicit differentiation from siblings by detailing what it catches: missing required variables, type mismatches, and values outside allowed ranges. This goes beyond a generic 'validate' statement to specify the exact validation scope.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'before booting the app locally, during CI, after a teammate adds a new required env var, or when switching between development and production configs.' It also includes a specific instruction to 'Pass `environment` to validate a specific .env.{env} file,' offering clear context for parameter usage without needing to reference alternatives.

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/WhenLabs-org/when'

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