Skip to main content
Glama
PageSpeed Insights MCP Server

PageSpeed Insights MCP Server

Analyze a Page with Lighthouse

pagespeed_analyze_page
Read-onlyIdempotent

Analyze public or localhost page performance with PageSpeed Insights or local Lighthouse; get summaries, audits, and prioritized fixes for speed and Core Web Vitals.

Instructions

Run a PageSpeed Insights (or local Lighthouse for localhost/private URLs) analysis for one page. Start with report=summary for a health check; choose full for audits, recommendations for a prioritized fix list, audit for non-performance categories, or performance-map for Mermaid. Example: analyze a mobile product page and return the three most useful remediation steps. Returns a report plus structured result.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>"
    },
    "name": "pagespeed_analyze_page"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesPublic or local http(s) URL, for example https://example.com/products or http://localhost:3000.
runsNoDistinct measurements. Use 3–5 when you need a median and spread.
budgetNoOptional performance budget thresholds to validate against the measured result. Per-call values override the project's .pagespeed.json route budget and defaults.
engineNoAnalysis engine: auto (default, uses local Lighthouse for localhost/private URLs and Google PSI for public URLs), psi, or local.
localeNoBCP-47 locale such as en or uk-UA.en
reportNoAmount and shape of returned insight.summary
strategyNoLighthouse device profile. mobile is the default.mobile
categoriesNoLighthouse categories to request.
extraHeadersNoOptional HTTP headers (for example Authorization or Cookie) passed when running local Lighthouse against protected staging sites.
workspaceDirNoOptional local repository path to map Lighthouse selectors and asset filenames to source files.
responseFormatNomarkdown is concise and readable; json is machine-readable and is also available as structuredContent.markdown

Output Schema

NameRequiredDescriptionDefault
toolYes
resultYes
truncatedNo
truncationMessageNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv2.5.0
    • addedInput schema / properties / budget
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Optional performance budget thresholds to validate against the measured result. Per-call values override the project's .pagespeed.json route budget and defaults.",
      +  "properties": {
      +    "cls": {
      +      "description": "Maximum CLS (unitless).",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "fcp": {
      +      "description": "Maximum FCP in milliseconds.",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "imageBytes": {
      +      "description": "Maximum image transfer bytes (Lighthouse resource-summary image row). Unmeasured runs fail the check.",
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "jsBytes": {
      +      "description": "Maximum JavaScript transfer bytes (Lighthouse resource-summary script row). Unmeasured runs fail the check.",
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "lcp": {
      +      "description": "Maximum LCP in milliseconds.",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "performanceScore": {
      +      "description": "Minimum Lighthouse performance score (0-100).",
      +      "maximum": 100,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "si": {
      +      "description": "Maximum Speed Index in milliseconds.",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "tbt": {
      +      "description": "Maximum TBT in milliseconds.",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "totalByteWeight": {
      +      "description": "Maximum page transfer weight in bytes (Lighthouse total-byte-weight).",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "ttfb": {
      +      "description": "Maximum server TTFB in milliseconds.",
      +      "minimum": 0,
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
    • changedInput schema / properties / categories / items / enum
      Previous value: -[
      -  "performance",
      -  "accessibility",
      -  "best-practices",
      -  "seo",
      -  "pwa"
      -]New value: +[
      +  "performance",
      +  "accessibility",
      +  "best-practices",
      +  "seo"
      +]
    • addedInput schema / properties / engine
      Added value: +{
      +  "description": "Analysis engine: auto (default, uses local Lighthouse for localhost/private URLs and Google PSI for public URLs), psi, or local.",
      +  "enum": [
      +    "auto",
      +    "psi",
      +    "local"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / extraHeaders
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "Optional HTTP headers (for example Authorization or Cookie) passed when running local Lighthouse against protected staging sites.",
      +  "type": "object"
      +}
    • changedInput schema / properties / url / description
      Previous value: -"Public http(s) URL, for example https://example.com/products."New value: +"Public or local http(s) URL, for example https://example.com/products or http://localhost:3000."
    • addedInput schema / properties / workspaceDir
      Added value: +{
      +  "description": "Optional local repository path to map Lighthouse selectors and asset filenames to source files.",
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. Addedv2.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, open-world, non-destructive behavior, so the bar is lower. The description adds genuinely non-obvious context: engine auto-selection based on URL reachability, and that a report is returned alongside structured result. It does not mention cost/latency implications of multiple runs or budget-failure behavior, which would have pushed this higher.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four tight sentences, front-loaded with purpose before the mode menu, and no filler. "audit for non-performance categories" is slightly compressed and could be misread without the schema's category enum.

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

Completeness5/5

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

For an 11-parameter tool with a nested budget object and an output schema, the description covers what an agent needs before calling: what it analyzes, which engine runs, which report shape to pick, and that structured output exists. Remaining parameter detail is fully documented in the schema, so nothing critical is missing.

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?

Schema coverage is 100%, so baseline is 3, but the description adds real meaning beyond the schema's terse "Amount and shape of returned insight" by explaining what each report value is for and how engine selection interacts with URL type. It still says nothing about runs, budget thresholds, extraHeaders, or workspaceDir, so it does not fully cover the 11-parameter surface.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Run a PageSpeed Insights ... analysis for one page") and scopes it to a single page, which implicitly separates it from a batch sibling. It also clarifies the engine fallback (local Lighthouse for localhost/private URLs), so the agent knows exactly what is being analyzed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives strong intent-to-mode routing: summary for a health check, full for audits, recommendations for a prioritized fix list, audit for non-performance categories, performance-map for Mermaid, plus a concrete worked example. It stops short of naming sibling tools like diagnose_page or compare_pages, so cross-tool selection is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.