Skip to main content
Glama

check_dark_mode

Detect dark mode support on webpages by comparing light and dark screenshots to verify proper implementation and calculate visual differences.

Instructions

Detect whether a webpage supports dark mode. Captures two screenshots — one in light mode and one with prefers-color-scheme: dark emulated — then compares them. Returns both screenshots and a difference percentage. Great for checking if dark mode is properly implemented.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the page to check

Implementation Reference

  • The main handler function `checkDarkMode` that performs the logic of capturing light and dark mode screenshots and comparing them.
    export async function checkDarkMode(url: string): Promise<DarkModeResult> {
      const lightBase64 = await captureLightScreenshot(url);
      const darkBase64 = await captureDarkScreenshot(url);
    
      const differencePercent = calculateBase64DifferencePercent(
        lightBase64,
        darkBase64
      );
    
      return {
        hasDarkMode: differencePercent > 0,
        differencePercent,
        lightScreenshot: { base64: lightBase64, mimeType: "image/png" },
        darkScreenshot: { base64: darkBase64, mimeType: "image/png" },
        url,
        timestamp: new Date().toISOString(),
      };
    }
  • Type definition for the result returned by `checkDarkMode`.
    export interface DarkModeResult {
      readonly hasDarkMode: boolean;
      readonly differencePercent: number;
      readonly lightScreenshot: DarkModeScreenshot;
      readonly darkScreenshot: DarkModeScreenshot;
      readonly url: string;
      readonly timestamp: string;
    }
  • src/server.ts:352-360 (registration)
    Tool registration for `check_dark_mode` in `src/server.ts`.
    server.tool(
      "check_dark_mode",
      "Detect whether a webpage supports dark mode. Captures two screenshots — one in light mode and one with prefers-color-scheme: dark emulated — then compares them. Returns both screenshots and a difference percentage. Great for checking if dark mode is properly implemented.",
      {
        url: z.string().url().describe("URL of the page to check"),
      },
      async ({ url }) => {
        try {
          const result = await checkDarkMode(url);
Behavior4/5

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

With no annotations provided, the description carries the full burden and effectively discloses the internal mechanism: it captures two screenshots (light and dark emulated), compares them, and returns a difference percentage. It explains what the tool does under the hood beyond the input schema, though it omits auth requirements or rate limits.

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?

Four sentences efficiently structured: purpose (sentence 1), mechanism (sentence 2), return values (sentence 3), and usage context (sentence 4). Every sentence earns its place with no redundant or tautological content; information is front-loaded with the core purpose.

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

Completeness4/5

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

Compensates effectively for the missing output schema by explicitly stating what the tool returns ('both screenshots and a difference percentage'). For a single-parameter tool with simple inputs, the description provides sufficient behavioral and return-value context to be actionable without an output schema.

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 ('URL of the page to check'), establishing a baseline of 3. The description references 'webpage' which aligns with the URL parameter but does not add additional semantic context, constraints, or format examples beyond what the schema already provides.

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 opens with a specific verb ('Detect') and resource ('whether a webpage supports dark mode'), clearly stating the tool's function. The mechanism explanation ('Captures two screenshots... with prefers-color-scheme: dark emulated') distinguishes it from generic screenshot siblings like 'screenshot' or 'compare_screenshots' by specifying the dark-mode-specific emulation approach.

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?

Provides clear usage context with 'Great for checking if dark mode is properly implemented,' establishing the specific use case. However, it stops short of explicitly naming sibling alternatives (e.g., when to use this versus generic 'screenshot' or 'compare_screenshots'), which would be needed for a 5.

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/prembobby39-gif/uimax-mcp'

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