Skip to main content
Glama
Wladastic

AutoProbeMCP

by Wladastic

evaluate_javascript

Execute JavaScript directly in the browser context to interact with web pages, automate tasks, or extract data using AutoProbeMCP’s browser automation capabilities.

Instructions

Execute JavaScript in the browser context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code to execute

Implementation Reference

  • Handler for 'evaluate_javascript' tool: checks for current page, parses input with schema, executes the JavaScript using page.evaluate(), and returns the result as a JSON-formatted string.
    case 'evaluate_javascript': {
      if (!currentPage) {
        throw new Error('No browser page available. Launch a browser first.');
      }
    
      const params = EvaluateJavaScriptSchema.parse(args);
      const result = await currentPage.evaluate(params.script);
    
      return {
        content: [
          {
            type: 'text',
            text: `JavaScript result: ${JSON.stringify(result, null, 2)}`
          }
        ]
      };
    }
  • Zod schema defining the input for evaluate_javascript: requires a 'script' string.
    const EvaluateJavaScriptSchema = z.object({
      script: z.string()
    });
  • src/index.ts:281-294 (registration)
    Tool registration in the list_tools response: defines name, description, and input schema matching the Zod schema.
    {
      name: 'evaluate_javascript',
      description: 'Execute JavaScript in the browser context',
      inputSchema: {
        type: 'object',
        properties: {
          script: {
            type: 'string',
            description: 'JavaScript code to execute'
          }
        },
        required: ['script']
      }
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action (execute JavaScript) but lacks behavioral details: it doesn't specify security implications (e.g., sandboxing), performance impact (e.g., execution time), error handling, or what happens if the browser isn't open. For a tool that executes arbitrary code, this is a significant gap in transparency.

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: 'Execute JavaScript in the browser context'. It is front-loaded with the core action and context, making it immediately understandable without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing JavaScript (a potentially powerful/dangerous operation), no annotations, no output schema, and 100% schema coverage, the description is incomplete. It doesn't explain return values (e.g., what the execution yields), error cases, or dependencies on other tools like launch_browser. For a tool with no structured safety hints, more descriptive context is needed.

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 single parameter 'script' documented as 'JavaScript code to execute'. The description adds no additional meaning beyond this, such as syntax examples, supported JavaScript features, or constraints (e.g., no async operations). Baseline 3 is appropriate since the schema adequately covers the parameter.

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 'Execute JavaScript in the browser context' clearly states the action (execute) and resource (JavaScript), specifying the execution context (browser). It distinguishes from siblings like get_element_text or navigate by focusing on code execution rather than UI interaction or navigation. However, it doesn't explicitly differentiate from potential similar tools like get_console_logs that also involve JavaScript output.

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., requires an active browser session), use cases (e.g., for dynamic content manipulation), or exclusions (e.g., not for simple text extraction). With siblings like click_element and type_text for UI actions, the lack of comparative context leaves usage unclear.

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

Related 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/Wladastic/AutoProbeMCP'

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