Skip to main content
Glama

export_page

Export a webpage and its resources for offline use or analysis. Specify a URL, headers, and optional best-attempt mode to capture content efficiently through browser automation.

Instructions

Export webpage with resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bestAttemptNo
headersNo
urlYes

Implementation Reference

  • MCP tool handler for 'export_page' that validates arguments, calls the client.exportPage method, and formats the response as MCP content.
    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'); } }
  • Core client method that sends HTTP POST request to Browserless /export endpoint with ExportRequest and returns the 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); } }
  • Zod schema and TypeScript type definition for ExportRequest used in the exportPage tool.
    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>;
  • src/index.ts:160-171 (registration)
    Tool registration in ListTools response, including name, description, and simplified input schema.
    name: 'export_page', description: 'Export webpage with resources', inputSchema: { type: 'object', properties: { url: { type: 'string' }, headers: { type: 'object' }, bestAttempt: { type: 'boolean' }, }, required: ['url'], }, },
  • TypeScript interface for ExportResponse returned by the export_page tool.
    export interface ExportResponse { html: string; resources: Array<{ url: string; data: Buffer; type: string; }>; }

Other Tools

Related Tools

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