get_page_info
Retrieve details about the currently open webpage, including URL, title, and metadata, to understand page context and support browsing automation.
Instructions
Get information about the current page
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_page_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:314-321 (registration)Tool registration for 'get_page_info' in the ListToolsRequestSchema handler. Defines the tool name, description, and empty input schema (no parameters required).
{ name: 'get_page_info', description: 'Get information about the current page', inputSchema: { type: 'object', properties: {} } }, - src/index.ts:632-652 (handler)Handler implementation for 'get_page_info' tool. Checks if a browser page is available, then retrieves the page title, URL, and viewport size using playwright's Page API, returning them as formatted text.
case 'get_page_info': { if (!currentPage) { throw new Error('No browser page available. Launch a browser first.'); } const title = await currentPage.title(); const url = currentPage.url(); const viewport = currentPage.viewportSize(); return { content: [ { type: 'text', text: `Page Info: Title: ${title} URL: ${url} Viewport: ${viewport?.width}x${viewport?.height}` } ] }; }