fix: resolve MCP App compatibility issues with ChatGPT#24
Conversation
- Add _meta.ui with prefersBorder and domain to resource registration - Make ontoolinput handler work with partial args (filename + media_type only) - Resolve size_bytes and mime_type from first _get_media_data chunk response - Set _get_media_data tool visibility to app-only - ontoolresult now acts as fallback if ontoolinput didn't fire Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code ReviewGood targeted fixes for ChatGPT MCP App compatibility. The dual Correctness / Potential Issues
// resolvedMime from input is immediately overwritten at offset === 0 anyway
}, [app, input.filename, input.media_type]); // input.mime_type not needed
app.onerror = console.error;Errors from the app SDK are only logged to the browser console. If app.onerror = (err) => {
console.error(err);
setErrorMsg(err instanceof Error ? err.message : String(err));
};This is a minor UX issue but worth fixing given the PR's stated goal of eliminating the stuck state. Performance
The base64 → const bytes = Uint8Array.from(atob(chunk.data), (c) => c.charCodeAt(0));Not blocking, just a style note. Security
Minor
TestsThe 197 passing unit tests are reassuring. The frontend React logic ( Overall: ✅ Approve with suggestions. The core fix is solid and the |
PR Review: fix/mcp-app-chatgpt-compatOverall this is a well-focused, well-reasoned fix. The root cause analysis is clear, the approach is sound, and the changes are minimal. A few observations below. ✅ What's good
Making
🔸 Minor issues1. // media-viewer.tsx:95
const [mimeType, setMimeType] = useState<string | null>(input.mime_type ?? null);
2. Implicit type contract in app.ontoolresult = async (result) => {
const parsed = extractJson<MediaToolInput>(result);
if (parsed?.filename && parsed?.media_type) {
setMediaInput((prev) => prev ?? parsed);
}
};
3. }, [app, input.filename, input.media_type, input.mime_type]);
🔍 The dist rebuildThe SummaryThe core fix is correct and handles the ChatGPT compatibility issue well. The main actionable item before merge is cleaning up the unused 🤖 Reviewed with Claude Code |
- Propagate onerror to visible error state instead of console-only - Remove unused input.mime_type from useCallback dependency array Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code ReviewOverall, this is a clean, well-targeted fix. The logic changes are sensible and the ChatGPT compatibility strategy is solid.
The
Base64 decoding ( The loop is correct. A slightly more idiomatic alternative:
Correctly uses Retry / reload button ( When
Good defensive practice. Worth a short comment noting this is a hint — clients that do not understand the field will still expose the tool to the model, so the
The |
Summary
ontoolinputwork with partial args (media_type+filenameonly —size_bytesandmime_typeare resolved from the first_get_media_datachunk)_meta.ui.prefersBorderto resource registration for proper widget rendering_get_media_datatool visibility to["app"]so the model doesn't call it directlyontoolresultnow acts as fallback ifontoolinputdidn't fireTest plan
view_mediarenders media player🤖 Generated with Claude Code