pilot_pdf
Convert web pages to PDF files for saving or sharing content. Specify an output path to generate PDFs from browser automation.
Instructions
Save the current page as a PDF.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | No | Output file path |
Implementation Reference
- src/tools/visual.ts:73-87 (handler)Registration and implementation of the 'pilot_pdf' tool.
server.tool( 'pilot_pdf', 'Save the current page as a PDF.', { output_path: z.string().optional().describe('Output file path') }, async ({ output_path }) => { await bm.ensureBrowser(); try { const pdfPath = output_path || path.join(TEMP_DIR, 'pilot-page.pdf'); await bm.getPage().pdf({ path: pdfPath, format: 'A4' }); return { content: [{ type: 'text' as const, text: `PDF saved: ${pdfPath}` }] }; } catch (err) { return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } );