Skip to main content
Glama

browser_console_messages

Read-only

Retrieve browser console messages from Playwright automation to monitor errors, warnings, and debug information during web testing and interaction.

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

  • Handler function that retrieves all console messages from the current browser tab, formats them with type prefixes, and returns as a text content block.
    handle: async context => {
      const messages = await context.currentTab().console();
      const log = messages.map(message => `[${message.type().toUpperCase()}] ${message.text()}`).join('\n');
      return {
        content: [{
          type: 'text',
          text: log
        }],
      };
    },
  • Defines the tool schema including name 'browser_console_messages', empty input schema using Zod (no parameters), and description.
    const consoleSchema = z.object({});
    
    const console: Tool = {
      capability: 'core',
      schema: {
        name: 'browser_console_messages',
        description: 'Returns all console messages',
        inputSchema: zodToJsonSchema(consoleSchema),
      },
  • Full tool definition and export as default array for registration in the MCP tools system.
    const console: Tool = {
      capability: 'core',
      schema: {
        name: 'browser_console_messages',
        description: 'Returns all console messages',
        inputSchema: zodToJsonSchema(consoleSchema),
      },
      handle: async context => {
        const messages = await context.currentTab().console();
        const log = messages.map(message => `[${message.type().toUpperCase()}] ${message.text()}`).join('\n');
        return {
          content: [{
            type: 'text',
            text: log
          }],
        };
      },
    };
    
    export default [
      console,
    ];
Behavior4/5

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

Annotations cover read-only, non-destructive, and open-world hints, but the description adds value by specifying 'all console messages,' implying a comprehensive retrieval. It doesn't contradict annotations (which indicate safe read operations) and provides context about scope, though it lacks details on format, pagination, or real-time behavior.

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 waste—'Returns all console messages' is front-loaded and directly conveys the core function. Every word earns its place, 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 (one optional parameter), rich annotations (readOnlyHint, openWorldHint), and no output schema, the description is minimally adequate. It covers the basic action but lacks details on return format, error handling, or dependencies, leaving gaps for an agent to infer behavior.

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 (including enum values, default, and description). The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline for high coverage without extra 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' beyond the resource type, and the title annotation 'Get console messages' is similar but not identical.

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 prerequisites (e.g., needing an active browser session), exclusions, or how it relates to siblings like 'browser_evaluate' or 'browser_run_code' that might generate console messages. Usage is implied only by the tool name and description.

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/markbustamante77/mcp'

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