Skip to main content
Glama

get_performance_score

Analyze and retrieve the performance score of a webpage by providing its URL and device type, helping identify optimization areas using Google's Lighthouse metrics.

Instructions

Get just the performance score for a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceNoDevice to emulate (defaults to mobile)
urlYesURL to audit

Implementation Reference

  • The primary handler function for the 'get_performance_score' tool. It validates input args, configures a performance-only Lighthouse audit, executes it via handleRunAudit, parses the result, extracts the performance score and metrics, and returns formatted JSON response.
    private async handleGetPerformanceScore(args: any) {
      if (!isValidAuditArgs(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid performance score arguments'
        );
      }
    
      try {
        // Run a focused performance audit
        const auditArgs: RunAuditArgs = {
          url: args.url,
          categories: ['performance'],
          device: args.device || 'mobile',
          throttling: true,
        };
    
        const result = await this.handleRunAudit(auditArgs);
        
        // Extract just the performance data
        const resultData = JSON.parse(result.content[0].text);
        const performanceData = {
          url: resultData.url,
          performanceScore: resultData.scores.performance.score,
          metrics: resultData.metrics,
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(performanceData, null, 2),
            },
          ],
        };
      } catch (error: any) {
        console.error('Performance score error:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error getting performance score: ${error.message || error}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema defining the expected arguments for the 'get_performance_score' tool: required 'url' string and optional 'device' enum.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'URL to audit',
        },
        device: {
          type: 'string',
          enum: ['mobile', 'desktop'],
          description: 'Device to emulate (defaults to mobile)',
        },
      },
      required: ['url'],
    },
  • src/index.ts:114-132 (registration)
    Registration of the 'get_performance_score' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'get_performance_score',
      description: 'Get just the performance score for a URL',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to audit',
          },
          device: {
            type: 'string',
            enum: ['mobile', 'desktop'],
            description: 'Device to emulate (defaults to mobile)',
          },
        },
        required: ['url'],
      },
    },
  • src/index.ts:140-141 (registration)
    Dispatch/registration of the tool handler in the switch statement within CallToolRequestSchema handler.
    case 'get_performance_score':
      return this.handleGetPerformanceScore(request.params.arguments);
  • Helper validation function `isValidAuditArgs` used by the get_performance_score handler to validate input arguments.
    const isValidAuditArgs = (args: any): args is RunAuditArgs => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.url === 'string' &&
        (args.categories === undefined ||
          (Array.isArray(args.categories) &&
            args.categories.every((cat: any) => typeof cat === 'string'))) &&
        (args.device === undefined ||
          args.device === 'mobile' ||
          args.device === 'desktop') &&
        (args.throttling === undefined || typeof args.throttling === 'boolean')
      );
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It doesn't describe whether this is a read-only operation, what authentication might be required, rate limits, error conditions, or what format the performance score returns. The description only states what the tool does, not how it behaves.

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 extremely concise - a single sentence that directly states the tool's core functionality. There's zero waste or unnecessary elaboration, making it easy to parse and understand at a glance.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'performance score' entails (numeric value, rating scale, composite metric), doesn't mention the sibling tool relationship, and provides no behavioral context. Users need more information to effectively use this tool.

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?

With 100% schema description coverage, the input schema already fully documents both parameters (url and device). The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain what 'performance score' means, how it's calculated, or provide context about the device parameter's impact. Baseline 3 is appropriate when the schema does the heavy lifting.

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 with a specific verb ('Get') and resource ('performance score for a URL'), making it immediately understandable. However, it doesn't distinguish this tool from its sibling 'run_audit' - both likely relate to performance analysis but with different outputs or scopes.

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 about when to use this tool versus its sibling 'run_audit' or any alternatives. It doesn't mention prerequisites, constraints, or appropriate contexts for usage beyond the basic functionality 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/priyankark/lighthouse-mcp'

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