pilot_page_diff
Compare webpage content between two URLs to identify differences in staging versus production environments or other page versions.
Instructions
Text diff between two URLs — compare staging vs production, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url1 | Yes | First URL | |
| url2 | Yes | Second URL |
Implementation Reference
- src/tools/visual.ts:122-157 (handler)Implementation of the pilot_page_diff MCP tool, which compares the textual content of two URLs using diff-lines.
server.tool( 'pilot_page_diff', 'Text diff between two URLs — compare staging vs production, etc.', { url1: z.string().describe('First URL'), url2: z.string().describe('Second URL'), }, async ({ url1, url2 }) => { await bm.ensureBrowser(); try { const page = bm.getPage(); await validateNavigationUrl(url1); await page.goto(url1, { waitUntil: 'domcontentloaded', timeout: 15000 }); const text1 = await getCleanText(page); await validateNavigationUrl(url2); await page.goto(url2, { waitUntil: 'domcontentloaded', timeout: 15000 }); const text2 = await getCleanText(page); const changes = Diff.diffLines(text1, text2); const output: string[] = [`--- ${url1}`, `+++ ${url2}`, '']; for (const part of changes) { const prefix = part.added ? '+' : part.removed ? '-' : ' '; const lines = part.value.split('\n').filter(l => l.length > 0); for (const line of lines) { output.push(`${prefix} ${line}`); } } return { content: [{ type: 'text' as const, text: output.join('\n') }] }; } catch (err) { return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } );