Skip to main content
Glama

export_page

Export webpages with all embedded resources for offline use or archiving. This tool captures complete page content including images, stylesheets, and scripts from any URL.

Instructions

Export webpage with resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
headersNo
bestAttemptNo

Implementation Reference

  • Core handler implementation for the 'export_page' tool. Makes a POST request to Browserless /export endpoint with ExportRequest and returns ExportResponse.
    async exportPage(request: ExportRequest): Promise<BrowserlessResponse<ExportResponse>> { try { const response: AxiosResponse<ExportResponse> = await this.httpClient.post('/export', request); return { success: true, data: response.data, }; } catch (error) { return this.handleError(error); } }
  • src/index.ts:159-171 (registration)
    Tool registration in MCP ListTools response, defining name, description, and input schema for 'export_page'.
    { name: 'export_page', description: 'Export webpage with resources', inputSchema: { type: 'object', properties: { url: { type: 'string' }, headers: { type: 'object' }, bestAttempt: { type: 'boolean' }, }, required: ['url'], }, },
  • MCP CallTool handler that invokes BrowserlessClient.exportPage and formats the response.
    case 'export_page': { if (!args) throw new Error('Arguments are required'); const result = await this.client!.exportPage(args as any); if (result.success && result.data) { return { content: [ { type: 'text', text: `Page exported successfully with ${result.data.resources.length} resources.`, }, { type: 'text', text: result.data.html, }, ], }; } else { throw new Error(result.error || 'Failed to export page'); } }
  • Detailed Zod schema validation for ExportRequest input type.
    export const ExportRequestSchema = z.object({ url: z.string(), headers: z.record(z.string()).optional(), gotoOptions: z.object({ waitUntil: z.string().optional(), timeout: z.number().optional(), }).optional(), waitForSelector: WaitForSelectorSchema.optional(), waitForTimeout: z.number().optional(), bestAttempt: z.boolean().optional(), }); export type ExportRequest = z.infer<typeof ExportRequestSchema>;
  • TypeScript interface for ExportResponse output type.
    export interface ExportResponse { html: string; resources: Array<{ url: string; data: Buffer; type: string; }>; }

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/Lizzard-Solutions/browserless-mcp'

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