Skip to main content
Glama

browser_pdf_save

Save web pages as PDFs for accessibility compliance checks. Specify a custom filename or use a default timestamp-based name to store the document for further review.

Instructions

Save page as PDF

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoFile name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.

Implementation Reference

  • The handler function for the 'browser_pdf_save' tool. It generates an output filename (defaulting to 'page-{timestamp}.pdf'), adds generated code and result message to the response, and saves the current page as PDF using Playwright's page.pdf() method.
    handle: async (tab, params, response) => { const fileName = await tab.context.outputFile(params.filename ?? `page-${new Date().toISOString()}.pdf`); response.addCode(`await page.pdf(${javascript.formatObject({ path: fileName })});`); response.addResult(`Saved page as ${fileName}`); await tab.page.pdf({ path: fileName }); },
  • Zod schema defining the input parameters for the tool: an optional 'filename' string.
    const pdfSchema = z.object({ filename: z.string().optional().describe('File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.'), });
  • Tool metadata schema including name, title, description, inputSchema reference, and readOnly type.
    schema: { name: 'browser_pdf_save', title: 'Save as PDF', description: 'Save page as PDF', inputSchema: pdfSchema, type: 'readOnly', },
  • src/tools/pdf.ts:26-47 (registration)
    Defines the 'browser_pdf_save' tool using defineTabTool and exports it as the default array for inclusion in the tools registry.
    const pdf = defineTabTool({ capability: 'pdf', schema: { name: 'browser_pdf_save', title: 'Save as PDF', description: 'Save page as PDF', inputSchema: pdfSchema, type: 'readOnly', }, handle: async (tab, params, response) => { const fileName = await tab.context.outputFile(params.filename ?? `page-${new Date().toISOString()}.pdf`); response.addCode(`await page.pdf(${javascript.formatObject({ path: fileName })});`); response.addResult(`Saved page as ${fileName}`); await tab.page.pdf({ path: fileName }); }, }); export default [ pdf, ];
  • src/tools.ts:50-50 (registration)
    Includes the pdf tools (including 'browser_pdf_save') in the allTools array that is used by the backend for listTools().
    ...pdf,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JustasMonkev/mcp-accessibility-scanner'

If you have feedback or need assistance with the MCP directory API, please join our Discord server