Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

remove_session_storage

Remove a sessionStorage entry from the current page using its key to clear temporary data.

Instructions

Remove a sessionStorage entry from the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesStorage key to remove
tabIdNoTarget tab ID (defaults to active tab)
apiKeyNoAPI key for authentication

Implementation Reference

  • The handler function that executes the 'remove_session_storage' tool logic. It calls bridge.sendCommand with the command name and key parameter, then returns success/error message.
    server.tool(
      'remove_session_storage',
      'Remove a sessionStorage 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_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: `sessionStorage["${key}"] removed` }] };
      }
    );
  • Zod schema for the tool's input parameters: key (required string), tabId (optional number), apiKey (optional 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'),
    },
  • The 'remove_session_storage' tool is registered via server.tool() inside the registerDevtoolsStorageTools function exported from devtools-storage.ts. This function is called from src/tools/index.ts line 42.
    export function registerDevtoolsStorageTools(server: McpServer, bridge: WebSocketBridge) {
      // --- Cookies ---
      server.tool(
        'get_cookies',
        'Get cookies for the current page or a specific URL',
        {
          url: z.string().optional().describe('URL to get cookies for (defaults to current page URL)'),
          name: z.string().optional().describe('Filter by cookie name'),
          apiKey: z.string().optional().describe('API key for authentication'),
        },
        async ({ url, name, apiKey }) => {
          const result = await bridge.sendCommand({ command: 'get_cookies', params: { url, name }, 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) }] };
        }
      );
    
      server.tool(
        'set_cookie',
        'Set a cookie',
        {
          name: z.string().describe('Cookie name'),
          value: z.string().describe('Cookie value'),
          url: z.string().optional().describe('URL to associate the cookie with'),
          domain: z.string().optional().describe('Cookie domain'),
          path: z.string().optional().describe('Cookie path'),
          secure: z.boolean().optional().describe('Secure flag'),
          httpOnly: z.boolean().optional().describe('HttpOnly flag'),
          sameSite: z.enum(['no_restriction', 'lax', 'strict']).optional().describe('SameSite attribute'),
          expirationDate: z.number().optional().describe('Expiration as Unix timestamp in seconds'),
          apiKey: z.string().optional().describe('API key for authentication'),
        },
        async ({ apiKey, ...params }) => {
          const result = await bridge.sendCommand({ command: 'set_cookie', params, apiKey });
          if (!result.success) return { content: [{ type: 'text' as const, text: `Error: ${result.error?.message}` }], isError: true };
          return { content: [{ type: 'text' as const, text: `Cookie "${params.name}" set` }] };
        }
      );
    
      server.tool(
        'delete_cookie',
        'Delete a specific cookie',
        {
          name: z.string().describe('Cookie name'),
          url: z.string().describe('URL associated with the cookie'),
          apiKey: z.string().optional().describe('API key for authentication'),
        },
        async ({ name, url, apiKey }) => {
          const result = await bridge.sendCommand({ command: 'delete_cookie', params: { name, url }, apiKey });
          if (!result.success) return { content: [{ type: 'text' as const, text: `Error: ${result.error?.message}` }], isError: true };
          return { content: [{ type: 'text' as const, text: `Cookie "${name}" deleted` }] };
        }
      );
    
      // --- Local Storage ---
      server.tool(
        'get_local_storage',
        'Read localStorage 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_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: JSON.stringify(result.data, null, 2) }] };
        }
      );
    
      server.tool(
        'set_local_storage',
        'Set a localStorage entry on the current page',
        {
          key: z.string().describe('Storage key'),
          value: z.string().describe('Storage value'),
          tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
          apiKey: z.string().optional().describe('API key for authentication'),
        },
        async ({ key, value, tabId, apiKey }) => {
          const result = await bridge.sendCommand({ command: 'set_local_storage', params: { key, value }, 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}"] set` }] };
        }
      );
    
      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` }] };
        }
      );
    
      // --- Session Storage ---
      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) }] };
        }
      );
    
      server.tool(
        'set_session_storage',
        'Set a sessionStorage entry on the current page',
        {
          key: z.string().describe('Storage key'),
          value: z.string().describe('Storage value'),
          tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
          apiKey: z.string().optional().describe('API key for authentication'),
        },
        async ({ key, value, tabId, apiKey }) => {
          const result = await bridge.sendCommand({ command: 'set_session_storage', params: { key, value }, 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: `sessionStorage["${key}"] set` }] };
        }
      );
    
      server.tool(
        'remove_session_storage',
        'Remove a sessionStorage 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_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: `sessionStorage["${key}"] removed` }] };
        }
      );
    }
  • Registration hook: registerDevtoolsStorageTools is invoked in registerAllTools to add all devtools storage tools (including remove_session_storage) to the MCP server.
    registerDevtoolsStorageTools(server, bridge);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must bear full burden. It states removal of a sessionStorage entry but does not disclose side effects, error behavior (e.g., missing key), or authentication requirements (apiKey is present but unexplained).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence with no unnecessary words. It is appropriately front-loaded and concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple removal operation, the description is reasonably complete. However, it lacks mention of return values (success/failure) or potential side effects, which would improve completeness. No output schema is provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameter meanings are already clear from the schema. The description adds no additional semantic value beyond what the schema provides, earning a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Remove' and the resource 'sessionStorage entry from the current page'. It is specific about the action and target, but does not differentiate from sibling tools like 'remove_local_storage', which share a similar pattern.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., 'remove_local_storage', 'set_session_storage'). The description only states the action, without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BrowserGenie/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server