assistant tools: Add Tool::icon method instead of matching on name (#27444)

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-03-25 15:17:36 -03:00 committed by GitHub
parent 0339d654d2
commit 46e86f003f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 98 additions and 18 deletions

View file

@ -9,6 +9,7 @@ use language_model::LanguageModelRequestMessage;
use project::Project;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use ui::IconName;
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct ReadFileToolInput {
@ -52,6 +53,10 @@ impl Tool for ReadFileTool {
include_str!("./read_file_tool/description.md").into()
}
fn icon(&self) -> IconName {
IconName::Eye
}
fn input_schema(&self) -> serde_json::Value {
let schema = schemars::schema_for!(ReadFileToolInput);
serde_json::to_value(&schema).unwrap()