health_check
Check if Puppeteer and Chromium are operational. Use this tool when rendering fails to diagnose launch issues.
Instructions
Verify Puppeteer/Chromium can launch. Use when render fails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The actual handler function for the health_check tool. It launches a browser via Puppeteer, returns version info, platform details, and outDir, or an error if the browser fails to launch.
export async function handleHealthCheck(version: string) { try { const browser = await launchBrowser(); const browserVersion = await browser.version(); await browser.close(); return { content: [{ type: "text" as const, text: JSON.stringify({ ok: true, serverVersion: version, browser: browserVersion, platform: process.platform, arch: process.arch, nodeVersion: process.version, outDir: defaultOutDir(), pid: process.pid, }, null, 2), }], }; } catch (err: any) { return { content: [{ type: "text" as const, text: JSON.stringify({ ok: false, error: err.message, platform: process.platform }), }], isError: true, }; } } - packages/mcp-server/src/server.ts:60-66 (registration)Registration of the health_check tool on the McpServer. It has an empty schema (no inputs), read-only hint, and invokes handleHealthCheck(VERSION).
server.tool( "health_check", "Verify Puppeteer/Chromium can launch. Use when render fails.", {}, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, async () => handleHealthCheck(VERSION), ); - packages/cli/src/browser.ts:18-31 (helper)The launchBrowser helper function used by handleHealthCheck to launch Puppeteer/Chromium with secure sandbox args.
export async function launchBrowser(): Promise<Browser> { try { return await puppeteer.launch({ headless: true, args: LAUNCH_ARGS, timeout: 30000, }); } catch (err: any) { throw new Error( `browser_launch_failed: ${err.message}. ` + `Ensure Chromium is available. On containers, verify /dev/shm size or set --disable-dev-shm-usage.`, ); } } - The defaultOutDir helper function used by handleHealthCheck to determine the output directory path.
export function defaultOutDir(): string { if (process.env.SLIDESHOT_OUTPUT_DIR) { return process.env.SLIDESHOT_OUTPUT_DIR; } const home = os.homedir(); const desktop = path.join(home, "Desktop"); if (fs.existsSync(desktop)) { return path.join(desktop, "slideshot-output"); } const downloads = path.join(home, "Downloads"); if (fs.existsSync(downloads)) { return path.join(downloads, "slideshot-output"); } return path.join(os.tmpdir(), "slideshot-output"); } export function resolveFormats(formats?: ImageFormat[]): ImageFormat[] { if (!formats || formats.length === 0) return ["pdf"]; return formats; }