getMetaTags
Extract all meta tags from web pages to analyze SEO elements, structured data, and page metadata for automation and analysis tasks.
Instructions
Get all meta tags from the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/controllers/playwright.ts:370-391 (handler)Core handler function that retrieves all meta tags from the current page by evaluating JavaScript on the page to query 'meta' elements and extract name, property, content, and httpEquiv attributes.async getMetaTags(): Promise<Array<{name?: string, property?: string, content?: string, httpEquiv?: string}>> { try { if (!this.isInitialized()) { throw new Error('Browser not initialized'); } this.log('Getting meta tags'); const metaTags = await this.state.page?.evaluate(() => { const metaElements = Array.from(document.querySelectorAll('meta')); return metaElements.map(meta => ({ name: meta.getAttribute('name') || undefined, property: meta.getAttribute('property') || undefined, content: meta.getAttribute('content') || undefined, httpEquiv: meta.getAttribute('http-equiv') || undefined })); }); this.log('Meta tags retrieved:', metaTags?.length); return metaTags || []; } catch (error: any) { console.error('Get meta tags error:', error); throw new BrowserError('Failed to get meta tags', 'Check if the page is loaded'); } }
- src/server.ts:719-724 (handler)MCP callTool dispatch handler for getMetaTags that invokes the Playwright controller method and returns the JSON-stringified result.} case 'getMetaTags': { const metaTags = await playwrightController.getMetaTags(); return { content: [{ type: "text", text: JSON.stringify(metaTags, null, 2) }] }; }
- src/server.ts:143-151 (schema)Tool schema definition, specifying name, description, and empty input schema (no parameters required).const GET_META_TAGS_TOOL: Tool = { name: "getMetaTags", description: "Get all meta tags from the current page", inputSchema: { type: "object", properties: {}, required: [] } };
- src/server.ts:528-528 (registration)Registers the getMetaTags tool in the tools dictionary provided to the MCP server capabilities.getMetaTags: GET_META_TAGS_TOOL,