Skip to main content
Glama

highlight_element

Briefly flash-highlight a specific element on a web page to visually indicate the element being referenced, aiding in confirmation and precise annotation.

Instructions

Briefly flash-highlight a specific element on the page so the user can see which element you are referring to. Useful for confirming "do you mean this element?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe element name or CSS selector to highlight

Implementation Reference

  • The tool handler for 'highlight_element'. It receives 'name' (element name or CSS selector) and calls proxy.highlight(name) to queue a highlight command.
    async ({ name }) => {
      proxy.highlight(name);
      return {
        content: [{
          type: 'text',
          text: `Highlighted "${name}" on the page. The user should see a brief red flash around the element.`,
        }],
      };
    }
  • src/index.js:99-115 (registration)
    Registration of the 'highlight_element' tool via mcp.tool() with Zod schema for 'name' parameter.
    // Tool 3: Highlight a specific element
    mcp.tool(
      'highlight_element',
      'Briefly flash-highlight a specific element on the page so the user can see which element you are referring to. Useful for confirming "do you mean this element?"',
      {
        name: z.string().describe('The element name or CSS selector to highlight'),
      },
      async ({ name }) => {
        proxy.highlight(name);
        return {
          content: [{
            type: 'text',
            text: `Highlighted "${name}" on the page. The user should see a brief red flash around the element.`,
          }],
        };
      }
    );
  • Zod schema definition for the 'name' input parameter of highlight_element tool.
    {
      name: z.string().describe('The element name or CSS selector to highlight'),
    },
  • The proxy.highlight() helper that pushes a { type: 'highlight', name } command to pendingCommands, which the browser polls and executes.
    highlight: (name) => { pendingCommands.push({ type: 'highlight', name }); },
    rescan: () => { pendingCommands.push({ type: 'scan' }); },
  • The client-side highlightByName() function that runs in the browser. It finds the element by name/selector, creates a red flash overlay div, and removes it after 2 seconds.
    function highlightByName(name) {
      const match = elements.find(e => e.name === name || e.selector === name);
      if (!match) return;
      const el = document.querySelector(match.selector);
      if (!el) return;
      const rect = el.getBoundingClientRect();
      const flash = document.createElement('div');
      flash.setAttribute('data-ui-annotator', '1');
      flash.style.cssText = 'position:fixed;border:3px solid #e11d48;background:rgba(225,29,72,0.1);z-index:99997;pointer-events:none;border-radius:' + (getComputedStyle(el).borderRadius || '0') + ';transition:opacity .5s;';
      flash.style.left = (rect.left - 4) + 'px';
      flash.style.top = (rect.top - 4) + 'px';
      flash.style.width = (rect.width + 8) + 'px';
      flash.style.height = (rect.height + 8) + 'px';
      document.body.appendChild(flash);
      setTimeout(() => { flash.style.opacity = '0'; }, 1500);
      setTimeout(() => flash.remove(), 2000);
    }
Behavior3/5

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

No annotations are provided, so the description must convey behavior. It states 'briefly flash-highlight', indicating a temporary visual effect, but lacks details like duration, effect on page state, or whether it works on hidden elements. Adequate but not exhaustive.

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?

Two sentences: first states action, second provides use case. No wasted words, front-loaded with key information.

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?

For a simple tool with one parameter and no output schema, the description covers purpose and usage adequately. Lacks information on return value, but likely void (highlight action). Minor gap but otherwise complete.

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?

Input schema has 100% description coverage for the single parameter 'name', so the schema already explains it. The description adds 'flash-highlight' context but does not enhance parameter meaning beyond the schema baseline.

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 clearly states the tool flashes a highlight on an element, explicitly distinguishing its purpose from siblings like annotate or get_elements by emphasizing visual confirmation for disambiguation.

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 provides a specific use case ('confirming which element you refer to'), which implies when to use, but does not explicitly mention when not to use or suggest alternative tools.

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/mcpware/ui-annotator-mcp'

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