get_url
Retrieves the current page URL during browser automation sessions to enable navigation tracking, link verification, and web scraping workflows.
Instructions
Get the current page URL
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_url"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools-playwright.js:196-199 (handler)The execute function (handler) for the 'get_url' tool. It calls the browser's getUrl method and returns the URL in a standardized success response format.
handler: async () => { const url = await browser.getUrl(); return { success: true, data: { url }, message: `Current URL: ${url}` }; } - tools-playwright.js:191-195 (schema)The input schema for the 'get_url' tool, which takes no parameters.
inputSchema: { type: 'object', properties: {}, required: [] }, - tools-playwright.js:188-200 (registration)Registration of the 'get_url' tool as an object in the array returned by createPlaywrightTools(browser), making it available for MCP.
{ name: 'get_url', description: 'Get the current page URL', inputSchema: { type: 'object', properties: {}, required: [] }, handler: async () => { const url = await browser.getUrl(); return { success: true, data: { url }, message: `Current URL: ${url}` }; } }, - browser.js:111-114 (helper)Supporting helper method getUrl on the SimpleBrowser class used by the tool handler to retrieve the current page URL via Playwright API.
async getUrl() { await this.ensureLaunched(); return this.page.url(); }