Compare commits

...

4 Commits

Author SHA1 Message Date
shijie-openai
d453547494 still iterating 2026-01-15 15:03:21 -08:00
shijie-openai
e486bfaa2f tool name update 2026-01-15 11:37:07 -08:00
shijie-openai
7bc2f66f15 Prompt update 2026-01-15 11:28:25 -08:00
shijie-openai
326547dfe8 Chore: mcp prompt intervention 2026-01-14 22:42:58 -08:00
12 changed files with 97 additions and 56 deletions

View File

@@ -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),

View File

@@ -78,3 +78,9 @@ You are producing plain text that will later be styled by the CLI. Follow these
* Do not use URIs like file://, vscode://, or https://.
* Do not provide range of lines
* Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\repo\project\main.rs:12:5
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -78,3 +78,9 @@ You are producing plain text that will later be styled by the CLI. Follow these
* Do not use URIs like file://, vscode://, or https://.
* Do not provide range of lines
* Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\repo\project\main.rs:12:5
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -329,3 +329,9 @@ To create a new plan, call `update_plan` with a short list of 1sentence steps
When steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.
If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -296,3 +296,9 @@ To create a new plan, call `update_plan` with a short list of 1sentence steps
When steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.
If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -66,3 +66,9 @@ You are producing plain text that will later be styled by the CLI. Follow these
* Do not use URIs like file://, vscode://, or https://.
* Do not provide range of lines
* Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\repo\project\main.rs:12:5
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -273,3 +273,9 @@ To create a new plan, call `update_plan` with a short list of 1sentence steps
When steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.
If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.

View File

@@ -274,6 +274,11 @@ When steps have been completed, use `update_plan` to mark each finished step as
If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
## 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 `mcp_list_resources` and resource templates via `mcp_list_resource_templates`.
## `apply_patch`
Use the `apply_patch` shell command to edit files.

View File

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

View File

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

View File

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

View File

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