get_session_storage
Read sessionStorage entries from the current page by specifying a key or retrieving all values. Supports targeting a specific tab.
Instructions
Read sessionStorage entries for the current page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Specific key to read (returns all if omitted) | |
| tabId | No | Target tab ID (defaults to active tab) | |
| apiKey | No | API key for authentication |
Implementation Reference
- src/tools/devtools-storage.ts:107-120 (handler)The handler for the 'get_session_storage' tool. It reads sessionStorage entries for the current page by sending a 'get_session_storage' command via the WebSocket bridge. Accepts optional 'key' (returns all if omitted), 'tabId' (defaults to active tab), and 'apiKey' params.
server.tool( 'get_session_storage', 'Read sessionStorage entries for the current page', { key: z.string().optional().describe('Specific key to read (returns all if omitted)'), tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'), apiKey: z.string().optional().describe('API key for authentication'), }, async ({ key, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'get_session_storage', params: { key }, tabId, apiKey }); if (!result.success) return { content: [{ type: 'text' as const, text: `Error: ${result.error?.message}` }], isError: true }; return { content: [{ type: 'text' as const, text: JSON.stringify(result.data, null, 2) }] }; } ); - Input schema for the 'get_session_storage' tool using Zod. Defines optional 'key' (string), 'tabId' (number), and 'apiKey' (string) parameters with descriptions.
{ key: z.string().optional().describe('Specific key to read (returns all if omitted)'), tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'), apiKey: z.string().optional().describe('API key for authentication'), - src/tools/index.ts:42-42 (registration)Registration call: registerDevtoolsStorageTools(server, bridge) which registers all devtools storage tools including 'get_session_storage'.
registerDevtoolsStorageTools(server, bridge); - src/tools/devtools-storage.ts:5-5 (registration)The export function registerDevtoolsStorageTools that registers all storage-related tools (cookies, localStorage, sessionStorage) on the MCP server.
export function registerDevtoolsStorageTools(server: McpServer, bridge: WebSocketBridge) {