Skip to main content
Glama

check_orientation_lock

Test HTML content to detect forced orientation locks and ensure compliance with web accessibility standards. Identify issues that restrict user flexibility in viewing content.

Instructions

Check if content forces a specific orientation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
htmlYesHTML content to test for orientation lock issues

Implementation Reference

  • The handler function that implements the check_orientation_lock tool. It uses Puppeteer to load the provided HTML, runs Axe accessibility analysis focused on the meta-viewport rule, checks for orientation-specific restrictions in viewport meta tags, and additionally scans CSS for orientation media queries.
    async checkOrientationLock(args: any) {
      const { html } = args;
    
      if (!html) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameter: html'
        );
      }
    
      let browser;
      try {
        browser = await puppeteer.launch({
          headless: true,
          args: ['--no-sandbox', '--disable-setuid-sandbox']
        });
        const page = await browser.newPage();
        
        await page.setContent(html);
        
        // Run the orientation-lock rule (experimental in Axe)
        const axe = new AxePuppeteer(page)
          .options({
            rules: {
              'meta-viewport': { enabled: true }
            }
          });
        
        const result = await axe.analyze();
        
        // Filter for the meta-viewport rule and orientation-related issues
        const orientationIssues = result.violations.filter(v => 
          v.id === 'meta-viewport' && 
          v.nodes.some(n => 
            n.html.includes('user-scalable=no') || 
            n.html.includes('maximum-scale=1.0') ||
            n.html.includes('orientation=portrait') ||
            n.html.includes('orientation=landscape')
          )
        );
        
        // Also look for CSS orientation locks
        // This requires additional checks since Axe doesn't have a specific rule for this
        const hasCssOrientationLock = await page.evaluate(() => {
          const styleSheets = Array.from(document.styleSheets);
          try {
            for (const sheet of styleSheets) {
              const rules = Array.from(sheet.cssRules || []);
              for (const rule of rules) {
                const ruleText = rule.cssText || '';
                if (
                  ruleText.includes('@media screen and (orientation:') ||
                  ruleText.includes('orientation:')
                ) {
                  return true;
                }
              }
            }
          } catch (e) {
            // CORS issues can occur when accessing CSS rules
            console.error('Error checking CSS:', e);
          }
          return false;
        });
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                hasOrientationLock: orientationIssues.length > 0 || hasCssOrientationLock,
                viewportIssues: orientationIssues.map(issue => ({
                  id: issue.id,
                  impact: issue.impact,
                  description: issue.description,
                  help: issue.help,
                  helpUrl: issue.helpUrl,
                  affectedNodes: issue.nodes.map(node => ({
                    html: node.html,
                    target: node.target,
                    failureSummary: node.failureSummary
                  }))
                })),
                hasCssOrientationLock,
                wcagCriteria: "WCAG 2.1 SC 1.3.4 (Orientation)",
                helpUrl: "https://www.w3.org/WAI/WCAG21/Understanding/orientation.html"
              }, null, 2),
            },
          ],
        };
      } finally {
        if (browser) {
          await browser.close();
        }
      }
    }
  • Input schema definition for the check_orientation_lock tool, requiring an 'html' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        html: {
          type: 'string',
          description: 'HTML content to test for orientation lock issues',
        }
      },
      required: ['html'],
    },
  • src/index.ts:142-155 (registration)
    Tool registration in the ListToolsRequestSchema response, defining name, description, and input schema.
    {
      name: 'check_orientation_lock',
      description: 'Check if content forces a specific orientation',
      inputSchema: {
        type: 'object',
        properties: {
          html: {
            type: 'string',
            description: 'HTML content to test for orientation lock issues',
          }
        },
        required: ['html'],
      },
    }
  • src/index.ts:172-173 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that routes calls to the checkOrientationLock handler.
    case 'check_orientation_lock':
      return await this.checkOrientationLock(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does ('check if content forces a specific orientation') without detailing behavioral traits such as what 'forces' means, how orientation is determined, error handling, or output format. This leaves significant gaps in understanding the tool's 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, clear sentence: 'Check if content forces a specific orientation.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity. Every part of the sentence earns its place by conveying essential information.

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 incomplete. It does not explain what the tool returns (e.g., a boolean, a report, or error messages), how orientation lock is detected, or any behavioral nuances. For a tool with no structured behavioral data, the description should provide more context to be fully helpful.

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, with the 'html' parameter clearly documented as 'HTML content to test for orientation lock issues.' The description does not add any additional meaning beyond this schema, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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: 'Check if content forces a specific orientation.' It uses a specific verb ('check') and identifies the resource ('content') and the specific issue ('orientation lock'). However, it does not explicitly differentiate from sibling tools like 'test_accessibility' or 'test_html_string,' which might also involve content testing.

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. It does not mention sibling tools like 'test_accessibility' or 'test_html_string,' nor does it specify contexts or exclusions for usage. The tool's purpose is clear, but usage context is implied rather than stated.

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/ronantakizawa/a11ymcp'

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