test_storage_sync
Validates localStorage synchronization across browser tabs by setting a value in tab A and verifying its presence in tab B.
Instructions
Test cross-tab localStorage synchronization. Sets a value in tab A and checks if it appears in tab B.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabIdA | Yes | Tab ID to set localStorage value in | |
| tabIdB | Yes | Tab ID to verify localStorage value in | |
| key | Yes | localStorage key to test | |
| value | Yes | Value to set and expect | |
| apiKey | No | API key for authentication if enabled |
Implementation Reference
- src/tools/tab-management.ts:127-148 (handler)The tool handler for 'test_storage_sync'. It accepts tabIdA, tabIdB, key, value (and optional apiKey), sends a 'test_storage_sync' command via WebSocket bridge, and returns the result. This is the function that executes the tool logic.
server.tool( 'test_storage_sync', 'Test cross-tab localStorage synchronization. Sets a value in tab A and checks if it appears in tab B.', { tabIdA: z.number().describe('Tab ID to set localStorage value in'), tabIdB: z.number().describe('Tab ID to verify localStorage value in'), key: z.string().describe('localStorage key to test'), value: z.string().describe('Value to set and expect'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabIdA, tabIdB, key, value, apiKey }) => { const result = await bridge.sendCommand({ command: 'test_storage_sync', params: { tabIdA, tabIdB, key, value }, 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:130-136 (schema)Input parameter schema for 'test_storage_sync' tool using Zod validation. Defines tabIdA (number), tabIdB (number), key (string), value (string), and optional apiKey (string).
{ tabIdA: z.number().describe('Tab ID to set localStorage value in'), tabIdB: z.number().describe('Tab ID to verify localStorage value in'), key: z.string().describe('localStorage key to test'), value: z.string().describe('Value to set and expect'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, - src/tools/tab-management.ts:127-149 (registration)The tool is registered via server.tool() call inside registerTabManagementTools(). The function registerTabManagementTools is called from src/tools/index.ts (line 31) which is called from src/server.ts (line 11) which is called from src/index.ts (line 8).
server.tool( 'test_storage_sync', 'Test cross-tab localStorage synchronization. Sets a value in tab A and checks if it appears in tab B.', { tabIdA: z.number().describe('Tab ID to set localStorage value in'), tabIdB: z.number().describe('Tab ID to verify localStorage value in'), key: z.string().describe('localStorage key to test'), value: z.string().describe('Value to set and expect'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ tabIdA, tabIdB, key, value, apiKey }) => { const result = await bridge.sendCommand({ command: 'test_storage_sync', params: { tabIdA, tabIdB, key, value }, 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/index.ts:29-31 (registration)The registerAllTools function calls registerTabManagementTools(server, bridge), which registers 'test_storage_sync' among other tab management tools.
export function registerAllTools(server: McpServer, bridge: WebSocketBridge) { registerNavigationTools(server, bridge); registerTabManagementTools(server, bridge);