feat: include page title in list_pages output#2166
Open
serhiizghama wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
list_pagesshows each page's URL but not its title, which is painful when multiple pages share a host — e.g. several tabs underapp.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 usabledocument.title.Fixes #2156.
What this changes
list_pagestext 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.titlefield alongsideid,url, andselected.page.title()is awaited with a.catch(() => '')so a closed or erroring page silently falls back to the URL-only format.format()is madeasyncto support theawaitinside the page loop;createStructuredPage()likewise becomesasync.Testing
Start the MCP server with multiple tabs open. Call
list_pages— pages with titles now display asid: Title (url). Pages without titles (about:blank, data URLs) display as before.