Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions codex-rs/core/src/tools/handlers/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub struct DynamicToolHandler {
tool_name: ToolName,
spec: ToolSpec,
exposure: ToolExposure,
search_text: String,
}

impl DynamicToolHandler {
Expand All @@ -56,7 +55,6 @@ impl DynamicToolHandler {
} else {
ToolExposure::Direct
},
search_text: build_dynamic_search_text(tool),
})
}
}
Expand All @@ -75,8 +73,7 @@ impl ToolExecutor<ToolInvocation> for DynamicToolHandler {
}

fn search_info(&self) -> Option<ToolSearchInfo> {
ToolSearchInfo::from_spec(
self.search_text.clone(),
ToolSearchInfo::from_tool_spec(
self.spec(),
Some(ToolSearchSourceInfo {
name: "Dynamic tools".to_string(),
Expand Down Expand Up @@ -217,27 +214,3 @@ async fn request_dynamic_tool(

response
}

fn build_dynamic_search_text(tool: &DynamicToolSpec) -> String {
let mut schema_properties = tool
.input_schema
.get("properties")
.and_then(serde_json::Value::as_object)
.map(|map| map.keys().cloned().collect::<Vec<_>>())
.unwrap_or_default();
schema_properties.sort();
let mut parts = vec![
tool.name.clone(),
tool.name.replace('_', " "),
tool.description.clone(),
];
if let Some(namespace) = &tool.namespace {
parts.push(namespace.clone());
}
parts.extend(schema_properties);
parts.join(" ")
}

#[cfg(test)]
#[path = "dynamic_tests.rs"]
mod tests;
36 changes: 0 additions & 36 deletions codex-rs/core/src/tools/handlers/dynamic_tests.rs

This file was deleted.

Loading