pub async fn validate_tool_call(
tool_name: &str,
args: &Value,
project_root: &Path,
read_cache: Option<&FileReadCache>,
last_writer: Option<&LastWriterCache>,
last_bash: Option<&LastBashCache>,
) -> Option<String>Expand description
Validate a tool call before approval.
read_cache is the session file-read cache. When provided, validate_edit
uses it to detect files that have been modified on disk since the model last
read them — catching the most common source of lost-context edits.
last_writer and last_bash add context to staleness errors: instead of a
generic “file was modified” message the model sees which tool was responsible
and how long ago it ran (#804 item 7).
Returns None if the call looks valid, or Some(error_message) describing
why it will fail. The error message is fed back to the model so it can
self-correct without consuming an approval prompt.