Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

getPageTitle

Extract the title of the current web page during browser automation, useful for web scraping, testing, and verifying page content.

Instructions

Get the title of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function in PlaywrightController that retrieves and returns the title of the current browser page using page.title().
    async getPageTitle(): Promise<string> {
      try {
        if (!this.isInitialized()) {
          throw new Error('Browser not initialized');
        }
        this.log('Getting page title');
        const title = await this.state.page?.title();
        this.log('Page title retrieved:', title);
        return title || '';
      } catch (error: any) {
        console.error('Get page title error:', error);
        throw new BrowserError('Failed to get page title', 'Check if the page is loaded');
      }
    }
  • Tool schema definition including name, description, and input schema (no input parameters required). This is used for MCP tool registration.
    const GET_PAGE_TITLE_TOOL: Tool = {
      name: "getPageTitle",
      description: "Get the title of the current page",
      inputSchema: {
        type: "object",
        properties: {},
        required: []
      }
    };
  • src/server.ts:514-553 (registration)
    Registration of the getPageTitle tool in the MCP server's tools dictionary, which is passed to server capabilities.
    const tools = {
      openBrowser: OPEN_BROWSER_TOOL,
      navigate: NAVIGATE_TOOL,
      type: TYPE_TOOL,
      click: CLICK_TOOL,
      moveMouse: MOVE_MOUSE_TOOL,
      scroll: SCROLL_TOOL,
      screenshot: SCREENSHOT_TOOL,
      getPageSource: GET_PAGE_SOURCE_TOOL,
      getPageText: GET_PAGE_TEXT_TOOL,
      getPageTitle: GET_PAGE_TITLE_TOOL,
      getPageUrl: GET_PAGE_URL_TOOL,
      getScripts: GET_SCRIPTS_TOOL,
      getStylesheets: GET_STYLESHEETS_TOOL,
      getMetaTags: GET_META_TAGS_TOOL,
      getLinks: GET_LINKS_TOOL,
      getImages: GET_IMAGES_TOOL,
      getForms: GET_FORMS_TOOL,
      getElementContent: GET_ELEMENT_CONTENT_TOOL,
      getElementHierarchy: GET_ELEMENT_HIERARCHY_TOOL,
      executeJavaScript: EXECUTE_JAVASCRIPT_TOOL,
      goForward: GO_FORWARD_TOOL,
      hover: HOVER_TOOL,
      dragAndDrop: DRAG_AND_DROP_TOOL,
      selectOption: SELECT_OPTION_TOOL,
      pressKey: PRESS_KEY_TOOL,
      waitForText: WAIT_FOR_TEXT_TOOL,
      waitForSelector: WAIT_FOR_SELECTOR_TOOL,
      resize: RESIZE_TOOL,
      handleDialog: HANDLE_DIALOG_TOOL,
      getConsoleMessages: GET_CONSOLE_MESSAGES_TOOL,
      getNetworkRequests: GET_NETWORK_REQUESTS_TOOL,
      uploadFiles: UPLOAD_FILES_TOOL,
      evaluateWithReturn: EVALUATE_WITH_RETURN_TOOL,
      takeScreenshot: TAKE_SCREENSHOT_TOOL,
      mouseMove: MOUSE_MOVE_TOOL,
      mouseClick: MOUSE_CLICK_TOOL,
      mouseDrag: MOUSE_DRAG_TOOL,
      closeBrowser: CLOSE_BROWSER_TOOL
    };
  • src/server.ts:693-698 (registration)
    Dispatch/execution handler in the MCP callTool request handler that invokes the Playwright controller's getPageTitle method and returns the result.
    case 'getPageTitle': {
      const title = await playwrightController.getPageTitle();
      return {
        content: [{ type: "text", text: title }]
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states what the tool does but doesn't disclose behavioral traits like whether it requires a browser session to be active, if it works on all page types, error conditions, or performance characteristics.

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 a single, clear sentence with zero wasted words. It's front-loaded with the essential information and perfectly sized for a simple tool with no parameters.

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

Completeness3/5

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

For a zero-parameter tool with no output schema, the description adequately states what it does. However, without annotations or output details, it lacks completeness regarding behavioral context and return value format, which would help an agent use it correctly.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose without unnecessary detail.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('title of the current page'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'getPageText' or 'getPageSource', which also retrieve page content but different aspects.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'getPageText' and 'getPageSource' available, there's no indication of when retrieving just the title is preferred over other page content tools.

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/jomon003/PlayMCP'

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