Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

set_session_storage

Set a session storage key-value pair on the current page to persist data during the browser session.

Instructions

Set a sessionStorage entry on the current page

Input Schema

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

Implementation Reference

  • The handler function for set_session_storage tool. Sends a command via WebSocket bridge to set a sessionStorage entry, then returns a success/error response.
    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` }] };
    }
  • Input schema for set_session_storage using Zod validation. Requires 'key' and 'value' as strings, with optional 'tabId' (number) and 'apiKey' (string).
    {
      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'),
    },
  • Registration of the 'set_session_storage' tool on the MCP server via server.tool() with its name, description, schema, and handler.
    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` }] };
      }
    );
  • Registration of DevtoolsStorage tools (including set_session_storage) in the central registerAllTools function via registerDevtoolsStorageTools(server, bridge).
    export function registerAllTools(server: McpServer, bridge: WebSocketBridge) {
      registerNavigationTools(server, bridge);
      registerTabManagementTools(server, bridge);
      registerKeyboardTools(server, bridge);
      registerScreenshotTools(server, bridge);
      registerClickTools(server, bridge);
      registerInputTools(server, bridge);
      registerDragDropTools(server, bridge);
      registerHoverTools(server, bridge);
    
      registerDevtoolsSourcesTools(server, bridge);
      registerDevtoolsModifyTools(server, bridge);
      registerDevtoolsNetworkTools(server, bridge);
      registerDevtoolsStorageTools(server, bridge);
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states the action without mentioning overwrite behavior, tab-specific nature, error conditions (e.g., storage full, permissions), or side effects.

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?

A single sentence of 7 words that efficiently conveys the core action with no unnecessary verbiage.

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?

The description is adequate for a simple set operation but lacks information about return value, success indication, or how it interacts with session storage lifecycle, which is incomplete for an agent making decisions.

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 baseline is 3. The description adds no additional meaning beyond what the schema already provides for the parameters.

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

Purpose5/5

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

The description clearly states the verb 'Set', the resource 'sessionStorage entry', and the scope 'on the current page', making it distinct from sibling tools like get_session_storage and remove_session_storage.

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?

The description provides no guidance on when to use this tool versus alternatives like set_local_storage or when not to use it, leaving the agent without context for appropriate invocation.

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