agent tools namespaced and legacy aliases preserved

This commit is contained in:
Friel
2026-04-01 00:03:28 +00:00
parent 6f9721ada1
commit 7998133005
+19
View File
@@ -249,6 +249,25 @@ fn find_namespaced_tool<'a>(
.expect("expected tool in namespace")
}
fn find_namespaced_tool<'a>(
tools: &'a [ConfiguredToolSpec],
namespace: &str,
expected_name: &str,
) -> &'a ResponsesApiTool {
let namespace_tool = find_tool(tools, namespace);
let ToolSpec::Namespace(namespace) = &namespace_tool.spec else {
panic!("expected {namespace} namespace tool");
};
namespace
.tools
.iter()
.find_map(|tool| match tool {
ResponsesApiNamespaceTool::Function(tool) if tool.name == expected_name => Some(tool),
_ => None,
})
.expect("expected tool in namespace")
}
fn strip_descriptions_schema(schema: &mut JsonSchema) {
match schema {
JsonSchema::Boolean { description }