Skip to main content
Glama

inspect_viewport

Inspect the Scenic viewport to analyze displayed content. This tool integrates with Scenic MCP, enabling AI-driven automation and testing for Scenic Elixir applications.

Instructions

Inspect the Scenic viewport to see what's currently displayed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'inspect_viewport' tool. Checks connection, sends 'inspect_viewport' command to Elixir server, parses response, and formats a detailed text summary of the viewport including visual description, semantic elements, clickable items, etc.
    async function handleInspectViewport(args: any) {
      try {
        const isRunning = await conn.checkTCPServer();
        if (!isRunning) {
          return {
            content: [
              {
                type: 'text',
                text: 'Cannot inspect viewport: No Scenic application connected.\n\nStart your Scenic application first to inspect its interface.',
              },
            ],
            isError: false,
          };
        }
    
        const command = {
          action: 'inspect_viewport',
        };
    
        const response = await conn.sendToElixir(command);
        const data = JSON.parse(response);
    
        if (data.error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error inspecting viewport: ${data.error}`,
              },
            ],
            isError: true,
          };
        }
    
        let inspectionText = `Viewport Inspection Results\n${'='.repeat(50)}\n\n`;
    
        if (data.visual_description) {
          inspectionText += `Visual Description: ${data.visual_description}\n`;
          inspectionText += `Script Count: ${data.script_count}\n\n`;
        }
    
        if (data.semantic_elements && data.semantic_elements.count > 0) {
          inspectionText += `Semantic DOM Summary\n${'-'.repeat(30)}\n`;
          inspectionText += `Total Elements: ${data.semantic_elements.count}\n`;
          inspectionText += `Clickable Elements: ${data.semantic_elements.clickable_count}\n`;
    
          if (data.semantic_elements.summary) {
            inspectionText += `Summary: ${data.semantic_elements.summary}\n`;
          }
    
          if (data.semantic_elements.by_type && Object.keys(data.semantic_elements.by_type).length > 0) {
            inspectionText += `\nElements by Type:\n`;
            for (const [type, count] of Object.entries(data.semantic_elements.by_type)) {
              inspectionText += `  - ${type}: ${count}\n`;
            }
          }
    
          const clickableElements = data.semantic_elements.elements?.filter((e: any) => e.clickable) || [];
          if (clickableElements.length > 0) {
            inspectionText += `\nClickable Elements:\n`;
            clickableElements.forEach((elem: any) => {
              const posStr = elem.position ? ` at (${elem.position.x}, ${elem.position.y})` : '';
              inspectionText += `  - ${elem.label || elem.type}${posStr}\n`;
              if (elem.description) {
                inspectionText += `    ${elem.description}\n`;
              }
            });
          }
        } else {
          inspectionText += `\nNo semantic DOM information available.\n`;
          inspectionText += `(Components need semantic annotations to appear here)\n`;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: inspectionText,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error inspecting viewport: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
  • Tool schema definition in getToolDefinitions(), including name, description, and empty inputSchema (no parameters required).
    {
      name: 'inspect_viewport',
      description: 'UI ANALYSIS: Get a detailed text-based description of what\'s currently displayed in the Scenic application. Perfect for understanding UI structure, finding clickable elements, and programmatic interface analysis. Use when you need to understand what\'s on screen without taking a screenshot.',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/tools.ts:200-201 (registration)
    Registration in the handleToolCall switch statement that routes calls to the inspect_viewport handler function.
    case 'inspect_viewport':
      return await handleInspectViewport(args);
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. It states the tool inspects the viewport but doesn't describe what 'inspect' entails operationally (e.g., returns a screenshot, text description, or structured data), whether it's read-only or has side effects, latency characteristics, or error conditions. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 front-loaded with the core action and target, making it immediately understandable. Every word earns its place with no redundancy or fluff.

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 tool has no annotations, no output schema, and a simple zero-parameter input schema, the description is incomplete. It doesn't explain what format the inspection returns (e.g., image data, text description, structured metadata), which is critical for an inspection tool. The agent knows what to inspect but not what to expect as a result.

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 with 100% schema description coverage (empty schema). The description doesn't need to explain any parameters, and it appropriately doesn't mention any. Since there are no parameters to document, this meets expectations for parameter semantics without needing compensation.

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 action ('inspect') and target ('Scenic viewport') with a specific purpose ('to see what's currently displayed'). It distinguishes from siblings like 'connect_scenic' or 'get_scenic_status' by focusing on visual content inspection rather than connection or status checking. However, it doesn't explicitly differentiate from potential visual inspection 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 alternatives like 'get_scenic_status' (which might provide status information) or other visual inspection methods. There's no mention of prerequisites (e.g., requires connection first), typical use cases, or limitations. The agent must infer usage from the purpose 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

Related 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/scenic-contrib/scenic_mcp_experimental'

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