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
2026-09-16 21:30:56 +00:00
committed by copyberry
parent 29e6bc814e
commit a6d4741d39
20 changed files with 465 additions and 2 deletions

View File

@@ -6179,6 +6179,12 @@ class Tool(BaseModel):
title: str | None = None
class ToolExposureSurface(Enum):
code_mode = "code_mode"
deferred = "deferred"
direct = "direct"
class TurnDiffUpdatedNotification(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
@@ -6587,6 +6593,10 @@ class AppConfig(BaseModel):
links: Annotated[
AppLinksConfig | None, Field(description="Per-account approval settings keyed by link ID.")
] = None
omit_tools_from: Annotated[
list[ToolExposureSurface] | None,
Field(description="Additional model-facing surfaces omitted for this connector's tools."),
] = None
open_world_enabled: bool | None = None
tools: AppToolsConfig | None = None