Skip to main content
Glama

get_screenshot_info

Extract dimensions and basic metadata from webpage screenshots to support layout analysis and reconstruction.

Instructions

Get basic information about a screenshot image, including its dimensions (width and height in pixels).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screenshot_pathYesAbsolute path to the screenshot image file

Implementation Reference

  • The handler logic for the 'get_screenshot_info' tool within the call_tool function. It validates the screenshot path, calls the helper to get dimensions, formats the result as JSON, and returns it as TextContent.
    elif name == "get_screenshot_info":
        screenshot_path = arguments["screenshot_path"]
    
        if not Path(screenshot_path).exists():
            return [TextContent(
                type="text",
                text=json.dumps({"error": f"Screenshot not found: {screenshot_path}"})
            )]
    
        width, height = get_screenshot_dimensions(screenshot_path)
    
        result = {
            "path": screenshot_path,
            "width": width,
            "height": height,
        }
    
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The tool schema definition including name, description, and inputSchema for 'get_screenshot_info', provided in the list_tools handler.
    Tool(
        name="get_screenshot_info",
        description=(
            "Get basic information about a screenshot image, including its "
            "dimensions (width and height in pixels)."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "screenshot_path": {
                    "type": "string",
                    "description": "Absolute path to the screenshot image file",
                },
            },
            "required": ["screenshot_path"],
        },
    ),
  • Registration of the 'get_screenshot_info' tool (among others) in the @server.list_tools() handler, returning a list of Tool objects.
    return [
        Tool(
            name="find_assets_in_screenshot",
            description=(
                "Find known image assets within a screenshot. Uses template matching "
                "to locate each asset and return its position (x, y, width, height). "
                "Useful for determining where specific images appear in a webpage screenshot."
            ),
            inputSchema={
                "type": "object",
                "properties": {
                    "screenshot_path": {
                        "type": "string",
                        "description": "Absolute path to the screenshot image file",
                    },
                    "asset_paths": {
                        "type": "array",
                        "items": {"type": "string"},
                        "description": "List of absolute paths to asset images to find",
                    },
                    "threshold": {
                        "type": "number",
                        "description": "Match confidence threshold (0-1). Default 0.8",
                        "default": 0.8,
                    },
                },
                "required": ["screenshot_path", "asset_paths"],
            },
        ),
        Tool(
            name="analyze_layout",
            description=(
                "Analyze the layout of assets in a screenshot. Finds all assets, "
                "identifies the center/hero element, calculates relative positions "
                "(angle and distance from center), and detects the layout pattern "
                "(radial, grid, or freeform). Returns structured data for rebuilding "
                "the layout with semantic CSS."
            ),
            inputSchema={
                "type": "object",
                "properties": {
                    "screenshot_path": {
                        "type": "string",
                        "description": "Absolute path to the screenshot image file",
                    },
                    "asset_paths": {
                        "type": "array",
                        "items": {"type": "string"},
                        "description": "List of absolute paths to asset images to find",
                    },
                    "threshold": {
                        "type": "number",
                        "description": "Match confidence threshold (0-1). Default 0.8",
                        "default": 0.8,
                    },
                },
                "required": ["screenshot_path", "asset_paths"],
            },
        ),
        Tool(
            name="get_screenshot_info",
            description=(
                "Get basic information about a screenshot image, including its "
                "dimensions (width and height in pixels)."
            ),
            inputSchema={
                "type": "object",
                "properties": {
                    "screenshot_path": {
                        "type": "string",
                        "description": "Absolute path to the screenshot image file",
                    },
                },
                "required": ["screenshot_path"],
            },
        ),
    ]
  • Core helper function that implements the screenshot dimension extraction by loading the image with load_image and reading its shape.
    def get_screenshot_dimensions(screenshot_path: str) -> tuple[int, int]:
        """Get the dimensions of a screenshot."""
        img = load_image(screenshot_path)
        h, w = img.shape[:2]
        return (w, h)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves 'basic information' and 'dimensions', which implies a read-only operation, but doesn't clarify if it requires specific file permissions, handles errors (e.g., invalid paths), or has performance constraints. This leaves gaps in understanding the tool's behavior beyond its core function.

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 a single, well-structured sentence that efficiently conveys the tool's purpose and key output ('dimensions (width and height in pixels)'). It is front-loaded with the main action and avoids unnecessary details, making it easy for an agent to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage context, error handling, or output format (beyond mentioning dimensions), which could help the agent use it more effectively. Without annotations or output schema, more behavioral context would improve completeness.

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 input schema has 100% description coverage, clearly documenting the single parameter 'screenshot_path' as an absolute path. The description adds no additional semantic details about the parameter beyond what the schema provides, such as supported file formats or path validation. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to heavily.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Get basic information') and resources ('screenshot image'), including what information is retrieved ('dimensions (width and height in pixels)'). It distinguishes from siblings like 'analyze_layout' and 'find_assets_in_screenshot' by focusing on basic metadata rather than layout analysis or asset detection, though it doesn't explicitly name these alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its siblings ('analyze_layout', 'find_assets_in_screenshot'), such as for quick metadata checks versus detailed analysis. It implies usage for getting dimensions but lacks explicit context, prerequisites, or exclusions, leaving the agent to infer based on tool names alone.

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/katlis/layout-detector-mcp'

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