Skip to main content
Glama

screenshot

Capture a PNG screenshot of the full screen or a specific window, optionally writing it to disk to avoid oversized inline base64 responses. Use as a fallback when accessibility tools cannot identify UI elements.

Instructions

Capture a screenshot as PNG. Last resort; prefer accessibility tools.

Pass window_id to crop to a specific window, or omit for full screen. Pass output_path (e.g. '/tmp/shot.png') to write the PNG to disk and get back {ok, path, width, height}. Strongly preferred for any real-window capture, since base64-inline screenshots routinely overflow the response token budget. Without output_path, returns {ok, data, width, height} with base64-encoded PNG bytes.

width/height are pixel dimensions; on retina displays a window with 720×450 logical points captures at 1440×900 px. Divide by the window's point size to recover the scale factor for coordinate math.

Errors with {ok: False, error: ...} if window_id is given but the window cannot be located. Does NOT silently fall back to a full-desktop capture.

Caveat on Linux/KWin: per-window capture crops a full-screen shot to the target window's rectangle, because the KDE compositor won't let unprivileged clients capture individual windows. Any other window on top of the target will appear in the crop. Raise or close overlapping windows before capturing if isolation matters. Windows and macOS capture per-window at the compositor level and are unaffected.

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": "screenshot"
  }
}

Input Schema

NameRequiredDescriptionDefault
window_idNo
output_pathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the two distinct return shapes, warns about token-budget overflow from base64 payloads, states the failure behavior ({ok: False} when window_id is unresolvable) and explicitly denies a silent fallback to full-desktop capture. The KWin compositor caveat about overlapping windows bleeding into the crop is exactly the kind of non-obvious behavior an agent cannot infer elsewhere.

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?

Front-loaded with the routing rule, then parameters, then return shapes, then caveats — a sensible ordering. The Linux/KWin paragraph and the retina paragraph are long but each carries non-inferable information, so only slight trimming would be warranted.

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?

No output schema exists, yet the description documents both return variants, the error variant, and platform-specific capture semantics. For a two-parameter capture tool with no annotations, nothing an agent needs to call it correctly appears to be missing.

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

Parameters4/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: window_id is defined as a crop target, output_path as a disk-write that changes the response shape, and the retina/point-vs-pixel relationship for width/height is spelled out for coordinate math. Minor gap: no indication of what identifier format window_id accepts (matching the output of list_windows, presumably).

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?

States a specific verb and resource ('Capture a screenshot as PNG') and immediately positions itself against the accessibility-based siblings ('Last resort; prefer accessibility tools'). An agent can tell it apart from get_tree/find_elements without inspecting any schema.

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?

Explicitly gives the when-not ('last resort'), points to the preferred alternative family, and adds a second routing rule for output_path ('Strongly preferred for any real-window capture'). Both the capture decision and the invocation mode are covered.

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