Skip to main content
Glama
camoufox-agent

camoufox-agent

by VolanDeVovan

javascript_tool

Executes JavaScript in a browser tab and returns the last expression's value or a top-level return, awaiting promises. Runs in the page's main world or an isolated world.

Instructions

Run JavaScript in a tab and return the value of the last expression, or of a top-level return (promises are awaited; the value must be JSON-serializable, DOM nodes cannot be returned). world "main" (default) is the page's own world; "isolated" cannot be seen by the page and sees no page-defined globals. The result is returned as is: this is the one tool whose output is NOT masked, so do not print cookies or tokens you do not need. Do not call alert / confirm / prompt without arming handle_dialog.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "text": "<text>"
    },
    "name": "javascript_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesJavaScript. The result is the value of the last expression, or of a top-level return.
tabIdNoTab to act on, from tabs_context. Omitted: this session's active tab. Pass it always when several agents share the session.
worldNo
max_charsNoCap on the result size (default 20000).
timeout_sNoSeconds before giving up (default 20).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does it well: promises are awaited, the value must be JSON-serializable, DOM nodes cannot be returned, and world semantics are spelled out. It also flags the security-critical trait that this is the only tool whose output is NOT masked, warning against dumping cookies or tokens.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core behavior and tightly packed with useful facts — return semantics, world choice, security caveat, dialog caveat. The security and dialog warnings are dense but each sentence carries distinct information; slight run-on phrasing is the only cost.

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

Completeness5/5

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

For a 5-parameter mutation-capable tool with no output schema and no annotations, the description covers the points an agent actually needs: how the return value is produced and constrained, which world executes, and the two sharp edges (unmasked output, blocking dialogs). Nothing essential to safe invocation is absent.

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?

Schema coverage is 80%, so the baseline is 3; the description adds real meaning beyond the schema by explaining the behavioral difference between the 'main' and 'isolated' worlds, which the enum alone does not convey. It also restates the return semantics of `text`, though tabId, max_chars, and timeout_s are left to the schema.

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

Purpose5/5

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

States a specific verb and resource ('Run JavaScript in a tab') plus exactly what is returned (last expression, or a top-level return). It also scopes the tool against handle_dialog and warns about unmasked output, so an agent can tell it apart from extraction siblings like get_page_text or find.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete routing guidance: use 'main' vs 'isolated' based on whether page globals are needed, and never call alert/confirm/prompt without first arming handle_dialog. It does not say when to prefer declarative siblings (find, extract_table, form_input) over arbitrary JS, which is the main missing exclusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.