Skip to main content
Glama

get_current_page_info

Retrieve current browser state including active URL, page title, and open tabs to confirm navigation, track multi-step processes, and manage tab switching.

Instructions

Retrieve comprehensive information about the current browser state including current URL, page title, number of open tabs, and details about each tab. Essential for understanding where you are in a multi-step process, confirming navigation worked, or deciding which tab to switch to. Returns list of all tabs with their URLs, titles, and which one is currently active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID obtained from initialize_session

Implementation Reference

  • The core handler function that executes the get_current_page_info tool logic, fetching current page URL, title, tab information, and session details using Puppeteer.
    export async function getCurrentPageInfo(sessionId) { const session = getSession(sessionId); const { page, context, createdAt } = session; const pages = context.pages(); const pageInfo = { success: true, sessionId, currentUrl: page.url(), title: await page.title(), totalTabs: pages.length, currentTabIndex: pages.indexOf(page), sessionCreatedAt: createdAt, allTabs: await Promise.all( pages.map(async (p, idx) => ({ index: idx, url: p.url(), title: await p.title(), isCurrent: p === page, })) ), }; return pageInfo; }
  • Defines the tool schema including name, description, and input schema for validation in the MCP listTools response.
    name: "get_current_page_info", description: "Retrieve comprehensive information about the current browser state including current URL, page title, number of open tabs, and details about each tab. Essential for understanding where you are in a multi-step process, confirming navigation worked, or deciding which tab to switch to. Returns list of all tabs with their URLs, titles, and which one is currently active.", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "Session ID obtained from initialize_session", }, }, required: ["sessionId"], }, },
  • src/index.js:531-541 (registration)
    Registers the tool handler dispatch in the CallToolRequestSchema switch statement, validating input and calling the getCurrentPageInfo function.
    case "get_current_page_info": { const { sessionId } = args; if (!sessionId) { throw new McpError( ErrorCode.InvalidParams, "sessionId parameter is required" ); } result = await getCurrentPageInfo(sessionId); break; }

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/pyscout/webscout-mcp'

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