screenshot
Capture web page screenshots with customizable viewport settings, full-page option, image format choice, and controlled wait times for precise and detailed captures.
Instructions
Capture screenshots of web pages with customizable settings.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| autoScroll | No | Auto-scroll page | |
| blockCookieBanners | No | Block cookie banners | |
| clipRectangle | No | Area to clip | |
| deviceScaleFactor | No | Device scale factor | |
| format | No | Image format | |
| fullPage | No | Capture full page | |
| height | No | Viewport height | |
| quality | No | Image quality (1-100) | |
| renderJs | No | Render JavaScript | |
| url | Yes | URL to capture | |
| wait | No | Wait time in ms before capture | |
| width | No | Viewport width |
Implementation Reference
- src/index.ts:476-517 (handler)The handler function for the 'screenshot' tool. It validates the API key, constructs a POST request to the external Dumpling AI screenshot endpoint with the provided parameters, handles errors, and returns the JSON response as text content.async ({ url, width, height, deviceScaleFactor, fullPage, format, quality, renderJs, wait, clipRectangle, blockCookieBanners, autoScroll, }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/screenshot`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ url, width, height, deviceScaleFactor, fullPage, format, quality, renderJs, waitFor: wait, clipRectangle, blockCookieBanners, autoScroll, }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:445-475 (schema)Zod schema defining the input parameters for the 'screenshot' tool, including required URL and optional screenshot customization options.{ url: z.string().url().describe("URL to capture"), width: z.number().optional().describe("Viewport width"), height: z.number().optional().describe("Viewport height"), deviceScaleFactor: z.number().optional().describe("Device scale factor"), fullPage: z.boolean().optional().describe("Capture full page"), format: z.enum(["png", "jpeg"]).optional().describe("Image format"), quality: z.number().optional().describe("Image quality (1-100)"), renderJs: z.boolean().optional().describe("Render JavaScript"), wait: z .number() .min(0) .max(5000) .default(0) .describe("Wait time in ms before capture"), clipRectangle: z .object({ top: z.number(), left: z.number(), width: z.number(), height: z.number(), }) .optional() .describe("Area to clip"), blockCookieBanners: z .boolean() .optional() .default(true) .describe("Block cookie banners"), autoScroll: z.boolean().optional().describe("Auto-scroll page"), },
- src/index.ts:441-444 (registration)Registration of the 'screenshot' MCP tool using server.tool(), specifying the tool name and description. The schema and handler follow inline.// Tool to capture screenshots server.tool( "screenshot", "Capture screenshots of web pages with customizable settings.",