Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesURL to screenshot
full_pageNoCapture 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 }))
    );
  • 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 }))
  • 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)"),
    },
  • 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);
      }
    }
  • 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) }] };
    }

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/CSteenkamp/searchclaw-mcp'

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