Skip to main content
Glama
close-page.ts631 B
import { getPages } from "../browser-instances" export async function closePage(pageId: string) { const pages = getPages() const pageInstance = pages[pageId] if (!pageInstance) { return JSON.stringify({ success: false, error: `Page with ID '${pageId}' not found`, }, null, 2) } const { page } = pageInstance // Close the page try { if (!page.isClosed()) { await page.close() } } catch { // do nothing } // Remove from global object delete pages[pageId] return JSON.stringify({ success: true, message: `Page ${pageId} closed successfully`, }, null, 2) }

Implementation Reference

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/matiasngf/mcp-fetch'

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