run_in_env_impl
Execute shell commands in isolated Nix environments for specific programming languages, ensuring clean dependency management without system clutter.
Instructions
Run a shell command in a disposable Nix shell for the chosen language.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | Yes | ||
| command | Yes | ||
| extra_packages | No | ||
| timeout_seconds | No |
Implementation Reference
- mcp_omnienv_nix/server.py:113-120 (handler)Core handler function that validates packages, constructs Nix shell command, runs it with timeout, and returns JSON result.def run_in_env_impl( language: str, command: str, extra_packages: list[str] | None = None, timeout_seconds: int = 120 ) -> str: """Run a shell command in a disposable Nix shell for the chosen language.""" extras = _validate_packages(extra_packages or []) cmd = _nix_shell_command(language.lower(), extras, command) result = _run(cmd, timeout=timeout_seconds) return json.dumps(result, indent=2)
- mcp_omnienv_nix/server.py:124-124 (registration)Registers the run_in_env_impl function as an MCP tool named 'run_in_env'.run_in_env = mcp.tool()(run_in_env_impl)