Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

getPageUrl

Retrieve the current webpage URL to track navigation, verify page location, or extract web addresses during browser automation tasks.

Instructions

Get the URL of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function in PlaywrightController that retrieves and returns the current page URL using page.url(), with error handling for uninitialized browser.
    async getPageUrl(): Promise<string> { try { if (!this.isInitialized()) { throw new Error('Browser not initialized'); } this.log('Getting page URL'); const url = this.state.page?.url(); this.log('Page URL retrieved:', url); return url || ''; } catch (error: any) { console.error('Get page URL error:', error); throw new BrowserError('Failed to get page URL', 'Check if the page is loaded'); } }
  • The Tool object definition providing the schema for getPageUrl, including name, description, and empty input schema (no parameters required).
    const GET_PAGE_URL_TOOL: Tool = { name: "getPageUrl", description: "Get the URL of the current page", inputSchema: { type: "object", properties: {}, required: [] } };
  • src/server.ts:700-705 (registration)
    Registration in the callTool request handler switch statement that dispatches the getPageUrl tool call to the playwrightController.getPageUrl() method and returns the result.
    case 'getPageUrl': { const url = await playwrightController.getPageUrl(); return { content: [{ type: "text", text: url }] }; }
  • src/server.ts:525-525 (registration)
    Registration of the getPageUrl tool in the tools dictionary used for capabilities and listTools.
    getPageUrl: GET_PAGE_URL_TOOL,

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