assert_tabs_match
Verify two tabs match by comparing URL, title, and DOM hash to ensure cross-tab state synchronization.
Instructions
Verify two tabs have the same state (URL, title, DOM hash). Useful for cross-tab state sync testing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabIdA | Yes | First tab ID | |
| tabIdB | Yes | Second tab ID | |
| apiKey | No | API key for authentication if enabled |
Implementation Reference
- src/tools/tab-management.ts:106-125 (handler)Handler function for the 'assert_tabs_match' tool. It accepts tabIdA and tabIdB (plus optional apiKey), sends the 'assert_tabs_match' command via WebSocket bridge, and returns the result (comparison of URL, title, and DOM hash) or an error.
server.tool( 'assert_tabs_match', 'Verify two tabs have the same state (URL, title, DOM hash). Useful for cross-tab state sync testing.', { tabIdA: z.number().describe('First tab ID'), tabIdB: z.number().describe('Second tab ID'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabIdA, tabIdB, apiKey }) => { const result = await bridge.sendCommand({ command: 'assert_tabs_match', params: { tabIdA, tabIdB }, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } ); - src/tools/tab-management.ts:109-113 (schema)Zod schema defining the input parameters for assert_tabs_match: tabIdA (required number), tabIdB (required number), and optional apiKey string.
{ tabIdA: z.number().describe('First tab ID'), tabIdB: z.number().describe('Second tab ID'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, - src/tools/tab-management.ts:106-125 (registration)Registration of the 'assert_tabs_match' tool on the McpServer via server.tool(), within the registerTabManagementTools function which is called from registerAllTools in index.ts.
server.tool( 'assert_tabs_match', 'Verify two tabs have the same state (URL, title, DOM hash). Useful for cross-tab state sync testing.', { tabIdA: z.number().describe('First tab ID'), tabIdB: z.number().describe('Second tab ID'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabIdA, tabIdB, apiKey }) => { const result = await bridge.sendCommand({ command: 'assert_tabs_match', params: { tabIdA, tabIdB }, apiKey, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );