agent2: Fix tool schemas for Gemini (#36507)

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <agus@zed.dev>
This commit is contained in:
Bennet Bo Fenner 2025-08-19 20:06:09 +02:00 committed by GitHub
parent 1af47a563f
commit 6b6eb11643
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 4 deletions

View file

@ -1732,8 +1732,8 @@ where
fn initial_title(&self, input: Result<Self::Input, serde_json::Value>) -> SharedString;
/// Returns the JSON schema that describes the tool's input.
fn input_schema(&self) -> Schema {
schemars::schema_for!(Self::Input)
fn input_schema(&self, format: LanguageModelToolSchemaFormat) -> Schema {
crate::tool_schema::root_schema_for::<Self::Input>(format)
}
/// Some tools rely on a provider for the underlying billing or other reasons.
@ -1819,7 +1819,7 @@ where
}
fn input_schema(&self, format: LanguageModelToolSchemaFormat) -> Result<serde_json::Value> {
let mut json = serde_json::to_value(self.0.input_schema())?;
let mut json = serde_json::to_value(self.0.input_schema(format))?;
adapt_schema_to_format(&mut json, format)?;
Ok(json)
}