Files
codex/codex-rs/tools/src/tool_discovery_tests.rs
T
jif ecb223f525 Remove the connector dependency from codex-tools (#63929)
## What changed

Have core pass connector IDs, names, descriptions, and install URLs
through `DiscoverableConnectorInfo` for tool discovery and install
prompts. Move installation verification into the core handler, where it
checks accessibility using `AppInfo`.

Enable `serde_json`'s `arbitrary_precision` feature directly in
`codex-tools` to preserve large numbers in tool arguments and results.

## Testing

Cover install verification for accessible, inaccessible, and missing
connectors, including an accessible connector that is disabled.

GitOrigin-RevId: fd84e8e9b739d86658396e17e4dcd7b48a4b2fdd
2026-11-25 14:34:40 +00:00

48 lines
1.5 KiB
Rust

use super::*;
use pretty_assertions::assert_eq;
use serde_json::json;
#[test]
fn discoverable_tool_enums_use_expected_wire_names() {
assert_eq!(
json!({
"tool_type": DiscoverableToolType::Connector,
"action_type": DiscoverableToolAction::Install,
}),
json!({
"tool_type": "connector",
"action_type": "install",
})
);
}
#[test]
fn filter_request_plugin_install_discoverable_tools_for_codex_tui_omits_plugins() {
let connector = DiscoverableTool::from(DiscoverableConnectorInfo {
id: "connector_google_calendar".to_string(),
name: "Google Calendar".to_string(),
description: Some("Plan events and schedules.".to_string()),
install_url: Some("https://example.test/google-calendar".to_string()),
});
let discoverable_tools = vec![
connector.clone(),
DiscoverableTool::Plugin(Box::new(DiscoverablePluginInfo {
id: "slack@openai-curated".to_string(),
remote_plugin_id: None,
name: "Slack".to_string(),
description: Some("Search Slack messages".to_string()),
has_skills: true,
mcp_server_names: vec!["slack".to_string()],
app_connector_ids: vec!["connector_slack".to_string()],
})),
];
assert_eq!(
filter_request_plugin_install_discoverable_tools_for_client(
discoverable_tools,
Some("codex-tui"),
),
vec![connector]
);
}