list_pages
Get a list of all browser tabs open in the shared Chrome instance, enabling identification and selection for further actions.
Instructions
Get a list of pages open in the browser.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/daemon/rewrite.ts:22-24 (schema)Definition of the constant LIST_PAGES_TOOL, used to identify the 'list_pages' tool throughout the codebase.
const LIST_PAGES_TOOL = 'list_pages'; const CLOSE_PAGE_TOOL = 'close_page'; const SELECT_PAGE_TOOL = 'select_page'; - src/daemon/rewrite.ts:149-152 (handler)Handler in rewriteToolCall: list_pages passes through params without pageId injection; response filtering is done post-call in the daemon.
// list_pages: no pageId injection, response filtering happens elsewhere. if (toolName === LIST_PAGES_TOOL) { return {params}; } - src/daemon/rewrite.ts:217-227 (handler)Core handler: filters the list_pages response to include only pages owned by the requesting context.
export function filterListPagesResult( result: {content?: Array<{type: string; text?: string}>} | null | undefined, ctx: MuxContext, ): unknown { if (!result || !Array.isArray(result.content)) return result; const newContent = result.content.map((block) => { if (block.type !== 'text' || !block.text) return block; return {...block, text: filterPagesSection(block.text, ctx)}; }); return {...result, content: newContent}; } - src/daemon/daemon.ts:376-378 (registration)Registration/usage: when a 'list_pages' tool call returns, the result is filtered to owned pages.
} else if (name === 'list_pages') { result = filterListPagesResult(result, ctx); } else if (name === 'close_page') { - src/daemon/rewrite.ts:229-245 (helper)Helper function that parses page lines and drops those not owned by the context.
export function filterPagesSection(text: string, ctx: MuxContext): string { // Split by line. Rewrite any line that matches a "pageId: url" pattern to // omit rows not in the ctx ownership set. Preserve non-matching lines. const lines = text.split('\n'); const out: string[] = []; for (const line of lines) { const m = line.match(/^(\s*)(?:Page\s+(?:idx\s+)?)?(\d+)\s*:\s*/); if (m) { const id = Number(m[2]); if (ctx.owns(id)) out.push(line); // else: drop continue; } out.push(line); } return out.join('\n'); }