Skip to main content
Glama

Add Init Script

add_init_script

:

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 carries full burden and successfully discloses the key behavioral trait: persistence across navigations (explicitly calling out Playwright built-in behavior). Also clarifies execution timing (before page scripts). Missing reversibility details (how to remove), but covers the critical persistence side-effect.

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 tightly constructed sentences: core action (inject JS), behavioral trait (persistence), and use cases. Every sentence earns its place with zero redundancy. Front-loaded with the essential verb and scope.

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?

Given 100% schema coverage but no annotations and no output schema, the description appropriately focuses on the persistence behavior—a critical operational detail for stateful injection. Could be improved with a brief note on error handling or cleanup, but adequately covers the essential contract for a setup/injection tool.

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%, establishing a baseline of 3. The description frames the temporal context ('before every page load') which complements the schema descriptions, but doesn't add specific syntax, format constraints, or examples beyond what's already defined in the schema properties.

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?

Excellent clarity: 'Inject JavaScript' provides specific verb and resource, 'before every page load in a session' defines scope/timing, and use cases (fingerprint overrides, stealth patches) distinguish it from immediate execution tools like 'execute' in the sibling list.

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 persistence note ('Persists across navigations') provides critical context for when to use this versus one-time execution tools. Use cases listed (fingerprinting, instrumentation) guide selection. Lacks explicit 'when-not' or named alternatives (e.g., 'use execute for one-time scripts'), but the persistence behavior is strong implied guidance.

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