Skip to main content
Glama

interceptor_browser_list_console

Retrieve buffered browser console messages (log, info, warning, error, debug) with optional filtering by type and text. Access historical console output from launched browsers.

Instructions

List console messages buffered since the browser was launched. Types: log, info, warning, error, debug, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idYesTarget ID from interceptor_browser_launch or interceptor_camoufox_launch
typesNoFilter by console message types
text_filterNoFilter by text substring
offsetNoOffset into results (default: 0)
limitNoMax messages to return (default: 50, max: 500)

Implementation Reference

  • The handler function for the interceptor_browser_list_console tool. Fetches console messages via getConsoleBufferForTarget, applies optional type/text filters, paginates with offset/limit, and returns the results.
    async ({ target_id, types, text_filter, offset, limit }) => {
      try {
        let msgs = await getConsoleBufferForTarget(target_id);
        if (types && types.length > 0) {
          const set = new Set(types.map((t) => t.toLowerCase()));
          msgs = msgs.filter((m) => set.has(m.type.toLowerCase()));
        }
        if (text_filter) {
          const needle = text_filter.toLowerCase();
          msgs = msgs.filter((m) => m.text.toLowerCase().includes(needle));
        }
        const total = msgs.length;
        const o = normalizeOffset(offset);
        const l = normalizeLimit(limit);
        const page = msgs.slice(o, o + l);
    
        return {
          content: [{
            type: "text",
            text: truncateResult({
              status: "success",
              target_id,
              total,
              offset: o,
              limit: l,
              showing: page.length,
              messages: page,
            }),
          }],
        };
      } catch (e) {
        return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
      }
    },
  • The input schema for interceptor_browser_list_console: target_id (string), types (optional string array), text_filter (optional string), offset (number, default 0), limit (number, default 50, max 500).
    "interceptor_browser_list_console",
    "List console messages buffered since the browser was launched. Types: log, info, warning, error, debug, etc.",
    {
      target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
      types: z.array(z.string()).optional().describe("Filter by console message types"),
      text_filter: z.string().optional().describe("Filter by text substring"),
      offset: z.number().optional().default(0).describe("Offset into results (default: 0)"),
      limit: z.number().optional().default(DEFAULT_LIST_LIMIT).describe("Max messages to return (default: 50, max: 500)"),
    },
  • Registration via server.tool() inside registerDevToolsTools(), which is called from src/index.ts at line 69.
    export function registerDevToolsTools(server: McpServer): void {
      // ── snapshot ──────────────────────────────────────────────────
    
      server.tool(
        "interceptor_browser_snapshot",
        "Take an ARIA accessibility snapshot of the bound page (YAML-formatted role tree). " +
        "Great for LLM-driven page understanding without parsing HTML.",
        {
          target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
          selector: z.string().optional().default("body").describe("Root selector to snapshot (default: 'body')"),
          mode: z.enum(["default", "ai"]).optional().default("default").describe("Snapshot mode — 'ai' adds ref attributes for locator reuse"),
        },
        async ({ target_id, selector, mode }) => {
          try {
            const page = await getPageForTarget(target_id);
            const snapshot = await page.locator(selector).ariaSnapshot({ mode });
            return {
              content: [{
                type: "text",
                text: truncateResult({
                  status: "success",
                  target_id,
                  url: page.url(),
                  title: await page.title().catch(() => ""),
                  root: selector,
                  snapshot,
                }),
              }],
            };
          } catch (e) {
            return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
          }
        },
      );
    
      // ── screenshot ────────────────────────────────────────────────
    
      server.tool(
        "interceptor_browser_screenshot",
        "Take a screenshot of the bound page. Saves to file_path if provided; otherwise reports byte count without embedding the image.",
        {
          target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
          file_path: z.string().optional().describe("Optional path to save screenshot"),
          format: z.enum(["png", "jpeg"]).optional().default("png").describe("Image format (default: png)"),
          full_page: z.boolean().optional().default(false).describe("Capture the full scrollable page"),
          quality: z.number().optional().describe("JPEG quality 0-100 (ignored for png)"),
        },
        async ({ target_id, file_path, format, full_page, quality }) => {
          try {
            const page = await getPageForTarget(target_id);
            const buffer = await page.screenshot({
              type: format,
              fullPage: full_page,
              ...(format === "jpeg" && quality !== undefined ? { quality } : {}),
            });
    
            let saved = false;
            if (file_path) {
              await mkdir(dirname(file_path), { recursive: true });
              await writeFile(file_path, buffer);
              saved = true;
            }
    
            return {
              content: [{
                type: "text",
                text: truncateResult({
                  status: "success",
                  target_id,
                  format,
                  full_page,
                  bytes: buffer.length,
                  ...(file_path ? { file_path, saved } : {}),
                }),
              }],
            };
          } catch (e) {
            return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
          }
        },
      );
    
      // ── console ───────────────────────────────────────────────────
    
      server.tool(
        "interceptor_browser_list_console",
        "List console messages buffered since the browser was launched. Types: log, info, warning, error, debug, etc.",
        {
          target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
          types: z.array(z.string()).optional().describe("Filter by console message types"),
          text_filter: z.string().optional().describe("Filter by text substring"),
          offset: z.number().optional().default(0).describe("Offset into results (default: 0)"),
          limit: z.number().optional().default(DEFAULT_LIST_LIMIT).describe("Max messages to return (default: 50, max: 500)"),
        },
        async ({ target_id, types, text_filter, offset, limit }) => {
          try {
            let msgs = await getConsoleBufferForTarget(target_id);
            if (types && types.length > 0) {
              const set = new Set(types.map((t) => t.toLowerCase()));
              msgs = msgs.filter((m) => set.has(m.type.toLowerCase()));
            }
            if (text_filter) {
              const needle = text_filter.toLowerCase();
              msgs = msgs.filter((m) => m.text.toLowerCase().includes(needle));
            }
            const total = msgs.length;
            const o = normalizeOffset(offset);
            const l = normalizeLimit(limit);
            const page = msgs.slice(o, o + l);
    
            return {
              content: [{
                type: "text",
                text: truncateResult({
                  status: "success",
                  target_id,
                  total,
                  offset: o,
                  limit: l,
                  showing: page.length,
                  messages: page,
                }),
              }],
            };
          } catch (e) {
            return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
          }
        },
      );
  • getConsoleBufferForTarget — helper that resolves the target entry and returns the console buffer. Handles both cloakbrowser (BrowserInterceptor) and camoufox targets.
    export async function getConsoleBufferForTarget(targetId: string): Promise<ConsoleEntry[]> {
      const entry = getEntry(targetId);
      if (isCamoufoxTargetId(targetId)) {
        const camoufoxEntry = entry as CamoufoxEntryWithDriver;
        const page = await ensureCamoufoxPage(camoufoxEntry);
        return ensureConsoleBuffer(camoufoxEntry, page);
      }
      return (entry as BrowserTargetEntry).consoleBuffer;
    }
  • ConsoleEntry interface definition — type, text, location, timestamp. Also BrowserTargetEntry interface which holds consoleBuffer.
    export interface ConsoleEntry {
      type: string;
      text: string;
      location: string;
      timestamp: number;
    }
    
    export interface BrowserTargetEntry {
      target: ActiveTarget;
      browser: Browser;
      context: BrowserContext;
      page: Page;
      consoleBuffer: ConsoleEntry[];
    }
Behavior3/5

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

The description discloses that messages are buffered since browser launch and mentions message types, which is useful. However, with no annotations, it lacks details on read-only nature, authorization requirements, or potential side effects like clearing buffers.

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 two sentences, no fluff. The first sentence states the core function, the second gives example types. Efficient and front-loaded.

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?

Given no output schema, the description could explain the output format or mention that filtering via parameters (types, text_filter) is supported. It covers the basic purpose but lacks optional completeness for a list tool with parameters.

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?

The input schema has 100% description coverage for all 5 parameters. The description adds high-level context (buffer, types) but does not add per-parameter details beyond the schema. Baseline of 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?

The description clearly states the tool lists console messages buffered since launch and provides example types (log, info, warning, error, debug). It distinguishes itself from sibling tools like list_cookies or list_network_fields by focusing on console messages.

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

Usage Guidelines3/5

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

The description implies usage after launching a browser but does not explicitly state when to use this tool versus alternatives, such as other list tools or evaluating JS directly. No when-not-to-use guidance is provided.

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/yfe404/proxy-mcp'

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