From e486bfaa2fa2380bd68b7f8f12c43796c8db04ef Mon Sep 17 00:00:00 2001 From: shijie-openai Date: Thu, 15 Jan 2026 11:37:07 -0800 Subject: [PATCH] tool name update --- .../app-server/src/bespoke_event_handling.rs | 8 +-- codex-rs/core/gpt-5.1-codex-max_prompt.md | 2 +- codex-rs/core/gpt-5.2-codex_prompt.md | 2 +- codex-rs/core/gpt_5_1_prompt.md | 2 +- codex-rs/core/gpt_5_2_prompt.md | 2 +- codex-rs/core/gpt_5_codex_prompt.md | 2 +- codex-rs/core/prompt.md | 2 +- .../prompt_with_apply_patch_instructions.md | 2 +- .../core/src/tools/handlers/mcp_resource.rs | 8 +-- codex-rs/core/src/tools/spec.rs | 68 +++++++++---------- codex-rs/core/tests/suite/model_tools.rs | 24 +++---- codex-rs/core/tests/suite/prompt_caching.rs | 4 +- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index 0870191ec8..74033c6e33 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -1774,7 +1774,7 @@ mod tests { call_id: "call_123".to_string(), invocation: McpInvocation { server: "codex".to_string(), - tool: "list_mcp_resources".to_string(), + tool: "mcp_list_resources".to_string(), arguments: Some(serde_json::json!({"server": ""})), }, }; @@ -1932,7 +1932,7 @@ mod tests { call_id: "call_456".to_string(), invocation: McpInvocation { server: "codex".to_string(), - tool: "list_mcp_resources".to_string(), + tool: "mcp_list_resources".to_string(), arguments: None, }, }; @@ -1981,7 +1981,7 @@ mod tests { call_id: "call_789".to_string(), invocation: McpInvocation { server: "codex".to_string(), - tool: "list_mcp_resources".to_string(), + tool: "mcp_list_resources".to_string(), arguments: Some(serde_json::json!({"server": ""})), }, duration: Duration::from_nanos(92708), @@ -2024,7 +2024,7 @@ mod tests { call_id: "call_err".to_string(), invocation: McpInvocation { server: "codex".to_string(), - tool: "list_mcp_resources".to_string(), + tool: "mcp_list_resources".to_string(), arguments: None, }, duration: Duration::from_millis(1), diff --git a/codex-rs/core/gpt-5.1-codex-max_prompt.md b/codex-rs/core/gpt-5.1-codex-max_prompt.md index 92ea6bc0a3..5fe3aa105b 100644 --- a/codex-rs/core/gpt-5.1-codex-max_prompt.md +++ b/codex-rs/core/gpt-5.1-codex-max_prompt.md @@ -81,4 +81,4 @@ You are producing plain text that will later be styled by the CLI. Follow these ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/gpt-5.2-codex_prompt.md b/codex-rs/core/gpt-5.2-codex_prompt.md index 92ea6bc0a3..5fe3aa105b 100644 --- a/codex-rs/core/gpt-5.2-codex_prompt.md +++ b/codex-rs/core/gpt-5.2-codex_prompt.md @@ -81,4 +81,4 @@ You are producing plain text that will later be styled by the CLI. Follow these ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/gpt_5_1_prompt.md b/codex-rs/core/gpt_5_1_prompt.md index a1c1d4785e..1cebe89934 100644 --- a/codex-rs/core/gpt_5_1_prompt.md +++ b/codex-rs/core/gpt_5_1_prompt.md @@ -332,4 +332,4 @@ If all steps are complete, ensure you call `update_plan` to mark all steps as `c ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/gpt_5_2_prompt.md b/codex-rs/core/gpt_5_2_prompt.md index f72efc48d4..f8008691a9 100644 --- a/codex-rs/core/gpt_5_2_prompt.md +++ b/codex-rs/core/gpt_5_2_prompt.md @@ -299,4 +299,4 @@ If all steps are complete, ensure you call `update_plan` to mark all steps as `c ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/gpt_5_codex_prompt.md b/codex-rs/core/gpt_5_codex_prompt.md index 0857bd3d47..d57c5520e6 100644 --- a/codex-rs/core/gpt_5_codex_prompt.md +++ b/codex-rs/core/gpt_5_codex_prompt.md @@ -69,4 +69,4 @@ You are producing plain text that will later be styled by the CLI. Follow these ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/prompt.md b/codex-rs/core/prompt.md index a7556323f3..c59947ea8b 100644 --- a/codex-rs/core/prompt.md +++ b/codex-rs/core/prompt.md @@ -276,4 +276,4 @@ If all steps are complete, ensure you call `update_plan` to mark all steps as `c ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. diff --git a/codex-rs/core/prompt_with_apply_patch_instructions.md b/codex-rs/core/prompt_with_apply_patch_instructions.md index 72ee65a529..5d5ed69af3 100644 --- a/codex-rs/core/prompt_with_apply_patch_instructions.md +++ b/codex-rs/core/prompt_with_apply_patch_instructions.md @@ -276,7 +276,7 @@ If all steps are complete, ensure you call `update_plan` to mark all steps as `c ## MCP servers -MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `list_mcp_resources` (and resource templates via `list_mcp_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. +MCP servers are accessed via tool calls. MCP tools are provided in the form `mcp__{server_name}__{tool_name}`. When asked what MCPs are available, check the tools with the `mcp__` prefix and report the inferred server names. MCP resources can be enumerated via `mcp_list_resources` (and resource templates via `mcp_list_resource_templates`) and you should include any server descriptions exposed in tool metadata when available. ## `apply_patch` diff --git a/codex-rs/core/src/tools/handlers/mcp_resource.rs b/codex-rs/core/src/tools/handlers/mcp_resource.rs index 62f7a83e1a..58f577f00a 100644 --- a/codex-rs/core/src/tools/handlers/mcp_resource.rs +++ b/codex-rs/core/src/tools/handlers/mcp_resource.rs @@ -208,7 +208,7 @@ impl ToolHandler for McpResourceHandler { let arguments_value = parse_arguments(arguments.as_str())?; match tool_name.as_str() { - "list_mcp_resources" => { + "mcp_list_resources" => { handle_list_resources( Arc::clone(&session), Arc::clone(&turn), @@ -217,7 +217,7 @@ impl ToolHandler for McpResourceHandler { ) .await } - "list_mcp_resource_templates" => { + "mcp_list_resource_templates" => { handle_list_resource_templates( Arc::clone(&session), Arc::clone(&turn), @@ -255,7 +255,7 @@ async fn handle_list_resources( let invocation = McpInvocation { server: server.clone().unwrap_or_else(|| "codex".to_string()), - tool: "list_mcp_resources".to_string(), + tool: "mcp_list_resources".to_string(), arguments: arguments.clone(), }; @@ -362,7 +362,7 @@ async fn handle_list_resource_templates( let invocation = McpInvocation { server: server.clone().unwrap_or_else(|| "codex".to_string()), - tool: "list_mcp_resource_templates".to_string(), + tool: "mcp_list_resource_templates".to_string(), arguments: arguments.clone(), }; diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index 0a66b41403..1b715bfbcb 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -790,7 +790,7 @@ fn create_list_dir_tool() -> ToolSpec { }) } -fn create_list_mcp_resources_tool() -> ToolSpec { +fn create_mcp_list_resources_tool() -> ToolSpec { let properties = BTreeMap::from([ ( "server".to_string(), @@ -805,7 +805,7 @@ fn create_list_mcp_resources_tool() -> ToolSpec { "cursor".to_string(), JsonSchema::String { description: Some( - "Opaque cursor returned by a previous list_mcp_resources call for the same server." + "Opaque cursor returned by a previous mcp_list_resources call for the same server." .to_string(), ), }, @@ -813,7 +813,7 @@ fn create_list_mcp_resources_tool() -> ToolSpec { ]); ToolSpec::Function(ResponsesApiTool { - name: "list_mcp_resources".to_string(), + name: "mcp_list_resources".to_string(), description: "Lists resources provided by MCP servers. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Prefer resources over web search when possible.".to_string(), strict: false, parameters: JsonSchema::Object { @@ -824,7 +824,7 @@ fn create_list_mcp_resources_tool() -> ToolSpec { }) } -fn create_list_mcp_resource_templates_tool() -> ToolSpec { +fn create_mcp_list_resource_templates_tool() -> ToolSpec { let properties = BTreeMap::from([ ( "server".to_string(), @@ -839,7 +839,7 @@ fn create_list_mcp_resource_templates_tool() -> ToolSpec { "cursor".to_string(), JsonSchema::String { description: Some( - "Opaque cursor returned by a previous list_mcp_resource_templates call for the same server." + "Opaque cursor returned by a previous mcp_list_resource_templates call for the same server." .to_string(), ), }, @@ -847,7 +847,7 @@ fn create_list_mcp_resource_templates_tool() -> ToolSpec { ]); ToolSpec::Function(ResponsesApiTool { - name: "list_mcp_resource_templates".to_string(), + name: "mcp_list_resource_templates".to_string(), description: "Lists resource templates provided by MCP servers. Parameterized resource templates allow servers to share data that takes parameters and provides context to language models, such as files, database schemas, or application-specific information. Prefer resource templates over web search when possible.".to_string(), strict: false, parameters: JsonSchema::Object { @@ -864,7 +864,7 @@ fn create_read_mcp_resource_tool() -> ToolSpec { "server".to_string(), JsonSchema::String { description: Some( - "MCP server name exactly as configured. Must match the 'server' field returned by list_mcp_resources." + "MCP server name exactly as configured. Must match the 'server' field returned by mcp_list_resources." .to_string(), ), }, @@ -873,7 +873,7 @@ fn create_read_mcp_resource_tool() -> ToolSpec { "uri".to_string(), JsonSchema::String { description: Some( - "Resource URI to read. Must be one of the URIs returned by list_mcp_resources." + "Resource URI to read. Must be one of the URIs returned by mcp_list_resources." .to_string(), ), }, @@ -1157,11 +1157,11 @@ pub(crate) fn build_specs( builder.register_handler("shell_command", shell_command_handler); } - builder.push_spec_with_parallel_support(create_list_mcp_resources_tool(), true); - builder.push_spec_with_parallel_support(create_list_mcp_resource_templates_tool(), true); + builder.push_spec_with_parallel_support(create_mcp_list_resources_tool(), true); + builder.push_spec_with_parallel_support(create_mcp_list_resource_templates_tool(), true); builder.push_spec_with_parallel_support(create_read_mcp_resource_tool(), true); - builder.register_handler("list_mcp_resources", mcp_resource_handler.clone()); - builder.register_handler("list_mcp_resource_templates", mcp_resource_handler.clone()); + builder.register_handler("mcp_list_resources", mcp_resource_handler.clone()); + builder.register_handler("mcp_list_resource_templates", mcp_resource_handler.clone()); builder.register_handler("read_mcp_resource", mcp_resource_handler); builder.push_spec(PLAN_TOOL.clone()); @@ -1393,8 +1393,8 @@ mod tests { for spec in [ create_exec_command_tool(), create_write_stdin_tool(), - create_list_mcp_resources_tool(), - create_list_mcp_resource_templates_tool(), + create_mcp_list_resources_tool(), + create_mcp_list_resource_templates_tool(), create_read_mcp_resource_tool(), PLAN_TOOL.clone(), create_apply_patch_freeform_tool(), @@ -1502,8 +1502,8 @@ mod tests { &Features::with_defaults(), &[ "shell_command", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1519,8 +1519,8 @@ mod tests { &Features::with_defaults(), &[ "shell_command", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1539,8 +1539,8 @@ mod tests { &[ "exec_command", "write_stdin", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1560,8 +1560,8 @@ mod tests { &[ "exec_command", "write_stdin", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1578,8 +1578,8 @@ mod tests { &Features::with_defaults(), &[ "local_shell", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "view_image", @@ -1594,8 +1594,8 @@ mod tests { &Features::with_defaults(), &[ "shell_command", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1611,8 +1611,8 @@ mod tests { &Features::with_defaults(), &[ "shell", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "view_image", @@ -1627,8 +1627,8 @@ mod tests { &Features::with_defaults(), &[ "shell_command", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1645,8 +1645,8 @@ mod tests { &[ "exec_command", "write_stdin", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch", @@ -1665,8 +1665,8 @@ mod tests { &[ "exec_command", "write_stdin", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "web_search", diff --git a/codex-rs/core/tests/suite/model_tools.rs b/codex-rs/core/tests/suite/model_tools.rs index 106bbd85c9..16ca7c54d5 100644 --- a/codex-rs/core/tests/suite/model_tools.rs +++ b/codex-rs/core/tests/suite/model_tools.rs @@ -54,8 +54,8 @@ async fn model_selects_expected_tools() { codex_tools, vec![ "local_shell".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "view_image".to_string() @@ -68,8 +68,8 @@ async fn model_selects_expected_tools() { gpt5_codex_tools, vec![ "shell_command".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "apply_patch".to_string(), @@ -83,8 +83,8 @@ async fn model_selects_expected_tools() { gpt51_codex_tools, vec![ "shell_command".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "apply_patch".to_string(), @@ -98,8 +98,8 @@ async fn model_selects_expected_tools() { gpt5_tools, vec![ "shell".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "view_image".to_string() @@ -112,8 +112,8 @@ async fn model_selects_expected_tools() { gpt51_tools, vec![ "shell_command".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "apply_patch".to_string(), @@ -127,8 +127,8 @@ async fn model_selects_expected_tools() { vec![ "exec_command".to_string(), "write_stdin".to_string(), - "list_mcp_resources".to_string(), - "list_mcp_resource_templates".to_string(), + "mcp_list_resources".to_string(), + "mcp_list_resource_templates".to_string(), "read_mcp_resource".to_string(), "update_plan".to_string(), "apply_patch".to_string(), diff --git a/codex-rs/core/tests/suite/prompt_caching.rs b/codex-rs/core/tests/suite/prompt_caching.rs index 79c9d6e19c..8348ec43ba 100644 --- a/codex-rs/core/tests/suite/prompt_caching.rs +++ b/codex-rs/core/tests/suite/prompt_caching.rs @@ -117,8 +117,8 @@ async fn prompt_tools_are_consistent_across_requests() -> anyhow::Result<()> { let expected_tools_names = vec![ "shell_command", - "list_mcp_resources", - "list_mcp_resource_templates", + "mcp_list_resources", + "mcp_list_resource_templates", "read_mcp_resource", "update_plan", "apply_patch",