mirror of
https://github.com/openai/codex.git
synced 2026-05-04 11:26:33 +00:00
Add snippets annotated with types to tools when code mode enabled (#14284)
Main purpose is for code mode to understand the return type.
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::exec_env::create_env;
|
||||
use crate::features::Feature;
|
||||
use crate::function_tool::FunctionCallError;
|
||||
use crate::tools::ToolRouter;
|
||||
use crate::tools::code_mode_description::code_mode_tool_reference;
|
||||
use crate::tools::context::FunctionToolOutput;
|
||||
use crate::tools::context::SharedTurnDiffTracker;
|
||||
use crate::tools::context::ToolPayload;
|
||||
@@ -347,25 +348,6 @@ fn truncate_code_mode_result(
|
||||
|
||||
async fn build_enabled_tools(exec: &ExecContext) -> Vec<EnabledTool> {
|
||||
let router = build_nested_router(exec).await;
|
||||
let mcp_tool_names = exec
|
||||
.session
|
||||
.services
|
||||
.mcp_connection_manager
|
||||
.read()
|
||||
.await
|
||||
.list_all_tools()
|
||||
.await
|
||||
.into_iter()
|
||||
.map(|(qualified_name, tool_info)| {
|
||||
(
|
||||
qualified_name,
|
||||
(
|
||||
vec!["mcp".to_string(), tool_info.server_name],
|
||||
tool_info.tool_name,
|
||||
),
|
||||
)
|
||||
})
|
||||
.collect::<std::collections::HashMap<_, _>>();
|
||||
let mut out = Vec::new();
|
||||
for spec in router.specs() {
|
||||
let tool_name = spec.name().to_string();
|
||||
@@ -373,16 +355,12 @@ async fn build_enabled_tools(exec: &ExecContext) -> Vec<EnabledTool> {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (namespace, name) = if let Some((namespace, name)) = mcp_tool_names.get(&tool_name) {
|
||||
(namespace.clone(), name.clone())
|
||||
} else {
|
||||
(Vec::new(), tool_name.clone())
|
||||
};
|
||||
let reference = code_mode_tool_reference(&tool_name);
|
||||
|
||||
out.push(EnabledTool {
|
||||
tool_name,
|
||||
namespace,
|
||||
name,
|
||||
namespace: reference.namespace,
|
||||
name: reference.tool_key,
|
||||
kind: tool_kind_for_spec(&spec),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user