env
Display environment variables and build tool versions for software projects. Optionally create isolated worktrees by specifying a Git branch to maintain project separation.
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. Extracts repo and branch arguments, checks for the existence of the env_info.sh script, and executes it within the repository's worktree using execute_in_worktree. Returns the output as TextContent.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-414 (schema)The input schema definition for the 'env' tool, specifying required 'repo' parameter and optional 'branch'. Part of the Tool object returned by list_tools.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 point in the execute_tool method where the 'env' tool handler is invoked based on the tool name.elif name == "env": return await self.handle_env(arguments)
- src/server.py:51-51 (helper)Defines the path to the external shell script (env_info.sh) that provides the actual environment information, executed by the handler.ENV_INFO_SCRIPT = Path(__file__).parent / "env_info.sh"