Skip to content

feat: include page title in list_pages output#2166

Open
serhiizghama wants to merge 1 commit into
ChromeDevTools:mainfrom
serhiizghama:feat/list-pages-include-title-v2
Open

feat: include page title in list_pages output#2166
serhiizghama wants to merge 1 commit into
ChromeDevTools:mainfrom
serhiizghama:feat/list-pages-include-title-v2

Conversation

@serhiizghama
Copy link
Copy Markdown

Motivation

list_pages shows each page's URL but not its title, which is painful when multiple pages share a host — e.g. several tabs under app.example.com/u/0/, /u/1/, /u/2/. There's no way to tell which is which without visiting each one, even though every page has a usable document.title.

Fixes #2156.

What this changes

  • list_pages text output now shows the title before the URL when available: 1: My Page (https://example.com) [selected]. If the page has no title (e.g. about:blank), the format is unchanged.
  • The structured content entry for each page now includes a title field alongside id, url, and selected.
  • page.title() is awaited with a .catch(() => '') so a closed or erroring page silently falls back to the URL-only format.
  • format() is made async to support the await inside the page loop; createStructuredPage() likewise becomes async.

Testing

Start the MCP server with multiple tabs open. Call list_pages — pages with titles now display as id: Title (url). Pages without titles (about:blank, data URLs) display as before.

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.

Include page title in list_pages output

1 participant