mcp

v0.1.7
dev.corlabs/mcp Checked 3 days ago Published 1 month ago

Scored, maintainable locators from a live page for AI coding agents, with checks and repairs.

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

cor_open Open a page

Open a URL in the COR-controlled browser. The browser starts on first use and is reused across calls. For a page behind a login, pass a Playwright storage-state file so the existing session is adopted. The reply lists the page's controls with refs (on a large page, a region index) — no cor_snapshot needed first — and, when the project's code already uses COR entries for this page, which members those are and whether each still finds its element.

ParameterTypeDescription
url *stringPage to open.
storageStatestringPath to a Playwright storage-state JSON file ({cookies, origins}) — e.g. from `npx playwright codegen --save-storage`.

cor_click Click an element

Click an element to reach a page state — open a menu, go to the next step. Does not assert anything.

ParameterTypeDescription
refstringElement ref from the latest cor_snapshot, e.g. "e4". Alternative to target.
targetstringCSS selector for the element — must match exactly one. Alternative to ref.

cor_fill Fill a field

Set the value of an input, textarea, select or editable element, firing input and change events.

ParameterTypeDescription
value *stringValue to set.
refstringElement ref from the latest cor_snapshot, e.g. "e4". Alternative to target.
targetstringCSS selector for the element — must match exactly one. Alternative to ref.

cor_press Press a key

Press a key, e.g. Enter, Escape, Tab, ArrowDown. With a ref or target, that element is focused first.

ParameterTypeDescription
key *stringKey name as Playwright spells it: Enter, Escape, Tab, ArrowDown, a, Shift+Tab.
refstringElement ref from the latest cor_snapshot, e.g. "e4". Alternative to target.
targetstringCSS selector for the element — must match exactly one. Alternative to ref.

cor_close Close the browser

Close the browser and forget the session. The next cor_open starts a fresh one.

cor_snapshot List interactive elements

Outline of the visible interactive elements on the current page, each with a ref (e1, e2…), nested only under what identifies it: landmarks, sections by heading, tables (column / row), list items. Pick the element you need, then pass its ref to cor_inspect. Markers: ✓id test attribute, +N hidden lookalikes, [disabled]/[checked]/[expanded]/[selected], [unstable id]; "clickable" is an element with no role that the page makes clickable (cursor: pointer). Take a new snapshot after any navigation or act call — earlier refs expire. On a large page it answers with a region index (each region's…

ParameterTypeDescription
fullbooleanThe whole outline even on a large page, instead of the region index.
withinstringShow one region in full instead — every line of text, prices and labels included. A ref (its region: the card, row, column or section that identifies it) or a region's name (a heading, a landmark la…

cor_inspect Get ranked locators for an element

Rank, score and match-count locators for one element, rendered for the chosen test framework. Pass a ref from cor_snapshot, or a CSS selector that matches exactly one element — or targets: many of them in one call, one entry each. The response leads with the recommendation; below the quality floor it recommends an application change (a test attribute) instead of a fragile locator. Use the locator as given; write the surrounding test code yourself.

ParameterTypeDescription
allbooleanList every alternative. By default: the runner-up and the best of each other locator kind, up to 3.
detailbooleanP4: the full reply — alternatives, facts, why this order, the durable annotation. By default: the answer and its code, about 6 lines.
frameworkstringTest framework to render and rank for. Default: the project's framework as cor_open reported it, else playwright.
refstringElement ref from the latest cor_snapshot, e.g. "e4".
selectorstringCSS or Playwright selector (:text-is, >>, text=) matching exactly one element — alternative to ref.
targetsarrayP2a: several refs or selectors at once — every element you need from this page in one call. Each gets its entry only (no alternatives); inspect one ref alone for the detail.

cor_grade Grade an existing selector

Diagnose a selector that already exists — from a test file, a failing test, or a pull request — against the open page. When a test fails on a locator, call this FIRST, before re-identifying the element. It says whether the locator is broken (matches nothing), ambiguous (matches several), fragile, or healthy. If it reports Healthy, STOP: the locator is not why the test failed — look at the product or the assertion instead of replacing it. Accepts a CSS selector, an XPath, page.getByRole/getByText/getByLabel/getByPlaceholder/getByTestId/getByAltText/getByTitle(…) or page.locator('…') â…

ParameterTypeDescription
frameworkstringFramework to render alternatives for. Default: the framework of the project as cor_open reported it, else the form of the selector (getBy* → playwright, cy.* → cypress), else playwright.
locatorstringSame as selector.
paramstringFor a parameterised helper: the variable in the selector (e.g. title in getByText(title, { exact: true })). COR runs the locator for every value and says which items no value reaches.
selectorstringThe selector exactly as written in the test, e.g. page.getByRole('button', { name: 'Save' }) or cy.get('.btn').
valuesarrayValues to run the parameterised locator with. Omit to let COR find each item's values on the page (needs the chain to start with page.locator('css')).

cor_check Check every locator in the test files carries a COR id

Run before the tests. Scans the test and locator files changed on this branch (or all: true for the whole project) and fails any locator without a COR id (the // COR cor:… comment an entry carries), any id COR did not issue here, and any positional pick (.first(), .nth(), .eq(), [n]). With the locator's page open it returns the fix: COR's entry to paste, or the id to add for a locator COR already has a record of.

ParameterTypeDescription
allbooleanCheck every file in the project instead of the changed ones.
filesarrayFiles to check, relative to the project root. Default: changed files.

cor_heal Propose a replacement for a broken locator

When a test fails because a locator no longer finds its element. Pass the locator line as it is in the file (its // COR cor:… comment included) or its id, with the page open where the element should be. COR opens the committed record for that id, tries the locators it recorded while this one worked, then the element's fingerprint, and proposes a graded replacement — or declines. It never edits a file. With no id, it lists the elements on this page whose recorded locators all fail.

ParameterTypeDescription
idstringThe entry's id (the 6 characters after cor:).
locatorstringThe broken locator line, its cor: comment included.

cor_explore Run several steps in one call

Discovery in one call: a list of steps, run in order — { open: url }, { click: ref|selector }, { fill: ref|selector, value }, { press: key, target? }, { inspect: ref|selector|[…] }, { within: region }, { expect: "exact text shown" }. Each step replies as its own tool would; refs from one step work in the next until a step opens a new page. No conditions or loops. It stops at the first step that fails (an element that is not exactly one, text not shown) and returns what ran, the page's region index with refs, and the step to resume from (resumeFrom). Put static elements first and the step t…

ParameterTypeDescription
steps *arraySteps, in order.
resumeFromintegerSkip to this step number (1-based) — from a previous stopped run.