ghost-inspector-mcp

v0.4.1
io.github.charliemtnez/ghost-inspector-mcp Checked 3 days ago Published 2 months ago

Analyze, validate and safely update Ghost Inspector end-to-end browser tests

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

gi_whoami Ghost Inspector: verify credentials and check what this server may do

Confirms the configured API key works, lists the organizations it can reach, and reports whether writing is enabled. Read-only and safe to call first when diagnosing setup. 🔴 Call this before concluding that this server cannot modify anything. Every tool is registered whether or not its gate is open, so a tool being listed says nothing about whether it will run. `writesEnabled` and `runsEnabled` are the authority — GHOST_INSPECTOR_ALLOW_WRITES and GHOST_INSPECTOR_ALLOW_RUNS. When one is false the operator must set the matching variable and restart this server; it cannot be turned on from…

gi_inventory Ghost Inspector: account overview

Read-only tour of the whole account: every folder, the suites inside it, and per-suite counts of passing / failing / module / not-yet-run tests, plus the names of the failing ones. Start here — no other question about this account can be answered without knowing what is in it. Import-only tests (modules: shared steps that other tests import, the equivalent of a function) are counted in their own bucket and never as failures. Marking a test import-only deletes its stored results, so every module looks permanently unrun; folding that into a failure count invents breakage that does not exist a…

ParameterTypeDescription
failingOnlybooleanList only suites with at least one failing test. Totals stay account-wide.
folderstringCase-insensitive substring of a folder name. Omit to see every folder.

gi_module_usage Ghost Inspector: who imports each module

Answers the one question the API cannot: if I edit this module, which tests break? Builds the reverse index of `execute` steps — for every imported test, its direct importers and its full transitive blast radius through nested chains. Run this BEFORE editing any module. Also surfaces three things that only appear once the index exists: import-only tests nobody imports (dead, or a test that lost its caller and is silently not running); imported tests NOT flagged import-only, which run standalone *and* inside their importers, so an edit changes both paths; and execute steps pointing at ids th…

ParameterTypeDescription
folderstringFolder id, or part of its name. Lists only the modules its tests import; counts stay account-wide.
modulestringCase-insensitive substring of a module name. Narrows the listing and names every importer instead of capping the list.
suitestringSuite id, or part of its name. Lists only the modules its tests import; with folder, both apply.

gi_stale_tests Ghost Inspector: stale versus genuinely broken

Call this BEFORE diagnosing or editing any red test. Splits failures into two piles by comparing the whole `execute` chain's `dateUpdated` against each test's last run. `staleFailures` are red tests whose definition or module chain changed AFTER the failing run. The failure describes a version that no longer exists — a colleague may already have fixed it and the test simply has not run again. Editing on top of one destroys their work, and Ghost Inspector keeps no version history of steps. One level deep is not enough here, because modules nest; the whole chain is walked. `genuineFailures`…

ParameterTypeDescription
folderstringFolder id, or part of its name. Narrows the report to that folder's tests.
includePassesbooleanList the passing-but-unverified tests too. Off by default because it is the long bucket; the count is always reported.
suitestringSuite id, or part of its name. Narrows the report to that suite's tests; with folder, both apply.

gi_find_tests Ghost Inspector: find tests by name, place or step

Read-only. Finds tests and returns their ids, which every other tool takes, with suite, folder, importOnly, passing and screenshotCompare. 🔴 `passing` is the functional result only. A test can be green there while its screenshot comparison fails: read `screenshotCompare.passing` for that, or pass `screenshotFailing: true` to list only those. Comparison settings a test leaves at null are inherited from its suite, and `screenshotCompare.enabled` resolves that. `name`, `folder` and `suite` are matched against the listing: case-insensitive substrings, or an exact id for folder and suite. They…

ParameterTypeDescription
folderstringFolder id, or part of its name.
limitintegerMost results to return. Default 50; `total` is always the full count.
namestringPart of the test's name.
screenshotFailingbooleanOnly tests whose screenshot comparison is enabled and failing. Cheap: read from the listing.
stepobjectMatch tests by what their own steps do. All given fields must match one step.
suitestringSuite id, or part of its name.

gi_get_test Ghost Inspector: read one test, with the token an edit requires

Returns a single test's stored definition, identity and current state: steps, startUrl, suite, whether it is a module, its last run, and its `dateUpdated`. 🔴 `dateUpdated` is the concurrency token. gi_update_test requires it as `expectedDateUpdated` and refuses the write if the record moved since you read it. Call this first and pass the value through. Do not discover the token by sending a deliberately wrong one and reading the correct value off the refusal — that defeats the guard, which exists to prove the edit was composed against the definition that is actually stored. The steps re…

ParameterTypeDescription
expandModulesbooleanAlso return `expanded`: every step a run would execute, modules inlined, each with ownerId, ownerName, indexInOwner (its position in its owner's own list), rootIndex and the combined condition. It lin…
testIdstringThe 24-character test id.
testIdsarrayUp to 20 test ids instead of testId. Each comes back with its own result or error; one failure does not sink the rest.

gi_test_result Ghost Inspector: why is this test red

The last run of one test: the step that failed, its error, and whether the result can be trusted at all. Read-only. This is the starting point for repairing a failure — gi_stale_tests tells you which tests to look at, this tells you what happened in one of them. 🔴 Read `verdict` and `staleness` BEFORE the error. A verdict of `stale` means the test or one of its imported modules changed after this run, so the failure describes a definition that is no longer stored. Diagnosing from it is diagnosing from nothing, and a colleague may already have fixed it. Re-run the test and read the fresh…

ParameterTypeDescription
runsBackinteger0 (default) is the latest run. Higher walks backwards, within the retained window.
testIdstringThe 24-character test id.
testIdsarrayUp to 20 test ids instead of testId. Each comes back with its own result or error; one failure does not sink the rest.

gi_test_history Ghost Inspector: a test's run history, and when its red began

Read-only. Walks a test's results newest first, 50 per page, and returns each run's verdict and failing step (command, error, the selector that resolved), plus `lastPass` and `firstFail`, the oldest failure of the current red streak, which dates a regression. 🔴 Read `horizon` before concluding anything. Ghost Inspector purges old results. `exhausted: true` means retention ended there and nothing older exists. `exhausted: false` means more history exists than was asked for, and `streakMayContinue` says the red streak may have begun earlier: raise `runs`. A run with `passing: null` is in fli…

ParameterTypeDescription
testId *stringThe 24-character test id.
runsintegerHow many runs to walk back. Default 50, at most 500; one request per 50.

gi_failure_groups Ghost Inspector: red tests grouped by when they started failing

Read-only. For every red test (modules excluded), finds its onset, the first failure after its last green run, and groups onsets that follow each other within `windowHours`, across suites and folders. Many tests going red within hours usually share one cause: a deploy, a shared module, a page change. Each group lists its tests with ids and the most common errors and targets, with numbers and quoted text normalised. A red test with no green run within `maxRunsPerTest` goes to `onsetUnknown` rather than being guessed. Costs one request per 50 runs per red test; narrow with folder or suite on a…

ParameterTypeDescription
folderstringFolder id, or part of its name.
maxRunsPerTestintegerHow far back to look for a green run per test. Default 200.
suitestringSuite id, or part of its name.
windowHoursnumberLargest gap between consecutive onsets in one group. Default 12.

gi_screenshot_status Ghost Inspector: screenshot comparison state of a test

Read-only. The test's screenshot-comparison settings and its latest result's comparison: enabled, passing, the measured difference against the threshold, the current screenshot (`screenshotUrl`) and the difference image (`diffUrl`). Two images are kept apart because they stop being the same one the moment a screenshot is accepted. `comparedAgainst` is the image the latest result was measured against. `currentBaseline` is the one the next run will be compared against: the newest result whose comparison passed. Accepting flips a result to passing, so right after an accept the latest result read…

ParameterTypeDescription
testIdstringThe 24-character test id.
testIdsarrayUp to 20 test ids instead of testId. Each comes back with its own result or error.

gi_screenshot_diff Ghost Inspector: where a screenshot changed

Read-only. Downloads a result's full-size screenshot and a baseline's, compares them pixel by pixel, and returns the changed regions as horizontal bands (rows and columns in the full-size image, largest first), followed by PNG crops of the largest ones: baseline above a red rule, this result below. Look at the crops before gi_accept_screenshot: accepting cannot be undone. `changedShare` is this tool's own pixel count, not Ghost Inspector's `difference`, which uses an unpublished method, so the two will not match. A page that grew or content that moved down shows up as one band covering everyt…

ParameterTypeDescription
testId *stringThe 24-character test id.
againststringcomparedAgainst (default): the image the result was measured against, which explains its difference. currentBaseline: what the next run will be compared with.
cropsintegerHow many regions to return as images. Default 3; 0 for the regions alone.
resultIdstringThe result to inspect. Default: the latest.

gi_vacuous_tests Ghost Inspector: green tests that prove nothing

Finds tests that pass while verifying nothing. Green is the dangerous colour: a red test gets investigated, a hollow green one sits there while every report says coverage is fine. Three classes, kept apart because conflating them hides two of them. `executesNothing` runs zero steps — its definition is only `execute` calls into empty modules. `assertsNothing` runs its steps and contains no assertion anywhere in the chain, so it can only fail if a step errors; act on this one first, it is usually the largest. `worthChecking` is a SHORTLIST, not a verdict: their single assertion is the final s…

ParameterTypeDescription
folderstringFolder id, or part of its name. Narrows the report to that folder's tests.
suitestringSuite id, or part of its name. Narrows the report to that suite's tests; with folder, both apply.

gi_propose_repair Ghost Inspector: propose a fix without applying one

Turns a diagnosis into a concrete argument: what to change, in which test, and the token needed to write it. Read-only — it applies nothing and returns steps for you to validate first. 🔴 This server cannot see the page. It has the definition, the error and the Ghost Inspector contract, so proposals come in two kinds and are never blurred. `applicable` proposals carry a rewritten step and come from rules that hold whatever the page contains — an assertTextPresent with no target always fails, an eval without an explicit return is always undefined. `advisory` ones name a real problem that…

ParameterTypeDescription
testId *stringThe failing test. Its diagnosis drives the proposal.

gi_validate_test Ghost Inspector: validate a definition without saving or submitting

Runs a test definition through on-demand execution, which executes it and discards it — nothing in the account is created or changed. Use it to check that a selector chain still resolves before editing a test, and to check a definition you are authoring before saving it. 🔴 It drives a real browser against a real URL, so it is an action with real-world effects even though nothing is saved. Modules are inlined first, because a test whose steps are just `execute` calls hides its submit inside a module. Then three guard layers apply, and none can be turned off or extended past its cut: (A) S…

ParameterTypeDescription
browserstringOverride, e.g. "chrome". Omit to replicate the suite's.
definitionobjectAd-hoc definition to validate instead of an existing test.
dryRunbooleanDeprecated: use gi_plan_test, which does exactly this and is read-only. Reports what would run and sends nothing.
stopBeforeintegerStop before this plan step (as numbered by gi_plan_test). Can only cut earlier than the guard's own cut; a later value is ignored.
suiteIdstringWith `definition`: the suite whose configuration and variables it runs with.
testIdstringExisting test to validate. Its suite's configuration and variables are replicated.
variablesobjectVariable values, e.g. {"subdomain": "www"}. Win over the suite's and the organization's.
verbosebooleanKeep `plan` after a run and return every console entry. Off by default to keep the response small.
viewportstringOverride, e.g. "1280x800". Omit to use the test's, then the suite's.

gi_plan_test Ghost Inspector: show what a validation would run, without running it

Read-only. Returns exactly what gi_validate_test would send: modules inlined, {{variables}} resolved from `variables`, the suite and the organization, and all three submit-guard layers applied. Nothing is executed, only definitions are read: no browser starts, and no organization id is needed. Use it before any validation of a test that touches production. `plan` lists the steps in order, numbered as every other report numbers them. `guard.stoppedAt` is the static cut, where a submit-shaped step became an assertion on its target. `guard.probedClicks` counts the clicks that will be probed in t…

ParameterTypeDescription
browserstringOverride, e.g. "chrome".
definitionobjectAd-hoc definition to plan instead of an existing test.
stopBeforeintegerStop before this plan step. Can only cut earlier than the guard's own cut.
suiteIdstringWith `definition`: the suite whose configuration and variables it runs with.
testIdstringExisting test to plan. Its suite's configuration and variables are replicated.
variablesobjectVariable values, e.g. {"subdomain": "www"}. Win over the suite's and the organization's.
viewportstringOverride, e.g. "1280x800".

gi_update_test Ghost Inspector: update a test, behind four guards

Replaces a test's steps, renames it, or changes its startUrl. 🔴 Ghost Inspector keeps NO version history of steps and no recycle bin, so this is permanent. Four guards run on every call and none can be turned off. (1) The whole `execute` chain's `dateUpdated` is compared against the test's last run; if anything changed after it, the test is stale and the call is refused, because a fix diagnosed from a failure that describes a deleted version is diagnosed from nothing — and a colleague may already have fixed it. (2) The complete prior definition, credentials removed, is saved to `backupFi…

ParameterTypeDescription
expectedDateUpdated *stringThe dateUpdated you read from this test. Proof you have seen its current state; the write is refused if it no longer matches.
testId *stringTest to change.
confirmStaleDiagnosisbooleanProceed even though the chain changed after the last run. Only after verifying the current definition yourself; otherwise you may be overwriting someone else's fix.
namestringNew name. Renaming does not move the test or break importers, which reference it by id.
startUrlstringNew start URL. Read back after the write like everything else sent. A module's startUrl is never visited: its importer decides where it starts.
stepsarrayReplacement step list, in order. Replaces the whole array — send every step you want kept.
verbosebooleanAlso return the prior definition inline as `backup`. For clients that cannot read `backupFile`.

gi_accept_screenshot Ghost Inspector: accept the latest screenshot as the new baseline

Makes the latest result's screenshot the baseline that every later run of this test is compared against. 🔴 The API offers no way to restore an earlier baseline; the response returns `previousBaselineResult` so it can at least be found again. `expectedResultId` is required: the result whose screenshot you looked at, from gi_screenshot_status. The accept is refused if a newer run has landed since, if the latest run is still going, or if its comparison passed or did not run (there is nothing to accept then). The check is read-then-accept with no compare-and-swap, so a run landing in the momen…

ParameterTypeDescription
expectedResultId *stringlatestResult.id from gi_screenshot_status: the result whose screenshot you reviewed.
testId *stringThe 24-character test id.

gi_move_suite Ghost Inspector: move a suite to another folder

Moves a suite, with all of its tests, into another folder. Reversible — unlike everything else on the write path — and the response carries `previousFolder` so the undo is one call. `expectedCurrentFolder` is required: state the folder you believe the suite is in, and the move is refused if it is somewhere else, which is the case where you are about to move the wrong suite. The result is verified by re-reading: the folder must have changed and `testCount` must be identical, since a move should never detach a test. Note that `DELETE /folders/{id}/` does not exist, so a folder left empty b…

ParameterTypeDescription
expectedCurrentFolder *stringThe folder id you believe this suite is in right now. Refused if it is not.
folderId *stringDestination folder id.
suiteId *stringSuite to move.

gi_move_test Ghost Inspector: move a test to another suite

Moves one test into another suite, steps untouched. Reversible: the response carries `previousSuite`, so the undo is one call. This is also how to retire a test: move it to a suite that has no schedule. Deleting a test is not offered, because Ghost Inspector keeps no version history and no recycle bin. `expectedCurrentSuite` is required: the suite id you believe the test is in, from gi_get_test or gi_find_tests. The move is refused if it is elsewhere. 🔴 A test runs with its suite. If the destination is scheduled, the test starts running on that schedule, unattended; if it submits a form,…

ParameterTypeDescription
expectedCurrentSuite *stringThe suite id you believe this test is in right now. Refused if it is not.
suiteId *stringDestination suite id.
testId *stringTest to move.

gi_create_suite Ghost Inspector: create a suite

Creates an empty suite, optionally inside a folder. The folder is honoured at creation, so no follow-up move is needed. Refuses when a suite of the same name already exists in the same place, because Ghost Inspector allows the duplicate and nothing distinguishes the two afterwards. Pass allowDuplicateName only when the repetition is genuinely intended. 🔴 Getting the name right matters more than usual: this server never exposes suite deletion, because DELETE /suites/{id}/ cascades to every test inside with no version history and no recycle bin. Folders have no delete route in the API at al…

ParameterTypeDescription
name *stringSuite name. Must be unique where it is being created.
allowDuplicateNamebooleanProceed even though a suite of this name already exists here.
folderstringFolder id to create it in. Omit to leave it unfiled.
organizationstringOrganization id. Defaults to GHOST_INSPECTOR_ORG_ID.

gi_duplicate_test Ghost Inspector: copy a test — the only way to get a new one

Copies an existing test, then places it in a suite and renames it in one call. Returns the new test with its steps and its dateUpdated. 🔴 This is how a test comes into existence here, and it is not a create. Ghost Inspector has no endpoint that builds a test from nothing — POST /tests/ is the listing wearing a POST — so a source test is mandatory and there is no way around that. Pick the closest existing test and adapt the copy with gi_update_test. 🔴 The copy's schedule is cleared unless keepSchedule is set. Whether a copy inherits its source's testFrequency is not verified, and in…

ParameterTypeDescription
sourceTestId *stringThe test to copy. Required — there is no create.
keepSchedulebooleanKeep any inherited schedule. Off by default; leaving it off is the safe choice.
namestringNew name. Defaults to "<source> (Copy)".
startUrlstringWhere the copy starts. Defaults to the source's startUrl.
suiteIdstringSuite to place it in. Defaults to the source's suite.

gi_run_test Ghost Inspector: run a stored test for real

Executes a test exactly as saved and waits for the verdict. Use it to confirm a repair actually worked, or to get a fresh result when the stored one is stale. 🔴 Nothing is truncated here. Unlike gi_validate_test, which runs a throwaway copy and stops before anything can submit, this runs the real test against the real startUrl — in most accounts, production. If the test fills and submits a form, this posts a real record into whatever that form feeds, and nothing here can withdraw it. Because of that, a test that submits is refused unless `confirmSubmit` is set. The check inlines importe…

ParameterTypeDescription
testId *stringThe 24-character test id. Import-only tests cannot run.
confirmSubmitbooleanRequired only when the test contains a step that could submit a form. Setting it means you accept a real submission against a real environment.
timeoutMsintegerHow long to wait before handing back the result id. Default 240000.