Repository navigation
Conversation
e963e07 to
9c9b9d5
Compare
8f395ae to
1f121f5
Compare
115f55e to
7da00fc
Compare
…l draw on it In ChatGPT, render_map_tool opens its map as a tab next to the chat that stays open: - A thread entrypoint opens an empty map. - The map shares its view and the selected place (a pin, a search result or a Standard base map label) as model context. - WebMCP tools (redraw_map, search_map, add_places, move_map, read_map) let the model change the open map instead of opening another. - The server instructions, tool description and results point the model at those tools.
7da00fc to
5634bda
Compare
…apAppHtml.ts mapAppHtml.ts had grown past 3,300 lines. The new map page code now lives in three files whose scripts renderMapAppHtml splices into the page's single <script>. The generated page's code is unchanged.
ChatGPT on the web offers document.modelContext but doesn't give the registered tools to the model, so a map that listed them in its context had the model explain that the tools it was told about weren't callable. The context no longer lists them, and the server texts say ChatGPT Desktop.
…ender_map_tool an icon On a phone, ChatGPT's title bar covered the map's zoom buttons and summary. The map now places its controls, labels and cards inside hostContext.safeAreaInsets, while the map itself runs underneath, and inline it asks for no more than containerDimensions.maxHeight. A square Mapbox mark icon replaces the wide server logo in ChatGPT's "+" menu.
mattpodwysocki
left a comment
There was a problem hiding this comment.
Nice work on this, keeping the map open next to the chat is a big step up. I ran a review pass and left six comments. The first one (an empty map for any call with no drawable data, which also drops the camera) is the one I'd fix before merging. The rest are smaller or questions.
A few minor things too, not commented inline: size-changed can go out before ui/notifications/initialized (applyHostContext in mapAppHtml.ts), selecting the card that's already active doesn't clear dismissedPlaceKey, the Satellite toggle loses the selected label's feature state, and placesOnMap / pinnedPlace skip coord() rounding so placeKey can differ from labels.
| // ChatGPT sends the same null when the user removes the item and when | ||
| // a sent message uses it up, so the map keeps its selection either way. | ||
| dismissedPlaceKey = placeKey(selectedPlace()); | ||
| lastSharedContext = ''; |
There was a problem hiding this comment.
Question more than a bug: after a sent message uses up the context, nothing shares the view again until the user pans or zooms. So "what's around here?" works, but a follow-up like "and restaurants here?" goes without the view unless the map moved. I get that re-sharing right away would put back a chip the user just removed, since ChatGPT sends the same null for both. Is the once-per-pan behavior what we want, or is there a way to tell the two apart (or re-share just the view, without the place)?
There was a problem hiding this comment.
Tested this in Codex on Desktop. After a send uses up the context, a follow-up still reaches the open app instance: the model can read the open map or the earlier turns in the history. With a pin selected, I sent "what neighborhood is this?" (context attached), then, without touching the map, "what's the nearest metro station to here?" with no context attached, and the answer was still about the selected pin. So I'd keep the once-per-pan behavior, since re-sharing right after a send would put back a chip the user may have just removed. Not tested on ChatGPT web.
| tool.execute = function(input) { | ||
| return Promise.resolve(input).then(run); | ||
| }; | ||
| try { document.modelContext.registerTool(tool); } catch (_) { /* already registered */ } |
There was a problem hiding this comment.
With more than one map in the conversation (an older inline one plus the one open next to the chat), which one ends up with these tools? If ChatGPT keeps the first registration and this catch swallows the rest, "show coffee shops on it" could draw on a map the user scrolled past. Could we register only from maps that stay open (explorerMode or fullscreen), or unregister when a map closes?
There was a problem hiding this comment.
Tested this in Codex on Desktop with two map tabs open (Helsinki, then Paris). Each map keeps its own tools: "show coffee shops on it" drew on Paris, and "show me hotels on the first map" drew on Helsinki, both keeping their earlier pins. So the first registration doesn't win, and I'd leave the registration as is.
One thing it did show: the model picks the map from the conversation, not the tab in view. After I switched to the Helsinki tab, "show me hotels" still went to Paris. Updated the known limits to say that.
Not tested: an older inline map next to an open one.
- render_map_tool opens the empty map only for a call with no arguments. A camera alone or empty payload_refs is an error again, as on main. - A context clear from the host that arrives while a share request is in flight is applied once the request settles, instead of being dropped. - search_map no longer adds a "Search center" pin, and a search that finds nothing leaves the map as it was. It also hides the error a failed search left behind. - The hint in a ChatGPT result no longer assumes the map is open next to the chat or that its tools exist.
# Conflicts: # CHANGELOG.md
In ChatGPT,
render_map_toolopens its map as a tab next to the chat, where it stays open and works with the conversation. Hosts without the OpenAI MCP Extensions ignore the new metadata.render_map_toolis a thread entrypoint. "+" → "More tools" → Mapbox Map opens an empty map.ui/update-model-context, and the selected place as a titled item in the composer, so "what's around here?" and "what is this?" work. A place can be a pin, a search result, or a label of the Standard base map: points of interest, place names, landmark icons and indoor labels. A selected label is highlighted; a second click deselects it.redraw_map,search_map,add_places,move_mapandread_map, so follow-ups draw on the open map instead of opening another.redraw_maptakesrender_map_tool's arguments.render_map_tooldescription, the render hint and the map's shared context name these tools, each saying it applies in ChatGPT, so other clients aren't sent looking for tools they don't have. In ChatGPT, the result of a call that opens a map names them too.Verified in ChatGPT Desktop with a local dev server: the map opens next to the chat and from the thread tab bar; the model answers from the shared view; in Codex, follow-ups change the open map; clicking base map labels selects, switches and deselects them, and the selection stays after a message is sent. With the tools named directly (no
read_mapcall first), "show coffee shops on it" drew on the open map throughsearch_map, without a secondrender_map_toolcall. Unit tests, typecheck and lint pass.Known limits: