Skip to main content
Glama
PageSpeed Insights MCP Server

PageSpeed Insights MCP Server

Compare Pages or a Stored Baseline

pagespeed_compare_pages
Destructive

Compare two web pages or measure a page against its saved baseline to detect performance regressions and verify whether deployed fixes improve metrics.

Instructions

Compare two pages now (mode=pages) or measure one page against its locally stored baseline (mode=baseline). Baseline mode records the first call; use runs=3 or more and rely on guaranteed deltas, not medians alone. Example: compare staging against production, or verify whether a deployed fix improved mobile LCP. replaceBaseline overwrites local baseline state.

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": {
      "mode": "<mode>",
      "url": "<url>"
    },
    "name": "pagespeed_compare_pages"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesPublic or local http(s) URL, for example https://example.com/products or http://localhost:3000.
modeYespages compares url and against; baseline compares url to its saved measurement.
runsNoUse 2–5 for baseline mode; 3 is recommended.
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.
againstNoSecond URL, required when mode=pages.
strategyNoDevice profile; part of baseline identity.mobile
categoriesNoLighthouse categories to request.
extraHeadersNoOptional HTTP headers (for example Authorization or Cookie) passed when running local Lighthouse against protected staging sites.
responseFormatNomarkdown is concise and readable; json is machine-readable and is also available as structuredContent.markdown
replaceBaselineNoOnly baseline mode: overwrite the local stored baseline.

Output Schema

NameRequiredDescriptionDefault
toolYes
resultYes
truncatedNo
truncationMessageNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 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."
  2. Addedv2.0.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, idempotentHint=false and openWorldHint=true; the description earns credit for pinpointing the source of destructiveness ('replaceBaseline overwrites local baseline state') and the stateful first-call behavior of baseline mode, which is consistent with the annotations. It does not disclose cost/latency implications of running multiple runs or which engine is used per mode beyond what the schema states, so it adds moderate rather than rich context.

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 sentences, front-loaded with the two modes and followed by operational caveats and an example. Nothing is wasted, though the mode parentheticals duplicate what the enum descriptions already say and could be trimmed.

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

Completeness4/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 the essential decisions: which mode, why multiple runs, and what replaceBaseline destroys. Return values need not be explained given the output schema, and budget/engine semantics live in the schema. A brief note on budget-failure behavior or engine selection trade-offs would make it complete.

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?

Schema description coverage is 100%, so the schema already documents every parameter including mode, runs, engine, budget and replaceBaseline. The description largely restates those semantics ('mode=pages', 'replaceBaseline overwrites local baseline state') rather than adding new meaning; only the 'rely on guaranteed deltas, not medians alone' note adds interpretive value about why runs matters. Baseline 3 is appropriate.

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 names a specific verb (compare) and resource (pages/baseline), and explicitly splits the two operating modes: 'Compare two pages now (mode=pages) or measure one page against its locally stored baseline (mode=baseline).' An agent can tell what it does without opening the schema. It does not, however, distinguish itself from siblings like pagespeed_analyze_page or pagespeed_diagnose_page, which an agent may otherwise confuse with the single-URL path.

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?

Concrete usage contexts are supplied: 'compare staging against production, or verify whether a deployed fix improved mobile LCP,' plus mode-specific guidance ('Baseline mode records the first call; use runs=3 or more'). This tells the agent when each mode applies. It stops short of naming an alternative tool for plain single-page analysis or stating when not to use this one.

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