Skip to main content
Glama
camoufox-reverse-mcp

camoufox-reverse-mcp

extract_script

Extract a JavaScript string from a captured response body or JSON path and optionally save it to a file, enabling patching of inline SDK code that lacks a script resource.

Instructions

Pull a script string out of a captured response and (optionally) save it.

Use this for SDK code that reaches the page through fetch + eval instead of a <script src> tag: such code has no script resource, so source search cannot see it and route rewriting cannot reach it. Extract it here, patch it locally, then serve the patched file back with intercept_request(action="mock", mock_response={"body_file": ...}).

Args: request_id: Captured request to read response_body from. Requires the body to have been captured (network_capture(capture_body=True)). body: Raw response text to use instead of a captured request (mutually exclusive with request_id). json_path: Dotted/bracketed JSON path to the script string, e.g. data.data or items[0].script. Pass an empty string when the body itself is the script. output_file: Write the extracted script here (UTF-8, regular file only). overwrite: Allow replacing an existing output_file. allow_partial: Allow extracting from a response body truncated by network_capture(max_body_size=...) (default False). preview_chars: Preview length in the response (never the whole script). max_inline_chars: Refuse to inline a script larger than this; ask for output_file instead.

Returns: dict with chars, sha256, preview, partial, and, when written, output = {path, bytes, sha256, encoding, chars}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "extract_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNo
json_pathNodata.data
overwriteNo
request_idNo
output_fileNo
allow_partialNo
preview_charsNo
max_inline_charsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.13.1

TDQS

A4.6/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 mostly succeeds: it discloses the write side effect, requires overwrite to replace an existing output_file, restricts output to a regular UTF-8 file, states that previews never contain the whole script, and explains the allow_partial refusal on truncated bodies. Gaps are minor — no description of failure modes when request_id lacks a captured body, or of what happens with very large inline results beyond max_inline_chars.

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 rationale and workflow are front-loaded before the Args block, and each entry earns its place. It is slightly verbose — the backtick-laden prose and repeated caveats ('never the whole script', 'regular file only') could be tightened — but nothing is genuinely filler.

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?

For an eight-parameter, no-output-schema tool this is nearly complete, and it compensates for the missing output schema by enumerating the return dict keys (chars, sha256, preview, partial, output). Only minor omissions remain, such as error behavior when extraction fails or the script string is absent at the given json_path.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate and it does: all eight parameters are documented, including the non-obvious mutual exclusivity of body and request_id, JSON path syntax examples ('data.data', 'items[0].script') with the empty-string special case, and the stated defaults for allow_partial and overwrite.

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 first sentence states a specific verb and resource ('Pull a script string out of a captured response') plus the optional save side effect. The follow-up identifies exactly what makes this tool necessary — code reached via fetch+eval has no script resource, so source search and route rewriting miss it — which distinguishes it from the sibling search/route tools without needing to name them.

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?

It names the trigger condition (SDK code loaded via fetch+eval instead of a <script src> tag) and lays out the end-to-end workflow: extract, patch locally, then serve back via intercept_request(action="mock", mock_response={body_file}). Preconditions are explicit, notably that the body must have been captured with network_capture(capture_body=True), and it points to the sibling that forces that flag.

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