Skip to content

Bug: Get the currently selected browser tab #933

Description

@tnglemongrass

Description of the bug

As a user, I'd like to have a simple way to get the current browser tab (content) into my LLM Chat.

Expected workflow:

  • take_snapshot (description says ...of the currently selected page...)

Actually needed workflow:

  • list_pages
  • select_page (manually pick the one that is already open in browser)
  • take_snapshot

Why doesn't the expected workflow work?
The 'list_pages' tool shows 'selected', but it is not in sync with the actual browser initiall (on startup) and can easily get out-of-sync (when user manually changes tabs). So it often returns content from the wrong page.

Use cases:

  • user reads a relevant docs page (already open)
  • user inspects a failed pipeline run after he got a mail and clicked it (already open)
  • user wants to share information behind a paywall (open and logged in)
  • ...

Note: This is about the scenario where chrome-dev-tools is connected via --auto-connect to an already running browser instance, as described in https://github.com/ChromeDevTools/chrome-devtools-mcp?tab=readme-ov-file#configuration.

Reproduction

  1. Open Chrome, open at least two tabs with two different websites.
  2. Open VSCode
  3. As to "take a snapshot and summarize the page"

Expectation

  • take_snapshot should return the page the user is currently looking at, not a different one
  • list_pages should show 'selected' tag on the page that is currently open in the browser (e.g. last focused, last visited, or similar)

MCP configuration

{
	"inputs": [],
	"servers": {
		"chrome-devtools": {
			"type": "stdio",
			"command": "npx",
			"args": [
				"chrome-devtools-mcp@latest",
				"--autoConnect"
			],
			"gallery": "https://api.mcp.github.com",
			"version": "0.17.0"
		}
	}
}

Chrome DevTools MCP version

0.17.0

Chrome version

144.0.7559.133 (Official Build) (64-bit) (cohort: Stable)

Coding agent version

VSCode 1.109.0 + Github Copilot Chat 0.37.2

Model version

GPT-4.1

Chat log

No response

Node version

v24.12.0

Operating system

Windows

Extra checklist

  • I want to provide a PR to fix this bug

Activity

  1. OrKoN commented on Feb 10, 2026

    @OrKoN
    Collaborator

    The selection for the MCP server is separate from the selection in the UI to avoid interrupting the flow of the MCP agent.

  2. removed theissue type on Feb 10, 2026
  3. added theissue type on Feb 10, 2026
  4. OrKoN commented on Feb 10, 2026

    @OrKoN
    Collaborator

    It would be a good enhancement to figure out how to do this without affecting the hybrid and the sidecar workflows.

  5. pirate commented on Apr 1, 2026

    @pirate

    I have opened a new chromium bug tracker issue to add a CDP command to chrome that will allow querying for active/foreground targetId as well as other things supported by chrome.tabs.query(...). The intention is for libraries like chrome-devtools-mcp, puppeteer, playwright, stagehand, browser-use, etc. to be able to use this to properly track foreground tab state, tab order, tab groups, etc. without resorting to hacks like trying to traack document.onfocus.

    Please upvote/comment over there if you want this feature added! We need it implemented at the CDP layer in order for the driver libraries to be able to provide accurate focus tracking.

    Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions