Skip to main content
Glama

get_script_source

Read-only

Read a specific region of script source code without executing or pausing the page. Use URL for stable identification or scriptId for inline/eval scripts.

Instructions

Reads a small source region around a search match, paused location, or known statement without executing or pausing the page. Select by URL when available because URL-backed scripts can be resolved again after navigation; use the debugger-context-scoped scriptId only for current inline/eval scripts. Use line ranges for normal source and offset/length for minified single-line bundles. For a whole, minified, or WASM source, use save_script_source; to observe runtime values next, call set_breakpoint_on_text against the original loaded source.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoURL from list_scripts, search_in_sources, or a call stack. Preferred stable selector for URL-backed scripts; resolution tries an exact match before a substring match, so provide enough of the URL to avoid ambiguity.
lengthNoMaximum characters to return from offset (default: 1000). This is ignored unless offset is provided.
offsetNoZero-based character offset into the original source. Use for a bounded read of minified single-line code when line ranges would be too large.
endLineNoInclusive 1-based end line for a bounded multi-line snippet. Omit both line bounds and use offset/length for a minified single-line bundle.
scriptIdNoDebugger-context-scoped script ID from list_scripts, search_in_sources, or paused information. Required for unnamed inline/eval scripts, but invalid after reload, navigation, or debugger target/frame change; prefer url for external scripts.
startLineNoInclusive 1-based start line, typically copied from search_in_sources or paused information. Use with endLine for normal multi-line source.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool completed successfully.
dataNoMachine-readable result payload.
toolYesStable MCP tool name.
errorNo
summaryYesConcise human-readable outcome.
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds that it doesn't execute or pause the page, and discloses that scriptId is invalid after reload/navigation. This provides critical behavioral context beyond the annotations.

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?

The description is front-loaded with purpose and core guidance. It is slightly verbose but each sentence serves a distinct instructional purpose. Could be tightened, but remains efficient for the complexity.

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?

Despite 6 parameters and many sibling tools, the description covers selection strategies (URL vs scriptId), parameter combinations (line ranges vs offset/length), edge cases (scriptId invalidation, default length), and explicit alternatives (save_script_source, set_breakpoint_on_text). The output schema exists, so return values are not needed in the description.

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 100%, so the schema documents all 6 parameters. However, the description adds meaningful usage guidance: 'preferred stable selector' for url, 'ignored unless offset is provided' for length, 'for minified single-line code' for offset, 'inclusive 1-based' for lines, and invalidation conditions for scriptId. This enriches the schema without redundancy.

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 starts with a specific verb ('Reads') and resource ('small source region'), and immediately clarifies scope ('around a search match, paused location, or known statement') and what it does not do ('without executing or pausing the page'). It also distinguishes from sibling tools like save_script_source and set_breakpoint_on_text.

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

Usage Guidelines5/5

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

Explicitly advises when to use URL vs scriptId ('prefer URL for external scripts'), when to use line ranges vs offset/length ('normal source' vs 'minified single-line bundles'), and provides alternatives for whole/minified/WASM source ('use save_script_source') and for runtime values ('call set_breakpoint_on_text'). Also explains when scriptId becomes invalid.

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/zhizhuodemao/js-reverse-mcp'

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