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";
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool returns a list of tabs with URLs, titles, and active status, which is useful behavioral context. However, it doesn't mention potential limitations like performance impact, session requirements, or error handling, leaving gaps for a tool that retrieves comprehensive state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by usage context and return details. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (retrieving multi-tab browser state) and no annotations or output schema, the description does a good job by specifying what information is returned. However, it could be more complete by detailing the return format (e.g., JSON structure) or handling of edge cases like no open tabs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the sessionId parameter. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline of 3 for high schema coverage without compensating with extra details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and the resource 'comprehensive information about the current browser state', listing specific details like URL, page title, and tab information. It distinguishes itself from siblings like switch_tab (for switching) and navigate_to_url (for navigation) by focusing on retrieving state information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: 'understanding where you are in a multi-step process, confirming navigation worked, or deciding which tab to switch to'. However, it doesn't explicitly state when not to use it or name specific alternatives among siblings, such as get_network_capture_status for network-related state.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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