fix(docs): improve OpenAI migration guide accuracy (#349)

- Add missing setOpenInAppUrl API to 'Not Yet in MCP Apps' section
- Clarify Event Handling table: specify exact OpenAI properties
  (toolInput/toolOutput) instead of vague 'window.openai.*'
- Improve notes to distinguish sync property reads vs callbacks
This commit is contained in:
Liad Yosef 2026-01-25 19:03:43 +02:00 • committed by GitHub
commit 82a1353f09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -291,16 +291,17 @@ Client-side migration involves replacing the implicit `window.openai` global wit
| ------------------------------------------- | -------- | ------------------- |
| `await window.openai.requestModal(options)` | — | Not yet implemented |
| `window.openai.requestClose()` | — | Not yet implemented |
| `window.openai.setOpenInAppUrl({ href })` | — | Not yet implemented |
| `window.openai.view` | — | Not yet mapped |
### Event Handling
| OpenAI | MCP Apps | Notes |
| ------------------------------ | ------------------------------------------- | -------------------------------- |
| Read `window.openai.*` on load | `app.ontoolinput = (params) => {...}` | Register before `connect()` |
| Read `window.openai.*` on load | `app.ontoolresult = (params) => {...}` | Register before `connect()` |
| Poll or re-read properties | `app.onhostcontextchanged = (ctx) => {...}` | MCP pushes context changes |
| — | `app.onteardown = async () => {...}` | MCP adds: cleanup before unmount |
| OpenAI | MCP Apps | Notes |
| --------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------ |
| `window.openai.toolInput` (read on load) | `app.ontoolinput = (params) => {...}` | OpenAI: sync property; MCP: callback (register before `connect()`) |
| `window.openai.toolOutput` (read on load) | `app.ontoolresult = (params) => {...}` | OpenAI: sync property; MCP: callback (register before `connect()`) |
| `addEventListener("openai:set_globals", ...)` | `app.onhostcontextchanged = (ctx) => {...}` | Both push updates; MCP uses callback, OpenAI uses DOM event |
| — | `app.onteardown = async () => {...}` | MCP adds: cleanup before unmount |
### Logging