Skip to main content
Glama

screenshot

Capture the active tab and obtain base64 PNG, URL, title, and detection of 2FA, captcha, or payment prompts. Use after each interaction to verify page state and identify handoff triggers.

Instructions

Capture the active tab. Returns base64 PNG, URL, title, and any detected handoff triggers (2FA, captcha, payment prompts). Call this after every action to verify state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullPageNoFull scrollable page (default false)

Implementation Reference

  • The core screenshot tool handler — captures a Playwright page screenshot as PNG, returns base64, URL, title, and detects handoff triggers (2FA, captcha, etc.).
    async function screenshot(args: { fullPage?: boolean }) {
      const p = requirePage();
      const buf = await p.screenshot({ fullPage: args.fullPage ?? false, type: 'png' });
      // Sniff for handoff triggers in visible text. Cheap and very useful.
      const text = await p.evaluate(() => document.body?.innerText?.slice(0, 20000) ?? '');
      const triggers = detectHandoffTriggers(text);
      return {
        base64: buf.toString('base64'),
        url: p.url(),
        title: await p.title().catch(() => ''),
        handoffTriggers: triggers,
      };
    }
  • Tool registration with input schema defining the 'screenshot' tool's input (optional boolean `fullPage`) and description.
    {
      name: 'screenshot',
      description:
        'Capture the active tab. Returns base64 PNG, URL, title, and any detected handoff ' +
        'triggers (2FA, captcha, payment prompts). Call this after every action to verify state.',
      inputSchema: {
        type: 'object',
        properties: { fullPage: { type: 'boolean', description: 'Full scrollable page (default false)' } },
      },
    },
  • src/index.ts:464-464 (registration)
    Dispatch in CallToolRequestSchema handler routing the 'screenshot' tool name to the screenshot function.
    case 'screenshot':   result = await screenshot(args as { fullPage?: boolean }); break;
  • src/index.ts:475-485 (registration)
    Special response formatting for screenshot — extracts the base64 image data and returns it as an image content block so Claude can view it, plus metadata as text.
    // Screenshot returns image content as a separate block so Claude can actually look at it.
    if (name === 'screenshot' && result && typeof result === 'object' && 'base64' in result) {
      const r = result as { base64: string; url: string; title: string; handoffTriggers: string[] };
      const meta = { url: r.url, title: r.title, handoffTriggers: r.handoffTriggers };
      return {
        content: [
          { type: 'image', data: r.base64, mimeType: 'image/png' },
          { type: 'text', text: JSON.stringify(meta, null, 2) },
        ],
      };
    }
  • Helper used by screenshot handler — scans text for handoff triggers like 2FA, captcha, payment prompts.
    function detectHandoffTriggers(text: string): string[] {
      const found = new Set<string>();
      for (const [rx, label] of HANDOFF_PATTERNS) {
        if (rx.test(text)) found.add(label);
      }
      return [...found];
    }
Behavior4/5

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

With no annotations, the description fully discloses behavioral traits: it captures the active tab, returns specific data, and detects handoff triggers. It implies a read-only operation but does not elaborate on side effects or permissions; however, the key behaviors are transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no wasted words. It front-loads the primary action and immediately details the return value and recommended usage. Every sentence earns its place.

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?

Given the tool's simplicity (one optional parameter) and lack of output schema, the description is complete: it clarifies the parameter, the return format, and when to use it. No additional information is needed for an agent to select and invoke it correctly.

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

Parameters3/5

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

The schema provides 100% coverage for the single parameter ('fullPage'), including a description. The description does not add any further semantics beyond what the schema already states, so a baseline score of 3 is appropriate.

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 specifies 'Capture the active tab' and lists exact return contents (base64 PNG, URL, title, handoff triggers), making it clear what the tool does and differentiating it from siblings like 'click' or 'inspect'.

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

Usage Guidelines4/5

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

The description explicitly advises 'Call this after every action to verify state,' providing a clear usage context. It does not mention when not to use or alternatives, but the guidance is sufficiently directive.

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/flying-pisces/mcp-helm'

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