Skip to main content
Glama

browser_console_messages

Retrieve console messages from web pages to debug JavaScript errors, warnings, and logs during browser automation.

Instructions

Returns all console messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelNoLevel of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".info

Implementation Reference

  • The handler function that executes the browser_console_messages tool. It gets console messages from the current tab, formats them as a log, and returns an action to display the log as text content.
    handle: async context => { const messages = context.currentTabOrDie().consoleMessages(); const log = messages.map(message => `[${message.type().toUpperCase()}] ${message.text()}`).join('\n'); return { code: [`// <internal code to get console messages>`], action: async () => { return { content: [{ type: 'text', text: log }] }; }, captureSnapshot: false, waitForNetwork: false, }; },
  • The schema definition for the browser_console_messages tool, including name, title, description, empty input schema (no parameters), and readOnly type.
    schema: { name: 'browser_console_messages', title: 'Get console messages', description: 'Returns all console messages', inputSchema: z.object({}), type: 'readOnly', },
  • src/tools.ts:35-50 (registration)
    Registration of the browser_console_messages tool via inclusion of ...console in the snapshotTools array, which collects core tools for non-vision mode.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ];
  • src/tools.ts:52-66 (registration)
    Registration of the browser_console_messages tool via inclusion of ...console in the visionTools array, which collects tools for vision mode.
    export const visionTools: Tool<any>[] = [ ...common(false), ...console, ...dialogs(false), ...files(false), ...install, ...keyboard(false), ...navigate(false), ...network, ...pdf, ...tabs(false), ...testing, ...vision, ...wait(false), ];
  • Final tool list construction in MCP connection, selecting and filtering tools including browser_console_messages based on config.vision and capabilities.
    const allTools = config.vision ? visionTools : snapshotTools; const tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability));

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/Angeluis001/playwright-mcp'

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