Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions codex-rs/core/src/connectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ pub fn connector_display_label(connector: &AppInfo) -> String {
}

pub fn connector_mention_slug(connector: &AppInfo) -> String {
sanitize_name(&connector_display_label(connector))
sanitize_slug(&connector_display_label(connector))
}

pub(crate) fn accessible_connectors_from_mcp_tools(
Expand Down Expand Up @@ -918,11 +918,15 @@ fn normalize_connector_value(value: Option<&str>) -> Option<String> {
}

pub fn connector_install_url(name: &str, connector_id: &str) -> String {
let slug = sanitize_name(name);
let slug = sanitize_slug(name);
format!("https://chatgpt.com/apps/{slug}/{connector_id}")
}

pub fn sanitize_name(name: &str) -> String {
sanitize_slug(name).replace("-", "_")
Comment thread
apanasenko-oai marked this conversation as resolved.
}

fn sanitize_slug(name: &str) -> String {
let mut normalized = String::with_capacity(name.len());
for character in name.chars() {
if character.is_ascii_alphanumeric() {
Expand Down
4 changes: 1 addition & 3 deletions codex-rs/core/src/mcp_connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,12 +1231,11 @@ fn normalize_codex_apps_tool_name(
return tool_name.to_string();
}

let tool_name = sanitize_name(tool_name).replace('-', "_");
let tool_name = sanitize_name(tool_name);

if let Some(connector_name) = connector_name
.map(str::trim)
.map(sanitize_name)
.map(|name| name.replace('-', "_"))
.filter(|name| !name.is_empty())
&& let Some(stripped) = tool_name.strip_prefix(&connector_name)
&& !stripped.is_empty()
Expand All @@ -1247,7 +1246,6 @@ fn normalize_codex_apps_tool_name(
if let Some(connector_id) = connector_id
.map(str::trim)
.map(sanitize_name)
.map(|name| name.replace('-', "_"))
.filter(|name| !name.is_empty())
&& let Some(stripped) = tool_name.strip_prefix(&connector_id)
&& !stripped.is_empty()
Expand Down
Loading