assistant_tools: Add fetch tool (#26999)

This PR adds a new `fetch` tool to the set of tools the Assistant has
available.

This tool accepts a URL and fetches the content as Markdown.

<img width="1394" alt="Screenshot 2025-03-18 at 11 52 21 AM"
src="https://github.com/user-attachments/assets/e5bcde14-a0dd-4835-9d42-8f45def68f4d"
/>

<img width="1394" alt="Screenshot 2025-03-18 at 11 52 37 AM"
src="https://github.com/user-attachments/assets/3bcce4f5-f61b-40d7-8b30-2c673ce3c06a"
/>

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-18 12:25:51 -04:00 committed by GitHub
parent baaafddbeb
commit ed4e654fdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 170 additions and 6 deletions

View file

@ -2,6 +2,7 @@ mod bash_tool;
mod delete_path_tool;
mod diagnostics_tool;
mod edit_files_tool;
mod fetch_tool;
mod list_directory_tool;
mod now_tool;
mod path_search_tool;
@ -9,13 +10,17 @@ mod read_file_tool;
mod regex_search_tool;
mod thinking_tool;
use std::sync::Arc;
use assistant_tool::ToolRegistry;
use gpui::App;
use http_client::HttpClientWithUrl;
use crate::bash_tool::BashTool;
use crate::delete_path_tool::DeletePathTool;
use crate::diagnostics_tool::DiagnosticsTool;
use crate::edit_files_tool::EditFilesTool;
use crate::fetch_tool::FetchTool;
use crate::list_directory_tool::ListDirectoryTool;
use crate::now_tool::NowTool;
use crate::path_search_tool::PathSearchTool;
@ -23,7 +28,7 @@ use crate::read_file_tool::ReadFileTool;
use crate::regex_search_tool::RegexSearchTool;
use crate::thinking_tool::ThinkingTool;
pub fn init(cx: &mut App) {
pub fn init(http_client: Arc<HttpClientWithUrl>, cx: &mut App) {
assistant_tool::init(cx);
crate::edit_files_tool::log::init(cx);
@ -38,4 +43,5 @@ pub fn init(cx: &mut App) {
registry.register_tool(ReadFileTool);
registry.register_tool(RegexSearchTool);
registry.register_tool(ThinkingTool);
registry.register_tool(FetchTool::new(http_client));
}