Skip to main content
Glama

Add Init Script

add_init_script

Inject JavaScript before each page load to override fingerprints, apply stealth patches, or instrument pages across navigations.

Instructions

Inject JavaScript that runs before every page load in a session. Persists across navigations (Playwright built-in behavior). Use for fingerprint overrides, custom stealth patches, or page instrumentation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID.
scriptYesJavaScript code to inject. Runs in page context before any page scripts.
Behavior4/5

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

With no annotations, the description discloses key behaviors: runs before every page load, persists across navigations, and executes in page context before page scripts. This compensates for missing annotations, though it could mention potential side effects.

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?

Three sentences, each adding unique value: action + persistence + use cases. No redundant words. Front-loaded with primary purpose.

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

Completeness4/5

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

Despite no output schema or annotations, the description covers purpose, usage, and a critical behavioral trait (persistence). Slight omission of return value or script limits, but adequate for the tool's simplicity.

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 coverage is 100%, so baseline is 3. The description adds minimal value beyond what the schema already provides for 'script' parameter (both mention 'before page scripts'). No additional semantic guidance for 'sessionId'.

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?

The description clearly states the tool injects JavaScript that runs before every page load and persists across navigations. It distinguishes from siblings like 'execute' by emphasizing persistence and automatic re-execution, not just one-time execution.

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?

The description explicitly lists use cases: fingerprint overrides, stealth patches, page instrumentation. It does not mention when not to use or alternatives, but the provided guidance is strong enough for correct selection.

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/anthonybono21-cloud/leapfrog'

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