Skip to main content
Glama

content_execute_predefined

Run a predefined external script and execute its JavaScript output in a specified tab, with per-tab/origin consent and profile-scoped IDs.

Instructions

Execute a predefined external script and run its JavaScript output in a tab

Generated JavaScript obeys the extension's per-tab/origin script consent. Each approval prompt expires after 60 seconds; queued tabs wait in turn.

profile_id is required: obtain it from profiles_list. All object IDs are local to that profile; never reuse them in another profile.

Available scripts:

  • dom-summarize.sh [onscreen [withpos]]: List the page's visible interactive elements as an indented tree, tagging each with a persistent dsid attribute to select it by later

  • gcal-cal-event-js.sh "Event Title" day time: In a Google Calendar tab, return one event's details (time, meeting links, attendees, attachments) as JSON

  • gcal-daily-events-js.sh day [month] [year]: In a Google Calendar tab, return one day's events in time order with RSVP status, as JSON

  • gcal-monthly-events-js.sh: In a Google Calendar month view, return every event grouped by day, with per-day counts, as JSON

  • set-file-input.py [file_id, CSS selector]: Assign a file loaded by content_load_file to a page's file input and release its handle

  • youtube-play-pause.sh [play|pause|toggle]: In a YouTube tab, play, pause or toggle the video and report its state; toggles by default

Input Schema

NameRequiredDescriptionDefault
tab_idYesID of the tab to execute script in
profile_idYes
script_argsNoJSON array of strings to pass to the external script (e.g., '["arg1", "arg2"]') or empty string for no arguments
script_nameYesName of the script to run, one of those listed above

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.6.0

TDQS

A4.4/5.0
Behavior4/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 substantial work: consent-per-tab/origin, 60-second approval-prompt expiry, queued tabs waiting in turn, and the warning that object IDs are profile-local and must not be reused. It does not classify which scripts mutate page state (set-file-input, youtube-play-pause) versus which are pure reads, leaving the safety profile partly inferred.

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 action, then behavioral constraints, then the required-parameter rule, then the catalog. The catalog is long but replaces a missing enum and every entry earns its place; the only slack is the preamble wording, which is slightly redundant with the name.

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?

An output schema exists, so return values need no explanation, and the description covers the remaining agent-critical unknowns: consent flow, prompt expiry, queueing, profile scoping, and the full script inventory with argument shapes. Nothing essential to a correct first invocation is missing.

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 75%, and the one undocumented parameter (profile_id) is compensated for directly in the description, including where to obtain it and its ID-scoping implications. The script_args semantics are also enriched beyond the schema by the per-script argument signatures (e.g. 'day [month] [year]', '[play|pause|toggle]').

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 — execute a *predefined* external script and run its JavaScript output in a tab — and immediately enumerates the concrete script catalog, which distinguishes it from the generic content_execute_script sibling. An agent knows exactly what class of operation this is without opening the schema.

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 per-script usage context (e.g. 'In a Google Calendar tab', 'In a YouTube tab'), argument syntax for each script, and the profile_id prerequisite with its source tool (profiles_list). It never explicitly says when to choose this over content_execute_script for ad-hoc JS, so the alternative-routing is implied rather than stated.

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