Skip to main content
This is an OpenAI MCP extension, not part of MCP or MCP Apps. Only ChatGPT desktop opens files with it. Other hosts ignore the entrypoint and list a regular tool with a required file input.
registerFileViewer makes your app a viewer for some file types in ChatGPT desktop. When the user opens a file with one of these extensions through your app, ChatGPT calls the tool with that file and shows its view, where useFileResource reads and saves the file.

Example

Parameters

config

The same as registerTool’s config, without inputSchema, plus:

handler

Receives { file: { name, resourceUri } }: the file’s name, and an opaque URI the view passes to useFileResource. ChatGPT never gives the view the file’s path. Tools the view calls receive it in _meta["openai/resource"].path.

How it works

registerFileViewer is a shortcut for registerTool with a required file input and openai.entrypoints: [{ type: "file", extensions }]. It returns the typed server like registerTool, so the view can read input.file with type safety.

useFileResource

Read, watch and save the opened file

registerTool

Every ChatGPT entrypoint