Skip to main content
Glama

browser_console_messages

Read-only

Retrieve console messages from web pages to monitor JavaScript errors, warnings, and logs during browser automation testing with Playwright.

Instructions

Returns all console messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'browser_console_messages' tool. It iterates over console messages from the current tab and adds each as a result to the response.
    handle: async (tab, params, response) => {
      tab.consoleMessages().map(message => response.addResult(message.toString()));
    },
  • Schema definition for the tool, specifying name, title, description, no input parameters, and read-only type.
    schema: {
      name: 'browser_console_messages',
      title: 'Get console messages',
      description: 'Returns all console messages',
      inputSchema: z.object({}),
      type: 'readOnly',
    },
  • Local registration: exports the defined tool in an array for aggregation.
    export default [
      console,
    ];
  • src/tools.ts:36-52 (registration)
    Global registration: imports and spreads the console tool (among others) into the allTools array, which is used to provide the complete set of tools.
    export const allTools: Tool<any>[] = [
      ...common,
      ...console,
      ...dialogs,
      ...evaluate,
      ...files,
      ...install,
      ...keyboard,
      ...navigate,
      ...network,
      ...mouse,
      ...pdf,
      ...screenshot,
      ...snapshot,
      ...tabs,
      ...wait,
    ];
Behavior4/5

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

Annotations provide readOnlyHint=true, destructiveHint=false, and openWorldHint=true, indicating a safe, read-only operation with potentially unbounded data. The description adds value by specifying 'all console messages', hinting at comprehensiveness, though it doesn't detail format, pagination, or rate limits. No contradiction with annotations.

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 'Returns all console messages' is a single, efficient sentence that front-loads the core purpose without unnecessary words. It's appropriately sized for a simple tool with no parameters.

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 simplicity (0 parameters, no output schema) and rich annotations (read-only, non-destructive, open-world), the description is adequate but lacks details on output format, timing, or context. It's complete enough for basic use but could benefit from more behavioral context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it appropriately doesn't mention any, earning a baseline score for zero-parameter tools.

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

Purpose3/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'), but it's vague about scope and doesn't distinguish from siblings like 'browser_evaluate' or 'browser_network_requests'. It doesn't specify what type of console messages (e.g., browser console logs) or from what context.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing an active browser session) or compare it to siblings like 'browser_network_requests' for different debugging purposes. Usage is implied but not explicitly stated.

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

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