screenshot
Capture screenshots of web pages to document or analyze content. Specify a URL to generate full-page or partial screenshots for visual reference.
Instructions
Capture a screenshot of a URL. Costs 2 credits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to screenshot | |
| full_page | No | Capture full page (default: true) |
Implementation Reference
- src/index.ts:132-140 (registration)Tool registration for 'screenshot' - registers the screenshot tool with the MCP server, defining its name, description, input schema (url and full_page parameters), and handler function
server.tool( "screenshot", "Capture a screenshot of a URL. Costs 2 credits.", { url: z.string().describe("URL to screenshot"), full_page: z.boolean().optional().default(true).describe("Capture full page (default: true)"), }, async ({ url, full_page }) => jsonResult(await apiPost("/screenshot", { url, full_page })) ); - src/index.ts:139-139 (handler)Handler function for screenshot tool - async arrow function that calls apiPost('/screenshot', { url, full_page }) and returns the JSON-formatted result
async ({ url, full_page }) => jsonResult(await apiPost("/screenshot", { url, full_page })) - src/index.ts:135-138 (schema)Input schema for screenshot tool using Zod - defines 'url' as required string and 'full_page' as optional boolean with default true
{ url: z.string().describe("URL to screenshot"), full_page: z.boolean().optional().default(true).describe("Capture full page (default: true)"), }, - src/index.ts:41-59 (helper)apiPost helper function - makes POST requests to the SearchClaw API with timeout handling and error management, used by screenshot tool to call the /screenshot endpoint
async function apiPost(path: string, body: Record<string, unknown>) { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 30000); try { const response = await fetch(`${API_BASE}${path}`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify(body), signal: controller.signal, }); if (!response.ok) { const text = await response.text(); throw new Error(`SearchClaw API error ${response.status}: ${text}`); } return response.json(); } finally { clearTimeout(timeout); } } - src/index.ts:61-63 (helper)jsonResult helper function - formats API response data into MCP tool result format with text content type
function jsonResult(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }