Skip to main content
Glama

run_best_practices_audit

Audit web pages for best practices to identify performance, accessibility, and SEO issues. Use this tool to evaluate page quality and compliance with web standards.

Instructions

Run a best practices audit on the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function implementing the 'run_best_practices_audit' tool. Ensures Chromium is running, evaluates JavaScript in the page context to perform checks (HTTPS, mixed content, deprecated tags, viewport meta), parses results, and returns formatted text output.
    async runBestPracticesAudit() {
      await this.ensureChromium();
      
      const result = await this.sendCDPCommand('Runtime.evaluate', {
        expression: `
          const results = [];
          if (location.protocol !== 'https:') {
            results.push('Page is not served over HTTPS');
          }
          
          const httpResources = Array.from(document.querySelectorAll('[src], [href]'))
            .filter(el => (el.src || el.href)?.startsWith('http:'))
            .length;
          
          if (httpResources > 0) {
            results.push(\`Found \${httpResources} HTTP resources on HTTPS page\`);
          }
          
          const deprecatedTags = Array.from(document.querySelectorAll('font, center, big, small, tt')).length;
          if (deprecatedTags > 0) {
            results.push(\`Found \${deprecatedTags} deprecated HTML tags\`);
          }
          
          const viewport = document.querySelector('meta[name="viewport"]');
          if (!viewport) {
            results.push('Missing viewport meta tag for mobile optimization');
          }
          
          JSON.stringify(results.length > 0 ? results : ['Best practices checks passed']);
        `,
        returnByValue: true
      });
      
      const bestPracticesResults = JSON.parse(result.result?.value || '[]');
      
      return {
        content: [{ type: 'text', text: `Best Practices Audit Results:\\n${bestPracticesResults.join('\\n')}` }],
      };
    }
  • index.js:303-310 (registration)
    MCP tool registration entry defining the tool name, description, and empty input schema (no parameters required).
    {
      name: 'run_best_practices_audit',
      description: 'Run a best practices audit on the current page',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Input schema for the tool: empty object, indicating no input parameters are required.
    inputSchema: {
      type: 'object',
      properties: {},
    },
  • index.js:385-386 (registration)
    Dispatch case in the main tool request handler switch statement that routes calls to the runBestPracticesAudit method.
    case 'run_best_practices_audit':
      return await this.runBestPracticesAudit();
  • Usage of the method within the comprehensive 'run_audit_mode' tool.
    results.bestPractices = await this.runBestPracticesAudit();

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/claude-arm64-browser'

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