env
Display environment variables and build tool versions for software projects. Optionally isolate configurations by Git branch using worktrees.
Instructions
Show environment information including environment variables and versions of key build tools (gcc, g++, python, make, cmake, etc.). If branch is specified, creates/uses a hidden worktree (.repo@branch) for isolation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | Repository name (required) | |
| branch | No | Git branch name (optional). If provided, uses isolated worktree. |
Implementation Reference
- src/server.py:539-550 (handler)The main handler function for the 'env' tool. It retrieves the repo and optional branch from input arguments, checks for the existence of the env_info.sh script, and executes it within the specified repository's worktree using the shared execute_in_worktree method.async def handle_env(self, args: Dict[str, Any]) -> List[TextContent]: """Handle env command""" repo = args.get("repo") branch = args.get("branch") # Execute env info script if not ENV_INFO_SCRIPT.exists(): raise FileNotFoundError(f"Environment info script not found: {ENV_INFO_SCRIPT}") # Execute in appropriate worktree with locking result = await self.execute_in_worktree(repo, branch, [str(ENV_INFO_SCRIPT)]) return [TextContent(type="text", text=result)]
- src/server.py:396-415 (schema)Pydantic-like JSON schema definition for the 'env' tool's input parameters in the tool registry returned by get_tools_list().Tool( name="env", description="Show environment information including environment variables " "and versions of key build tools (gcc, g++, python, make, cmake, etc.). " "If branch is specified, creates/uses a hidden worktree (.repo@branch) for isolation.", inputSchema={ "type": "object", "properties": { "repo": { "type": "string", "description": "Repository name (required)" }, "branch": { "type": "string", "description": "Git branch name (optional). If provided, uses isolated worktree." } }, "required": ["repo"] } ),
- src/server.py:461-462 (registration)Dispatch registration within the central execute_tool handler that routes 'env' tool calls to the specific handle_env function.elif name == "env": return await self.handle_env(arguments)