Skip to content

Spike: open a local .mvt file in a Mapbox vector tile viewer in ChatGPT - #336

Draft
zmofei wants to merge 3 commits into
feat/chatgpt-tileset-explorerfrom
feat/chatgpt-mvt-preview
Draft

zmofei wants to merge 3 commits into
feat/chatgpt-tileset-explorerfrom
feat/chatgpt-mvt-preview

Conversation

@zmofei

@zmofei zmofei commented Nov 12, 2026

Copy link
Copy Markdown
Member

Stacked on #335. Adds mvt_preview_tool and its MCP App, so a local Mapbox Vector Tile file (.mvt or .pbf) opens in a Mapbox viewer in ChatGPT Desktop.

  • File entrypoint: the tool registers { type: "file", extensions: [".mvt", ".pbf"] }. Opening such a file from the thread calls it with an opaque resourceUri; the page reads the file through the host (resources/read, representation: "blob"), unzips it if gzipped and decodes it in the browser. The server never reads the file.
  • Opened by the model: the model calls the tool with the file's absolute path, and the page asks ChatGPT to open it (openai/files/open), which lands in the same viewer. The server instructions route .mvt and .pbf files to the tool; without that, Codex decoded the tile with shell commands.
  • The viewer: each layer in its own color, placed by the tile address in the file name or one the user enters, with feature counts, fields, a click to inspect a feature, a tile outline and a base map. The open file and selected feature are shared as model context.

Verified:

  • The decoder matches @mapbox/vector-tile on five real Mapbox tiles (2,759 features), including negative int64 values.
  • In ChatGPT Desktop (Codex, local dev server): a .mvt in the thread outputs opens in the viewer, and "preview this tile" with an attached file calls the tool with the path and opens the viewer.
  • Unit tests, typecheck and lint pass.

Not verified: clicking an attached file in Sources opened a new chat instead of the viewer. One run showed an empty viewer after the model's call, and the cause was not found. Windows paths are not handled.

Adds mvt_preview_tool, registered as a file entrypoint for .mvt and .pbf
(OpenAI MCP Extensions), and its page. The tool is app-only and never sees
the file: the page reads it through the host with resources/read on the
opaque URI it is given, unzips it if gzipped, and decodes it in the
browser.

Each layer is drawn in its own color, placed by the tile address in the
file name or one the user enters, with feature counts, fields and a click
to inspect a feature. The open file and selected feature are shared as
model context. A file picker does the same outside ChatGPT.

The decoder matches @mapbox/vector-tile on five real tiles (2759
features), including negative int64 values.
Asked to preview a tile, Codex decoded it with shell commands, since
mvt_preview_tool was app-only and nothing pointed the model at it. The
tool now also takes an absolute path from the model, and the page asks
ChatGPT to open that file (openai/files/open), which lands in the same
viewer through the file entrypoint. The server instructions route .mvt
and .pbf files to it.

Tested in ChatGPT Desktop (Codex): "preview this tile" with an attached
file called mvt_preview_tool with the path, and the viewer opened with
the tile.
@zmofei
zmofei force-pushed the feat/chatgpt-tileset-explorer branch from 7f7a1af to 1a5b6ab Compare November 12, 2026 14:00
@zmofei
zmofei force-pushed the feat/chatgpt-mvt-preview branch from f4cad9d to 36f2616 Compare November 12, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant