# Run and track PageSpeed tests with Grok

> Tracking PageSpeed scores with Grok means asking xAI's chat assistant on grok.com how your WordPress sites score, with the xSpeed Hub custom connector supplying stored history and, when you ask, a fresh test.

Page: https://xspeedcache.com/agent/grok/pagespeed-tests/
Last updated: October 2026

The question usually comes up in an ordinary chat. A client mentioned the site feels slow, or Search Console flagged a Core Web Vitals problem, and you want the numbers without opening a report. In Grok you name the site and ask. With xSpeed Hub added as a custom connector on grok.com, Grok calls get_score_history and answers from the stored runs: score, LCP, FCP, CLS, TBT, Speed Index and TTFB for mobile and desktop. It is a good place for follow-ups, such as which metric is pulling mobile down or whether desktop has moved at all.

A new measurement is a separate call. run_speed_test asks PageSpeed Insights for a fresh Lighthouse run from the Hub, mobile or desktop, and can take up to about two minutes, so the chat waits on it. The Hub classes it a write because each run spends a shared allowance, though it changes nothing on the site. The result goes to the Hub's own report history, on the Reports tab, so a later get_score_history may not list it. If you only want to know whether pages are served from cache, run_benchmark times the home page cached and uncached and returns no score, so do not let a response time stand in for one.

This page is about asking in a chat. The Hub has no scheduler of its own for agent prompts, so each check here is one you start. Ask Grok to put the device and the run date beside every number it quotes, so a five-week-old score is not read as today's, and ask for one device per test, because one call measures either mobile or desktop.

## Set up Grok once

### 1. Put your sites in xSpeed Hub

Sign in at app.xspeedcache.com with Google or email; the Hub is free and has no site cap. Then connect each WordPress site from its own dashboard: click Connect Hub in the xSpeed Cache top bar, then Connect via xSpeed Hub. Each site needs the free xSpeed Cache plugin.

### 2. Add xSpeed Hub as a custom connector

Go to grok.com/connectors, click New Connector and select Custom. Enter this as the MCP server URL and complete the authentication: approve access on the xSpeed Hub page that opens. Grok then reads the Hub's tools and makes them available in your conversations.

```
https://app.xspeedcache.com/xspeed/mcp
```

### 3. Ask a first question

Start a chat and ask something that names xSpeed Hub, so Grok reaches for the connector. A list of your sites with their cache status means the connection works.

```
Use xSpeed Hub to list my sites and tell me which ones have page caching turned off.
```

Full setup: https://xspeedcache.com/agent/grok/

### Before you send a prompt that changes something

Reads change nothing on your sites, though contact_support emails xSpeed support. Writes run once your connection allows them, so your client's approval prompt and a read-only connection (the token's Read-only everywhere switch, or a Viewer sign-in) are the gates that matter. xAI's connector documentation describes no per-tool approval setting. It says Grok can use a connector's tools whenever your questions relate to that service. xSpeed Hub has no confirmation step of its own, so a purge or a settings change runs as soon as Grok calls it and your connection allows writes. The Hub tells the agent to confirm the target site and to ask once before a write that touches every site, but that is an instruction, not a lock. If you want Grok to read and never change anything, sign in as a Viewer member of the workspace, which only ever gets read access. Otherwise read what Grok says it is about to do before you answer yes.

## Prompts

- Using xSpeed Hub, what are the stored mobile and desktop PageSpeed scores for shop, and when was each measured?
- Use xSpeed Hub to run one mobile PageSpeed test on blog and tell me which metric is the weak point.
- Ask xSpeed Hub for the benchmark history on docs and tell me whether caching got faster after last week's settings change.

## Example session

```
You: Using xSpeed Hub, is blog slower on mobile than it was a month ago? History only for now.
  → get_score_history(site: blog) [read-only]: 5 stored runs; mobile 63, 61, 58 over five weeks; TBT 210 ms to 340 ms; desktop 86 to 85; newest run 6 days ago
Agent: Mobile slipped five points over three runs, and TBT went from 210 ms to 340 ms, which points at heavier scripts. Desktop is flat. The newest run is six days old. I can start one fresh mobile test when you want a current reading.
You: Do one now.
  → run_speed_test(site: blog, strategy: mobile) [uses quota]: mobile score 57, TBT 360 ms, LCP 3.5 s, saved to the Hub report history
Agent: Mobile is 57 on a fresh run, so the slide is real and TBT is still the cause. That run sits in the Hub's report history, not in the stored list I read first.
```

## How it works

1. **Read before you test**: get_score_history returns the stored PageSpeed Insights and GTmetrix runs for a site: the score per run, with LCP, FCP, CLS, TBT, Speed Index and TTFB, mobile and desktop. It starts nothing. The Hub tells the agent to use it whenever you ask what your score is, or whether it improved, because a new test spends a shared allowance.
2. **Run a new test when you need one**: run_speed_test runs a real PageSpeed Insights audit on the site from the Hub and returns the score, the Core Web Vitals and the top opportunities. strategy is mobile (the default) or desktop, and one call tests one of them. It can take up to about 2 minutes, so the agent should say it is running before it calls.
3. **Test the other device**: Mobile and desktop scores differ, often by a lot. For both, the agent makes two calls, one per strategy. A failure is reported with its reason: PageSpeed not configured, quota reached, a timeout, or a site the audit cannot reach.
4. **Measure the cache on its own**: run_benchmark times the home page with the cache bypassed and again served from cache, and returns the response times. It is a read tool, and it accepts site: "all" for every site. It does not return a Lighthouse score, so the agent must not use it to answer a PageSpeed question.
5. **Compare over time**: get_benchmark_history returns past benchmark runs, uncached against cached, together with the settings changes on the same timeline, which is how you answer "did that change help?". For PageSpeed scores over time, use get_score_history.

## Reference

| | |
| --- | --- |
| Read stored scores | get_score_history (read): PageSpeed Insights and GTmetrix runs, starts nothing |
| Metrics per run | Score, LCP, FCP, CLS, TBT, Speed Index, TTFB, for mobile and desktop |
| Run a new test | run_speed_test (write, uses the shared allowance): one PageSpeed Insights run per call |
| strategy | mobile (default) or desktop |
| Duration | Up to about 2 minutes per run |
| Why a test is a write | It spends a shared PageSpeed allowance and stores a report; it changes nothing on the site |
| Read-only access | A connection token with Read-only everywhere on, or a Viewer member's sign-in: run_speed_test is refused; get_score_history, run_benchmark and get_benchmark_history still work. An OAuth sign-in gets the scopes the client asks for |
| Benchmark | run_benchmark (read): cached against uncached response time for the home page, no Lighthouse score |
| Benchmark history | get_benchmark_history (read): past runs plus settings changes on the same timeline |
| Scheduling | The Hub does not schedule PageSpeed tests itself; its daily pass only reads reports the plugin already stored |
| Where a new test is stored | In the Hub's own report history, the one the Hub dashboard shows |

## Rules

- Check the history first. Ask for stored scores before starting a test, and run a new one only when you want a fresh measurement or something changed.
- Never answer a PageSpeed or Lighthouse question with run_benchmark. It times your own cache and carries no score.
- run_speed_test changes nothing on your site, but the Hub classes it a write because it spends a shared allowance. A connection token with Read-only everywhere on, or a Viewer sign-in, refuses it. An OAuth sign-in gets the scopes the client asks for, so there your client's approval prompt is the gate.
- Lab scores move a few points between runs of the same page. The agent should compare like with like, same site, same strategy, and not report one run's difference as a trend.
- A new test does not run on a timer. If you want a regular test, the agent has to be started by something else, such as a scheduled job in your client, and a scheduled run that spends the allowance should be one you are comfortable leaving unattended.

## Good to know with Grok

xAI describes no per-tool approval setting for connectors and says Grok can use a connector's tools whenever your question relates to that service. So a loose request such as "keep an eye on my speed" can lead Grok to call run_speed_test, and each run spends the shared allowance, because xSpeed Hub has no confirmation step of its own. The Hub tells the agent to read stored history first when you ask what a score is, but that is guidance to the model, not a lock. Say "history only" when that is all you want, and "one test, mobile" when you do want one. The custom connector signs in with OAuth and xAI documents no header field for it, so the Read-only everywhere switch on the connection token does not reach Grok. To make run_speed_test impossible, sign in as a Viewer member of the workspace; get_score_history and run_benchmark still work. On Grok Business and Enterprise, a team admin has to provision the connector first.

## More prompts for this job

They work in any client connected to xSpeed Hub.

- Using xSpeed Hub, what is the mobile PageSpeed score for shop? Check the stored history before you run anything.
- Use xSpeed Hub to run a new mobile PageSpeed test on blog and tell me the score, LCP and the top opportunities.
- With xSpeed Hub, test shop on desktop and mobile and tell me which one is worse.
- Using xSpeed Hub, has the PageSpeed score on docs improved over the last few runs?
- Use xSpeed Hub to benchmark the cache on every site and tell me which one saves the least time.
- Did turning on minification on shop help? Use xSpeed Hub to compare the benchmark history around that change.
- My PageSpeed test failed on staging. Use xSpeed Hub to tell me why.

## Frequently asked questions

### Can Grok read my PageSpeed history without starting a test?

Yes. get_score_history returns the runs already stored on the site and starts nothing. Say "history only" in the request, because Grok can use a connector's tools whenever your question relates to it, and a vague request might reach for a new test.

### How do I stop Grok from spending the speed-test allowance?

Sign in to the connector as a Viewer member of the workspace. A Viewer sign-in is always read-only, so the Hub refuses run_speed_test while get_score_history and run_benchmark keep working. xAI documents no per-tool setting for connectors, so the sign-in is the control you have.

### What is the difference between run_speed_test and run_benchmark?

run_speed_test runs a real PageSpeed Insights audit and returns a Lighthouse score with Core Web Vitals. run_benchmark measures how fast your own cache answers compared with an uncached request for the home page, and returns no Lighthouse score. Use the first for "what is my PageSpeed score" and the second for "is my caching working".

### How long does a PageSpeed test take?

A single run can take up to about 2 minutes, so the agent should tell you it has started before it calls. One call tests one device, mobile or desktop, so checking both takes two calls.

### Can I ask for the last score without running a new test?

Yes. get_score_history reads the stored PageSpeed Insights and GTmetrix runs for the site and starts nothing. The Hub tells the agent to read it first whenever you ask what your score is, because a new test spends a shared allowance.

### Will the Hub run PageSpeed tests on a schedule?

No. The Hub does not schedule PageSpeed tests itself. Its daily pass re-verifies sites, snapshots cache status and pulls the PageSpeed and GTmetrix reports the plugin has already stored, and it can alert on a score regression. If you want regular new tests, they have to be started by a client that can run scheduled jobs.

### Why is a speed test treated as a write tool?

It does not change your site. The Hub classes run_speed_test as a write because it spends a shared PageSpeed allowance and stores a report, and a read-only connection (the connection token with Read-only everywhere on, or a Viewer sign-in) should not be able to cost the owner anything. Such a connection can still read stored scores with get_score_history.

## Track PageSpeed scores with other agents

[Claude Code](https://xspeedcache.com/agent/claude-code/pagespeed-tests/) · [Claude](https://xspeedcache.com/agent/claude/pagespeed-tests/) · [Claude Cowork](https://xspeedcache.com/agent/claude-cowork/pagespeed-tests/) · [ChatGPT](https://xspeedcache.com/agent/chatgpt/pagespeed-tests/) · [Codex](https://xspeedcache.com/agent/codex/pagespeed-tests/) · [Cursor](https://xspeedcache.com/agent/cursor/pagespeed-tests/) · [GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/pagespeed-tests/) · [Windsurf](https://xspeedcache.com/agent/windsurf/pagespeed-tests/) · [Gemini CLI](https://xspeedcache.com/agent/gemini-cli/pagespeed-tests/) · [Antigravity](https://xspeedcache.com/agent/antigravity/pagespeed-tests/) · [Zed](https://xspeedcache.com/agent/zed/pagespeed-tests/) · [Kiro](https://xspeedcache.com/agent/kiro/pagespeed-tests/) · [OpenCode](https://xspeedcache.com/agent/opencode/pagespeed-tests/) · [OpenClaw](https://xspeedcache.com/agent/openclaw/pagespeed-tests/) · [Hermes Agent](https://xspeedcache.com/agent/hermes-agent/pagespeed-tests/) · [Grok Build](https://xspeedcache.com/agent/grok-build/pagespeed-tests/) · [ChatGPT dots](https://xspeedcache.com/agent/chatgpt-dots/pagespeed-tests/) · [Grok Bot](https://xspeedcache.com/agent/grok-bot/pagespeed-tests/) · [Muse](https://xspeedcache.com/agent/muse/pagespeed-tests/) · [Manus](https://xspeedcache.com/agent/manus/pagespeed-tests/) · [Kimi Code](https://xspeedcache.com/agent/kimi/pagespeed-tests/) · [Paperclip](https://xspeedcache.com/agent/paperclip/pagespeed-tests/) · [NanoClaw](https://xspeedcache.com/agent/nanoclaw/pagespeed-tests/)

## More with Grok

- [Purge the WordPress cache with Grok](https://xspeedcache.com/agent/grok/purge-cache/)
- [Find out why WordPress pages are not cached with Grok](https://xspeedcache.com/agent/grok/troubleshoot-cache/)
- [Scan a website for speed problems with Grok](https://xspeedcache.com/agent/grok/speed-scan/)
- [Raise a WordPress site's PageSpeed score with Grok](https://xspeedcache.com/agent/grok/optimize-site/)
- [Tune WordPress cache settings with Grok](https://xspeedcache.com/agent/grok/cache-settings/)
- [Warm the WordPress cache with Grok](https://xspeedcache.com/agent/grok/preload-cache/)
- [Set up the Redis object cache with Grok](https://xspeedcache.com/agent/grok/object-cache/)
- [Manage Cloudflare caching with Grok](https://xspeedcache.com/agent/grok/cloudflare/)
- [Manage every WordPress site at once with Grok](https://xspeedcache.com/agent/grok/fleet/)

## Documentation

- How to run a speed test: https://xspeedcache.com/docs/external-score/
- PageSpeed Insights integration: https://xspeedcache.com/docs/pagespeed-insights-integration/
- Running speed tests in xSpeed Hub: https://xspeedcache.com/docs/hub-speed-tests-and-notifications/
- How to run a PageSpeed audit: https://xspeedcache.com/docs/pagespeed/
