Skip to main content
Glama
BrowserGenie

BrowserGenie MCP Server

by BrowserGenie

read_page_resources

List all web page resources (images, fonts, scripts, stylesheets) with their URLs and sizes. Filter by resource type to analyze page load performance.

Instructions

List all resources loaded on the page (images, fonts, scripts, stylesheets) with their URLs and sizes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoFilter by resource type (default: all)
tabIdNoTarget tab ID (defaults to active tab)
apiKeyNoAPI key for authentication

Implementation Reference

  • The function registerDevtoolsSourcesTools registers the 'read_page_resources' tool (among others) on the MCP server.
    export function registerDevtoolsSourcesTools(server: McpServer, bridge: WebSocketBridge) {
  • Input schema for 'read_page_resources': optional 'type' (enum: image, font, stylesheet, script, all), optional 'tabId', optional 'apiKey'.
    {
      type: z.enum(['image', 'font', 'stylesheet', 'script', 'all']).optional().describe('Filter by resource type (default: all)'),
      tabId: z.number().optional().describe('Target tab ID (defaults to active tab)'),
      apiKey: z.string().optional().describe('API key for authentication'),
    },
  • Handler function for 'read_page_resources'. Sends the command via WebSocket bridge with params {type} and returns the result as JSON.
      async ({ type, tabId, apiKey }) => {
        const result = await bridge.sendCommand({
          command: 'read_page_resources',
          params: { type },
          tabId,
          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) }] };
      }
    );
  • WebSocketBridge.sendCommand() sends the command to the connected Chrome extension client and returns a promise with the response.
    async sendCommand(cmd: BridgeCommand): Promise<BridgeResponse> {
      if (!this.isConnected()) {
        return {
          success: false,
          error: {
            code: 'NOT_CONNECTED',
            message: 'Chrome extension is not connected. Ensure the extension is installed, enabled, and the browser is running.',
          },
        };
      }
    
      const id = crypto.randomUUID();
      const timeout = cmd.timeout ?? DEFAULT_TIMEOUT;
    
      return new Promise<BridgeResponse>((resolve, reject) => {
        const timer = setTimeout(() => {
          this.pending.delete(id);
          resolve({
            success: false,
            error: {
              code: 'TIMEOUT',
              message: `Command '${cmd.command}' timed out after ${timeout}ms`,
            },
          });
        }, timeout);
    
        this.pending.set(id, { resolve, reject, timer });
    
        const message = {
          id,
          type: 'request',
          command: cmd.command,
          params: cmd.params,
          tabId: cmd.tabId,
          apiKey: cmd.apiKey,
          timestamp: Date.now(),
        };
    
        this.client!.send(JSON.stringify(message));
      });
    }
  • BridgeCommand interface definition used by sendCommand to type the command payload.
    export interface BridgeCommand {
      command: string;
      params: Record<string, unknown>;
      tabId?: number;
      apiKey?: string;
      timeout?: number;
    }
Behavior3/5

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

No annotations provided. Description implies a read-only operation (listing resources), but does not disclose any limitations, permissions, or side effects. It adds minimal behavioral context beyond the obvious 'list' action.

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?

Single sentence, front-loaded with verb and object. No wasted words, succinctly conveys the tool's function.

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?

No output schema; description hints at return data (URLs and sizes) but lacks structural details. No mention of error handling or edge cases. Adequate for a simple list tool but could be more complete.

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?

All parameters have schema descriptions (100% coverage). The tool description mentions 'with their URLs and sizes' which hints at output but adds no extra meaning for the parameters themselves. Baseline 3 is appropriate.

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?

Description clearly states the tool lists all resources (images, fonts, scripts, stylesheets) with URLs and sizes. It differentiates from sibling tools like read_scripts (only scripts) or read_stylesheets (only stylesheets) by being broader and offering a type filter.

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 explicit guidance on when to use read_page_resources vs. more specific tools like read_scripts or read_stylesheets. The description implies it's for all resources, but does not mention when not to use it or that for only scripts, one should use the sibling tool.

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