Always put Code Mode tool descriptions before namespace descriptions (#57462)

## What changed

Make tool descriptions precede namespace descriptions in Code Mode execution and tool search. Mark `code_mode_tool_description_first` as removed and simplify cached definitions to depend only on the input schema budget.

## Testing

Update Code Mode integration assertions and catalog snapshots to expect tool descriptions before namespace descriptions.

GitOrigin-RevId: 1344d4c264d1d2b18ee0388a064b6813ca81f770
This commit is contained in:
swastik-oai
2026-10-27 14:14:16 +00:00
committed by copyberry
parent 50983c7a93
commit 2ebf42f269
11 changed files with 35 additions and 105 deletions
+2 -6
View File
@@ -90,7 +90,6 @@ pub fn tool_spec_to_code_mode_tool_definition(spec: &ToolSpec) -> Option<CodeMod
pub fn collect_code_mode_tool_definitions<'a>(
specs: impl IntoIterator<Item = &'a ToolSpec>,
code_mode_input_schema_max_bytes: Option<usize>,
tool_description_first: bool,
) -> Vec<CodeModeToolDefinition> {
let mut tool_definitions = specs
.into_iter()
@@ -101,11 +100,8 @@ pub fn collect_code_mode_tool_definitions<'a>(
let namespace_description = namespace.description.trim();
if !namespace_description.is_empty() {
for definition in &mut definitions {
definition.description = if tool_description_first {
format!("{}\n\n{namespace_description}", definition.description)
} else {
format!("{namespace_description}\n\n{}", definition.description)
};
definition.description =
format!("{}\n\n{namespace_description}", definition.description);
}
}
}