pub fn resolve_tool_path(
project_root: Option<&str>,
shell_cwd: Option<&str>,
raw: &str,
) -> Result<String, String>Expand description
Resolve a (possibly relative) tool path to a normalized, jail-checked, secret-screened absolute path.
Resolution order for relative inputs:
- absolute path → used as-is
<project_root>/<path>if it exists<shell_cwd>/<path>if a shell cwd is known<jail_root>/<path>as a last resort
Relative inputs are NEVER resolved against the process CWD: the daemon’s
CWD is not the project, so a CWD exists() probe made resolution
nondeterministic across MCP/daemon/CLI contexts (and could pick a
same-named file outside the project).
jail_root is project_root, else shell_cwd, else ".". The result is
confined to the jail root via crate::core::pathjail::jail_path and
screened by the secret-path I/O boundary.
Performs blocking filesystem exists() checks; callers on async runtimes
must wrap this in tokio::task::block_in_place.