mirror of
https://github.com/openai/codex.git
synced 2026-12-01 00:20:48 +00:00
Add explicit app and account targets to MCP resource reads (#47248)
## What changed
Allow `mcpServer/resource/read` to specify `target: {connectorId, linkId}` for direct hosted app reads without tool discovery, when supported by the backend. Require an explicit `linkId`: a string selects an account, while `null` requests no-auth access subject to backend policy.
Restrict direct targets to `codex_apps` and reject empty connector IDs, empty link IDs, and synthetic link IDs. Preserve originating app/account scope when `originCallId` and `threadId` are supplied, and retain discovery when `target` is omitted.
Update protocol schemas and TypeScript and Python models, preserving required-but-nullable `linkId` semantics in Python code generation.
## Testing
Extend resource-read tests to check target metadata with and without a thread, including explicit no-auth targets and omitted targets. Add Python model tests for string and null `linkId` values and rejection of a missing `linkId`.
GitOrigin-RevId: 8cf5595fbdd937193aeb529901fc95299f6e18ad
This commit is contained in:
@@ -536,6 +536,18 @@ def test_generated_chatgpt_account_email_is_required_nullable() -> None:
|
||||
ChatgptAccount.model_validate({"planType": "pro", "type": "chatgpt"})
|
||||
|
||||
|
||||
@pytest.mark.parametrize("link_id", ["link_calendar", None])
|
||||
def test_generated_resource_read_target_requires_explicit_account(link_id: str | None) -> None:
|
||||
from openai_codex.generated.v2_all import McpResourceReadTarget
|
||||
|
||||
payload = {"connectorId": "calendar", "linkId": link_id}
|
||||
target = McpResourceReadTarget.model_validate(payload)
|
||||
assert target.model_dump(by_alias=True) == payload
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
McpResourceReadTarget.model_validate({"connectorId": "calendar"})
|
||||
|
||||
|
||||
def test_generated_inline_image_class_names_remain_stable() -> None:
|
||||
"""Keep the existing Python class names when image references expand."""
|
||||
from openai_codex.generated.v2_all import (
|
||||
|
||||
Reference in New Issue
Block a user