Skip to main content

root_from_workspace_env

Function root_from_workspace_env 

Source
pub fn root_from_workspace_env() -> Option<String>
Expand description

Best project root from the IDE-injected WORKSPACE_FOLDER_PATHS env var.

Cursor declares the MCP roots capability but does NOT implement roots/list (it answers -32601 Method not found) and launches stdio MCP servers with cwd = /. Without this signal the project root falls back to an unsafe directory and relative tool paths resolve against the wrong tree (#699). This variable is the Cursor-sanctioned way to learn the active workspace folder(s). The same broad/unsafe-root guards as MCP roots apply.