agent2: Allow tools to be provider specific (#36111)

Our WebSearch tool requires access to a Zed provider

Release Notes:

- N/A
This commit is contained in:
Ben Brandt 2025-08-13 15:22:05 +02:00 committed by GitHub
parent 7f1a5c6ad7
commit 2b3dbe8815
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 4 deletions

View file

@ -5,7 +5,9 @@ use agent_client_protocol as acp;
use anyhow::{Result, anyhow};
use cloud_llm_client::WebSearchResponse;
use gpui::{App, AppContext, Task};
use language_model::LanguageModelToolResultContent;
use language_model::{
LanguageModelProviderId, LanguageModelToolResultContent, ZED_CLOUD_PROVIDER_ID,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use ui::prelude::*;
@ -50,6 +52,11 @@ impl AgentTool for WebSearchTool {
"Searching the Web".into()
}
/// We currently only support Zed Cloud as a provider.
fn supported_provider(&self, provider: &LanguageModelProviderId) -> bool {
provider == &ZED_CLOUD_PROVIDER_ID
}
fn run(
self: Arc<Self>,
input: Self::Input,