Skip to main content
Glama

get_current_page_info

Retrieve current browser state details including URL, page title, and open tabs to confirm navigation, track multi-step processes, or identify active tabs.

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. It retrieves the browser session, extracts current page details (URL, title), tab information, and returns a structured object with all relevant page state.
    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; }
  • Input schema definition for the get_current_page_info tool, specifying the required sessionId parameter.
    inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "Session ID obtained from initialize_session", }, }, required: ["sessionId"], },
  • src/index.js:274-287 (registration)
    Tool registration in the MCP server's listTools response. Defines the tool name, description, and input schema for get_current_page_info.
    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"], }, },
  • Dispatch handler in the MCP server's CallToolRequestSchema handler that validates the sessionId argument and invokes 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; }
  • Re-export of the getCurrentPageInfo function from visualInspection.js, making it available for import in the main index.js.
    export { takeScreenshot, getCurrentPageInfo } from "./visualInspection.js";

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