remove_local_storage
Removes a specific localStorage entry from the current page, clearing stored data associated with that key.
Instructions
Remove a localStorage entry from the current page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Storage key to remove | |
| tabId | No | Target tab ID (defaults to active tab) | |
| apiKey | No | API key for authentication |
Implementation Reference
- src/tools/devtools-storage.ts:91-103 (handler)The handler function for the 'remove_local_storage' tool. It calls bridge.sendCommand with command 'remove_local_storage', passing the key parameter, and returns a success message or error.
server.tool( 'remove_local_storage', 'Remove a localStorage entry from the current page', { key: z.string().describe('Storage key to remove'), 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: 'remove_local_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: `localStorage["${key}"] removed` }] }; } - src/tools/devtools-storage.ts:94-98 (schema)Input schema for 'remove_local_storage': requires 'key' (string), optional 'tabId' (number), and optional 'apiKey' (string).
{ key: z.string().describe('Storage key to remove'), tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'), apiKey: z.string().optional().describe('API key for authentication'), }, - src/tools/devtools-storage.ts:91-104 (registration)Registration of the 'remove_local_storage' tool via server.tool() with description 'Remove a localStorage entry from the current page'.
server.tool( 'remove_local_storage', 'Remove a localStorage entry from the current page', { key: z.string().describe('Storage key to remove'), 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: 'remove_local_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: `localStorage["${key}"] removed` }] }; } ); - src/tools/index.ts:42-42 (registration)The function registerDevtoolsStorageTools is called from registerAllTools, which wires up the tool into the MCP server.
registerDevtoolsStorageTools(server, bridge);