From f044ca64df3f13faa679341aeb4469706c458f4d Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 27 Mar 2026 15:08:24 +0100 Subject: [PATCH] Use codex-utils-template for search tool descriptions (#15996) --- codex-rs/core/src/tools/spec.rs | 35 +++++++++++++++++++++------ codex-rs/core/src/tools/spec_tests.rs | 1 + 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index 1a2f16b5c..d1d758c15 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -49,6 +49,7 @@ use codex_protocol::protocol::SubAgentSource; use codex_tools::parse_mcp_tool; pub use codex_tools::parse_tool_input_schema; use codex_utils_absolute_path::AbsolutePathBuf; +use codex_utils_template::Template; use serde::Deserialize; use serde::Serialize; use serde_json::Value as JsonValue; @@ -56,16 +57,27 @@ use serde_json::json; use std::collections::BTreeMap; use std::collections::HashMap; use std::path::PathBuf; +use std::sync::LazyLock; pub type JsonSchema = codex_tools::JsonSchema; #[cfg(test)] pub(crate) use codex_tools::mcp_call_tool_result_output_schema; -const TOOL_SEARCH_DESCRIPTION_TEMPLATE: &str = +const TOOL_SEARCH_DESCRIPTION_TEMPLATE_SOURCE: &str = include_str!("../../templates/search_tool/tool_description.md"); -const TOOL_SUGGEST_DESCRIPTION_TEMPLATE: &str = +const TOOL_SEARCH_DESCRIPTION_TEMPLATE_KEY: &str = "app_descriptions"; +static TOOL_SEARCH_DESCRIPTION_TEMPLATE: LazyLock