tools: add cd tool for changing working directory

Uses std::env::set_current_dir() syscall so the change affects
all subsequent tool invocations. Supports absolute paths, relative
paths, and ~ expansion.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-12 15:49:46 -04:00
parent 0612e1bc41
commit ab0f16a3b5
2 changed files with 43 additions and 3 deletions

View file

@ -6,13 +6,14 @@
// Core tools
mod ast_grep;
pub mod lsp;
pub mod mcp_client;
mod bash;
mod cd;
pub mod channels;
mod edit;
mod glob;
mod grep;
pub mod lsp;
pub mod mcp_client;
pub mod memory;
mod read;
mod web;
@ -177,7 +178,7 @@ pub async fn dispatch_with_agent(
pub fn tools() -> Vec<Tool> {
let mut all = vec![
read::tool(), write::tool(), edit::tool(),
grep::tool(), glob::tool(), bash::tool(),
grep::tool(), glob::tool(), bash::tool(), cd::tool(),
ast_grep::tool(), vision::tool(),
];
all.extend(web::tools());