Skip to main content
Glama

browser_console_messages

Retrieve and analyze console messages from web pages using Playwright MCP, enabling structured monitoring and debugging of browser interactions without visual dependencies.

Instructions

Returns all console messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that retrieves all console messages from the current browser tab, formats them with type prefixes, and returns a tool result with an action to display the formatted 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, }; },
  • Defines the tool schema including the name 'browser_console_messages', 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', },
  • Registers the tool by exporting it in a default array, which is imported and spread into the main tool lists in src/tools.ts.
    console, ];

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