get_current_url
Retrieve the current URL of a specified browser tab in Firefox using the Firefox MCP Server. Ideal for automation and multi-tab debugging workflows with Playwright integration.
Instructions
Get current page URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No |
Implementation Reference
- index-multi-debug.js:1327-1339 (handler)The core handler function for the 'get_current_url' tool. It ensures the browser is running, gets the page for the specified or active tab, retrieves the current URL using page.url(), and returns it formatted in MCP response.async getCurrentUrl(args = {}) { this.ensureBrowserRunning(); const { tabId } = args; const page = this.getPage(tabId); const url = page.url(); return { content: [{ type: 'text', text: `Current URL in tab '${tabId || this.activeTabId}': ${url}` }] }; }
- index-multi-debug.js:228-235 (schema)The tool schema definition in the listTools response, specifying name, description, and input schema (optional tabId string).{ name: 'get_current_url', description: 'Get current page URL', inputSchema: { type: 'object', properties: { tabId: { type: 'string' } } } },
- index-multi-debug.js:429-430 (registration)Registration in the CallToolRequestSchema handler switch statement, dispatching calls to the getCurrentUrl method.case 'get_current_url': return await this.getCurrentUrl(args);
- index-multi-debug.js:1021-1033 (helper)Helper method used by getCurrentUrl to retrieve the Playwright Page object for the given tabId or the active tab.getPage(tabId) { if (tabId) { if (!this.pages.has(tabId)) { throw new Error(`Tab '${tabId}' not found`); } return this.pages.get(tabId); } else { if (!this.activeTabId || !this.pages.has(this.activeTabId)) { throw new Error('No active tab. Use create_tab or set_active_tab first.'); } return this.pages.get(this.activeTabId); } }
- index-multi-debug.js:1400-1405 (helper)Helper method called by getCurrentUrl to ensure the browser instance is launched before accessing pages.ensureBrowserRunning() { if (!this.browser) { throw new Error('Firefox browser is not running. Please launch it first using the launch_firefox_multi tool.'); } }