Add per-app tool exposure configuration (#46035)

## Why

Server-level tool exposure settings apply to every connector on the apps server. Individual connectors need a way to opt out of deferred discovery without changing exposure for other apps.

## What changed

Add `apps.<connector_id>.omit_tools_from` with support for `code_mode`, `deferred`, and `direct`. Combine connector omissions with server omissions so app settings preserve server restrictions.

For example, `omit_tools_from = ["deferred"]` makes a connector's tools available without tool search, through direct calls or Code Mode as permitted by the active tool mode and remaining restrictions.

Expose the setting in the app-server protocol, JSON schemas, and generated TypeScript and Python types.

## Testing

Add integration coverage for connector-specific exposure and MCP dispatch across tool modes, server restrictions, and direct-only namespaces. Extend config tests to cover populated, absent, and empty omission lists, and add a Code Mode request-history snapshot.

GitOrigin-RevId: cc99ab290c8a878d06d8d7ccf2d1dbd7c46bfa8a
This commit is contained in:
ptiet-oai authored and copyberry committed 2026-09-16 21:50:07 +00:00
1 parent 29e6bc814e
commit a6d4741d39
20 files changed
+465 -2

No files matched your search

@@ -42,6 +42,7 @@ use codex_app_server_protocol::SandboxMode;
use codex_app_server_protocol::ToolsV2;
use codex_app_server_protocol::WriteStatus;
use codex_core::config::set_project_trust_level;
use codex_protocol::config_types::ToolExposureSurface;
use codex_protocol::config_types::TrustLevel;
use codex_protocol::config_types::WebSearchContextSize;
use codex_protocol::config_types::WebSearchLocation;
@@ -1021,6 +1022,7 @@ default_tools_approval_mode = "writes"
[apps.app1]
enabled = false
omit_tools_from = ["deferred"]
approvals_reviewer = "user"
destructive_enabled = false
default_tools_approval_mode = "prompt"
@@ -1035,6 +1037,9 @@ default_tools_approval_mode = "writes"
[apps.app_without_links]
enabled = true
[apps.app_with_empty_links]
omit_tools_from = []
[apps.app_with_empty_links.links]
"#,
)?;
@@ -1084,6 +1089,7 @@ enabled = true
"app1".to_string(),
AppConfig {
enabled: false,
omit_tools_from: Some(vec![ToolExposureSurface::Deferred]),
approvals_reviewer: Some(ApprovalsReviewer::User),
destructive_enabled: Some(false),
open_world_enabled: None,
@@ -1114,6 +1120,7 @@ enabled = true
"app_without_links".to_string(),
AppConfig {
enabled: true,
omit_tools_from: None,
approvals_reviewer: None,
destructive_enabled: None,
open_world_enabled: None,
@@ -1127,6 +1134,7 @@ enabled = true
"app_with_empty_links".to_string(),
AppConfig {
enabled: true,
omit_tools_from: Some(vec![]),
approvals_reviewer: None,
destructive_enabled: None,
open_world_enabled: None,