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,
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe the return format (e.g., string URL), error conditions, or dependencies like requiring a page to be loaded. This leaves gaps for a tool that likely interacts with a browser environment.

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, making it highly efficient and front-loaded. It directly communicates the core functionality without unnecessary elaboration, which is ideal for a simple tool.

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?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks context about the browser environment or return value. It doesn't fully compensate for the absence of annotations or output schema, leaving some operational details unclear.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't mention parameters, aligning with the schema, which justifies a baseline score of 4 for this dimension.

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 verb 'Get' and the resource 'URL of the current page', making the purpose immediately understandable. It doesn't distinguish from siblings like 'getPageTitle' or 'getPageSource', but the specificity of 'URL' provides adequate differentiation for a simple tool.

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?

No guidance is provided on when to use this tool versus alternatives like 'getPageTitle' or 'getPageSource', nor does it mention prerequisites such as needing an active browser session. The description implies usage in a browser context but lacks explicit context or exclusions.

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