Skip to main content
Glama
nfodor

Chromium ARM64 Browser

by nfodor

get_selected_element

Retrieve information about the currently selected web element for browser automation and testing workflows on ARM64 devices.

Instructions

Get information about the currently selected element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implements the core logic for the 'get_selected_element' tool by using CDP Runtime.evaluate to inspect document.activeElement and extract tag name, id, classes, text, value, and selector. Returns formatted JSON or a no-selection message.
    async getSelectedElement() {
      await this.ensureChromium();
      const result = await this.sendCDPCommand('Runtime.evaluate', {
        expression: `
          const activeElement = document.activeElement;
          if (activeElement && activeElement !== document.body) {
            JSON.stringify({
              tagName: activeElement.tagName,
              id: activeElement.id,
              className: activeElement.className,
              textContent: activeElement.textContent?.substring(0, 100),
              value: activeElement.value || null,
              selector: activeElement.id ? \`#\${activeElement.id}\` : 
                       activeElement.className ? \`.\${activeElement.className.split(' ')[0]}\` :
                       activeElement.tagName.toLowerCase()
            });
          } else {
            null;
          }
        `,
        returnByValue: true
      });
      
      const selectedElement = result.result?.value ? JSON.parse(result.result.value) : null;
      
      return {
        content: [{ type: 'text', text: selectedElement ? JSON.stringify(selectedElement, null, 2) : 'No element currently selected' }],
      };
    }
  • index.js:272-278 (registration)
    Registers the tool in the ListToolsRequestSchema handler with name, description, and empty input schema (no parameters required).
      name: 'get_selected_element',
      description: 'Get information about the currently selected element',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Defines the input schema as an empty object (no required parameters).
    inputSchema: {
      type: 'object',
      properties: {},
    },
  • index.js:377-378 (registration)
    Dispatches calls to the getSelectedElement handler in the CallToolRequestSchema switch statement.
    case 'get_selected_element':
      return await this.getSelectedElement();
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Get information' implies a read operation, it doesn't specify what information is returned (e.g., element properties, attributes, position), whether it requires specific permissions, or how it interacts with the selection state. The description is too vague about the actual behavior.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool and front-loads the core functionality.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what 'information' means in this context, what format it returns, or how it relates to the selection state. For a tool in a browser automation context with many sibling tools, more specificity about the return value and usage context is needed.

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?

The tool has zero parameters, and schema description coverage is 100% (though trivial since there are no parameters). The description appropriately doesn't discuss parameters, which aligns with the schema. A baseline of 4 is appropriate for zero-parameter tools when the description doesn't need to compensate for schema gaps.

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 verb ('Get information about') and resource ('the currently selected element'), making the purpose unambiguous. It doesn't explicitly differentiate from sibling tools like 'get_content' or 'select', but the focus on 'currently selected element' provides reasonable implicit distinction.

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 alternatives like 'get_content' or 'select'. It doesn't mention prerequisites (e.g., whether an element must already be selected), nor does it suggest when other tools might be more appropriate.

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/nfodor/mcp-chromium-arm64'

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