mirror of
https://github.com/openai/codex.git
synced 2026-11-05 16:29:31 +00:00
chore: refactor name and namespace to single type (#17402)
avoid passing them both around, unify on a type. this now also keys `ToolRegistry`. tests pass
This commit is contained in:
1 parent
7a6266323c
commit
1325bcd3f6
32 files changed
+305
-191
No files matched your search
@@ -77,6 +77,7 @@ use codex_login::auth_env_telemetry::collect_auth_env_telemetry;
|
||||
use codex_login::default_client::originator;
|
||||
use codex_mcp::McpConnectionManager;
|
||||
use codex_mcp::SandboxState;
|
||||
use codex_mcp::ToolInfo;
|
||||
use codex_mcp::codex_apps_tools_cache_key;
|
||||
#[cfg(test)]
|
||||
use codex_models_manager::collaboration_mode_presets::CollaborationModesConfig;
|
||||
@@ -4412,25 +4413,16 @@ impl Session {
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn parse_mcp_tool_name(
|
||||
pub(crate) async fn resolve_mcp_tool_info(
|
||||
&self,
|
||||
name: &str,
|
||||
namespace: &Option<String>,
|
||||
) -> Option<(String, String)> {
|
||||
let tool_name = if let Some(namespace) = namespace {
|
||||
if name.starts_with(namespace.as_str()) {
|
||||
name
|
||||
} else {
|
||||
&format!("{namespace}{name}")
|
||||
}
|
||||
} else {
|
||||
name
|
||||
};
|
||||
namespace: Option<&str>,
|
||||
) -> Option<ToolInfo> {
|
||||
self.services
|
||||
.mcp_connection_manager
|
||||
.read()
|
||||
.await
|
||||
.parse_tool_name(tool_name)
|
||||
.resolve_tool_info(name, namespace)
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user