Open Bug 2095715 Opened 6 days ago Updated 4 days ago

[firefox-mcp] Refactor current context handling

Categories

(Developer Infrastructure :: Firefox MCP, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: hbenl, Assigned: hbenl)

References

(Blocks 2 open bugs)

Details

As a follow-up to Bug 2080977 I want to refactor how we handle the current context:

  • remove ensureCurrentContext(): it silently switches to some tab when the current context is gone (Bug 2081624). Tool calls should error instead explaining that the selected context is gone and include a list of the currently open tabs
  • if close_page closes the current tab, it should either report which tab it has made current instead or show the list of currently open tabs to choose from (or both)
  • PageManagement should only refresh cachedTabs when the list is sent to the client (either by list_pages or in the messages described above)
  • remove cachedSelectedIdx and compute it from currentContextId and cachedTabs when needed

if close_page closes the current tab, it should either report which tab it has made current instead or show the list of currently open tabs to choose from (or both)

I think we should do both, but I would prefer agreeing on a consistent way to report changes (as described in Bug 2081596 and blockers) rather than adding custom reporting to individual tools.

Blocks: 2081596
See Also: → 2081597
You need to log in before you can comment on or make changes to this bug.