Change name of web search tool (#53573)

Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2026-04-09 17:47:24 -07:00 committed by GitHub
parent b3bc52e28c
commit 3436e51042
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 379 additions and 11 deletions

View file

@ -80,7 +80,7 @@ jobs:
# If assets/ changed, add crates that depend on those assets
if 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

View file

@ -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": {

View file

@ -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::Fetch

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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(),
),
);
}
}

View file

@ -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"

View file

@ -68,7 +68,7 @@ Reads the content of a specified file in the project, allowing access to file co
Allows 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.

View file

@ -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`.

View file

@ -57,7 +57,7 @@ Reads the content of a specified file in the project, allowing access to file co
Allows 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.

View file

@ -203,7 +203,7 @@ fn orchestrate_impl(rules: &[&PathCondition], target: OrchestrateTarget) -> Name
# If assets/ changed, add crates that depend on those assets
if 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