assistant_tool: Add a source to the Tool trait (#26471)

This PR adds a `source` method to the `Tool` trait.

This will allow us to track where a tool is coming from.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-11 15:10:48 -04:00 committed by GitHub
parent 2021ca5bff
commit 9cce5a650e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 2 deletions

View file

@ -1,7 +1,7 @@
use std::sync::Arc;
use anyhow::{anyhow, bail, Result};
use assistant_tool::Tool;
use assistant_tool::{Tool, ToolSource};
use gpui::{App, Entity, Task};
use project::Project;
@ -37,6 +37,12 @@ impl Tool for ContextServerTool {
self.tool.description.clone().unwrap_or_default()
}
fn source(&self) -> ToolSource {
ToolSource::ContextServer {
id: self.server_id.clone().into(),
}
}
fn input_schema(&self) -> serde_json::Value {
match &self.tool.input_schema {
serde_json::Value::Null => {