Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Change name of web search tool (#53573)
Mikayla Maki3436e510420e
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 2fee8b3ae9f..a1e15e7beb8 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -80,7 +80,7 @@ jobs:# If assets/ changed, add crates that depend on those assetsif echo "$CHANGED_FILES" | grep -qP '^assets/'; then- FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)+ FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "assets" | sort -u)fi# Combine all changed packagesdiff --git a/assets/settings/default.json b/assets/settings/default.jsonindex 56dff8b2ad6..799a34d6a6f 100644--- a/assets/settings/default.json+++ b/assets/settings/default.json@@ -1075,7 +1075,7 @@"terminal": true,"thinking": true,"update_plan": true,- "web_search": true,+ "search_web": true,},},"ask": {@@ -1095,7 +1095,7 @@"spawn_agent": true,"thinking": true,"update_plan": true,- "web_search": true,+ "search_web": true,},},"minimal": {diff --git a/crates/agent/src/tools/web_search_tool.rs b/crates/agent/src/tools/web_search_tool.rsindex c697a5b78f1..75d7689fd7c 100644--- a/crates/agent/src/tools/web_search_tool.rs+++ b/crates/agent/src/tools/web_search_tool.rs@@ -53,7 +53,7 @@ impl AgentTool for WebSearchTool {type Input = WebSearchToolInput;type Output = WebSearchToolOutput;- const NAME: &'static str = "web_search";+ const NAME: &'static str = "search_web";fn kind() -> acp::ToolKind {acp::ToolKind::Fetchdiff --git a/crates/migrator/src/migrations.rs b/crates/migrator/src/migrations.rsindex 625bd27e91e..ed9c6ff5151 100644--- a/crates/migrator/src/migrations.rs+++ b/crates/migrator/src/migrations.rs@@ -328,3 +328,9 @@ pub(crate) mod m_2026_04_01 {pub(crate) use settings::restructure_profiles_with_settings_key;}++pub(crate) mod m_2026_04_10 {+ mod settings;++ pub(crate) use settings::rename_web_search_to_search_web;+}diff --git a/crates/migrator/src/migrations/m_2026_04_10/settings.rs b/crates/migrator/src/migrations/m_2026_04_10/settings.rsnew file mode 100644index 00000000000..54305231494--- /dev/null+++ b/crates/migrator/src/migrations/m_2026_04_10/settings.rs@@ -0,0 +1,64 @@+use anyhow::Result;+use serde_json::Value;++use crate::migrations::migrate_settings;++const AGENT_KEY: &str = "agent";+const PROFILES_KEY: &str = "profiles";+const SETTINGS_KEY: &str = "settings";+const TOOL_PERMISSIONS_KEY: &str = "tool_permissions";+const TOOLS_KEY: &str = "tools";+const OLD_TOOL_NAME: &str = "web_search";+const NEW_TOOL_NAME: &str = "search_web";++pub fn rename_web_search_to_search_web(value: &mut Value) -> Result<()> {+ migrate_settings(value, &mut migrate_one)+}++fn migrate_one(object: &mut serde_json::Map<String, Value>) -> Result<()> {+ migrate_agent_value(object)?;++ // Root-level profiles have a `settings` wrapper after m_2026_04_01,+ // but `migrate_settings` calls us with the profile map directly,+ // so we need to look inside `settings` too.+ if let Some(settings) = object.get_mut(SETTINGS_KEY).and_then(|v| v.as_object_mut()) {+ migrate_agent_value(settings)?;+ }++ Ok(())+}++fn migrate_agent_value(object: &mut serde_json::Map<String, Value>) -> Result<()> {+ let Some(agent) = object.get_mut(AGENT_KEY).and_then(|v| v.as_object_mut()) else {+ return Ok(());+ };++ if let Some(tools) = agent+ .get_mut(TOOL_PERMISSIONS_KEY)+ .and_then(|v| v.as_object_mut())+ .and_then(|tp| tp.get_mut(TOOLS_KEY))+ .and_then(|v| v.as_object_mut())+ {+ rename_key(tools);+ }++ if let Some(profiles) = agent.get_mut(PROFILES_KEY).and_then(|v| v.as_object_mut()) {+ for (_profile_name, profile) in profiles.iter_mut() {+ if let Some(tools) = profile+ .as_object_mut()+ .and_then(|p| p.get_mut(TOOLS_KEY))+ .and_then(|v| v.as_object_mut())+ {+ rename_key(tools);+ }+ }+ }++ Ok(())+}++fn rename_key(tools: &mut serde_json::Map<String, Value>) {+ if let Some(value) = tools.remove(OLD_TOOL_NAME) {+ tools.insert(NEW_TOOL_NAME.to_string(), value);+ }+}diff --git a/crates/migrator/src/migrator.rs b/crates/migrator/src/migrator.rsindex f49d102213c..4a9873f9b57 100644--- a/crates/migrator/src/migrator.rs+++ b/crates/migrator/src/migrator.rs@@ -249,6 +249,7 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {),MigrationType::Json(migrations::m_2026_03_30::make_play_sound_when_agent_done_an_enum),MigrationType::Json(migrations::m_2026_04_01::restructure_profiles_with_settings_key),+ MigrationType::Json(migrations::m_2026_04_10::rename_web_search_to_search_web),];run_migrations(text, migrations)}@@ -4682,4 +4683,301 @@ mod tests {None,);}++ #[test]+ fn test_rename_web_search_to_search_web_in_tool_permissions() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "agent": {+ "tool_permissions": {+ "tools": {+ "web_search": {+ "allow": true+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "allow": true+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_in_profiles() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "agent": {+ "profiles": {+ "write": {+ "tools": {+ "web_search": false+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "agent": {+ "profiles": {+ "write": {+ "tools": {+ "search_web": false+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_no_change_when_already_migrated() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "allow": true+ }+ }+ }+ }+ }+ "#+ .unindent(),+ None,+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_no_clobber() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "agent": {+ "tool_permissions": {+ "tools": {+ "web_search": {+ "allow": false+ },+ "search_web": {+ "allow": true+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "allow": false+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_platform_override() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "linux": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "web_search": {+ "allow": true+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "linux": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "allow": true+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_release_channel_override() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "nightly": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "web_search": {+ "default": "allow"+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "nightly": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "default": "allow"+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_no_agent() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "buffer_font_size": 14+ }+ "#+ .unindent(),+ None,+ );+ }++ #[test]+ fn test_rename_web_search_to_search_web_root_level_profile() {+ assert_migrate_with_migrations(+ &[MigrationType::Json(+ migrations::m_2026_04_10::rename_web_search_to_search_web,+ )],+ &r#"+ {+ "profiles": {+ "Work": {+ "settings": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "web_search": {+ "default": "allow"+ }+ }+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ Some(+ &r#"+ {+ "profiles": {+ "Work": {+ "settings": {+ "agent": {+ "tool_permissions": {+ "tools": {+ "search_web": {+ "default": "allow"+ }+ }+ }+ }+ }+ }+ }+ }+ "#+ .unindent(),+ ),+ );+ }}diff --git a/crates/settings_ui/src/pages/tool_permissions_setup.rs b/crates/settings_ui/src/pages/tool_permissions_setup.rsindex 61d6c8c6f4c..bbfcd1849dd 100644--- a/crates/settings_ui/src/pages/tool_permissions_setup.rs+++ b/crates/settings_ui/src/pages/tool_permissions_setup.rs@@ -69,7 +69,7 @@ const TOOLS: &[ToolInfo] = &[regex_explanation: "Patterns are matched against the URL being fetched.",},ToolInfo {- id: "web_search",+ id: "search_web",name: "Web Search",description: "Web search queries",regex_explanation: "Patterns are matched against the search query.",@@ -309,7 +309,7 @@ fn get_tool_render_fn("create_directory" => render_create_directory_tool_config,"save_file" => render_save_file_tool_config,"fetch" => render_fetch_tool_config,- "web_search" => render_web_search_tool_config,+ "search_web" => render_web_search_tool_config,"restore_file_from_disk" => render_restore_file_from_disk_tool_config,_ => render_terminal_tool_config, // fallback}@@ -1389,7 +1389,7 @@ tool_config_page_fn!(render_move_path_tool_config, "move_path");tool_config_page_fn!(render_create_directory_tool_config, "create_directory");tool_config_page_fn!(render_save_file_tool_config, "save_file");tool_config_page_fn!(render_fetch_tool_config, "fetch");-tool_config_page_fn!(render_web_search_tool_config, "web_search");+tool_config_page_fn!(render_web_search_tool_config, "search_web");tool_config_page_fn!(render_restore_file_from_disk_tool_config,"restore_file_from_disk"diff --git a/docs/.doc-examples/reference.md b/docs/.doc-examples/reference.mdindex ce774e02c8e..5b250fc0047 100644--- a/docs/.doc-examples/reference.md+++ b/docs/.doc-examples/reference.md@@ -68,7 +68,7 @@ Reads the content of a specified file in the project, allowing access to file coAllows the Agent to work through problems, brainstorm ideas, or plan without executing actions, useful for complex problem-solving.-### `web_search` {#web-search}+### `search_web` {#search-web}Searches the web for information, providing results with snippets and links from relevant web pages, useful for accessing real-time information.diff --git a/docs/src/ai/tool-permissions.md b/docs/src/ai/tool-permissions.mdindex 27ee114e343..61d599a9d1e 100644--- a/docs/src/ai/tool-permissions.md+++ b/docs/src/ai/tool-permissions.md@@ -54,7 +54,7 @@ The `tool_permissions` setting lets you customize tool permissions by specifying| `restore_file_from_disk` | The file paths || `save_file` | The file paths || `fetch` | The URL |-| `web_search` | The search query |+| `search_web` | The search query |For MCP tools, use the format `mcp:<server>:<tool_name>`.For example, a tool called `create_issue` on a server called `github` would be `mcp:github:create_issue`.diff --git a/docs/src/ai/tools.md b/docs/src/ai/tools.mdindex bc57f3c378f..3ada0ce0259 100644--- a/docs/src/ai/tools.md+++ b/docs/src/ai/tools.md@@ -57,7 +57,7 @@ Reads the content of a specified file in the project, allowing access to file coAllows the Agent to work through problems, brainstorm ideas, or plan without executing actions, useful for complex problem-solving.-### `web_search`+### `search_web`Searches the web for information, providing results with snippets and links from relevant web pages, useful for accessing real-time information.diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rsindex 4d936b89ff7..b8d6e063607 100644--- a/tooling/xtask/src/tasks/workflows/run_tests.rs+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs@@ -203,7 +203,7 @@ fn orchestrate_impl(rules: &[&PathCondition], target: OrchestrateTarget) -> Name# If assets/ changed, add crates that depend on those assetsif echo "$CHANGED_FILES" | grep -qP '^assets/'; then- FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "storybook" "assets" | sort -u)+ FILE_CHANGED_PKGS=$(printf '%s\n%s\n%s' "$FILE_CHANGED_PKGS" "settings" "assets" | sort -u)fi# Combine all changed packages