Skip to main content
Glama
Angeluis001

Playwright MCP

by Angeluis001

browser_console_messages

Read-only

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));
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, covering safety and scope. The description adds minimal behavioral context by implying it retrieves messages (consistent with annotations) but doesn't disclose details like whether it clears messages after retrieval, requires specific browser state, or has rate limits. No contradiction with annotations exists.

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 a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a simple tool, making it easy to parse quickly.

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 the tool's low complexity (1 optional parameter), rich annotations (covering safety and scope), and no output schema, the description is minimally adequate. However, it lacks context about what 'console messages' entail (e.g., browser console logs, timestamps, sources) and doesn't address potential limitations or prerequisites, leaving gaps for an agent to infer usage.

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%, with the 'level' parameter fully documented in the schema (enum values, default, description). The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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

Purpose4/5

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

The description 'Returns all console messages' clearly states the verb ('returns') and resource ('console messages'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'browser_network_requests' or 'browser_tabs' which also return browser-related data, nor does it specify that these are browser console messages specifically.

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. It doesn't mention when it's appropriate (e.g., for debugging browser interactions) or when not to use it (e.g., for network monitoring where 'browser_network_requests' would be better). There's no reference to sibling tools or contextual usage scenarios.

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

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