on_page_instant_pages
Analyze page-specific SEO optimization data to identify improvements for organic search performance, including technical metrics and content optimization insights.
Instructions
Using this function you will get page-specific data with detailed information on how well a particular page is optimized for organic search
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accept_language | No | language header for accessing the website all locale formats are supported (xx, xx-XX, xxx-XX, etc.) Note: if you do not specify this parameter, some websites may deny access; in this case, pages will be returned with the "type":"broken in the response array | |
| custom_js | No | Custom JavaScript code to execute | |
| custom_user_agent | No | Custom User-Agent header | |
| enable_javascript | No | Enable JavaScript rendering | |
| url | Yes | URL to analyze |
Implementation Reference
- Executes the tool by making a POST request to DataForSEO's /v3/on_page/instant_pages endpoint with the provided parameters, handles response and errors using base tool methods.async handle(params: { url: string; enable_javascript?: boolean; custom_js?: string; custom_user_agent?: string; accept_language?: string; }): Promise<any> { try { const response = await this.dataForSEOClient.makeRequest('/v3/on_page/instant_pages', 'POST', [{ url: params.url, enable_javascript: params.enable_javascript, custom_js: params.custom_js, custom_user_agent: params.custom_user_agent, accept_language: params.accept_language, }]); return this.validateAndFormatResponse(response); } catch (error) { return this.formatErrorResponse(error); } }
- Defines the Zod schema for the tool's input parameters: required URL and optional JavaScript rendering options.getParams(): z.ZodRawShape { return { url: z.string().describe("URL to analyze"), enable_javascript: z.boolean().optional().describe("Enable JavaScript rendering"), custom_js: z.string().optional().describe("Custom JavaScript code to execute"), custom_user_agent: z.string().optional().describe("Custom User-Agent header"), accept_language: z.string().optional().describe(`language header for accessing the website all locale formats are supported (xx, xx-XX, xxx-XX, etc.) Note: if you do not specify this parameter, some websites may deny access; in this case, pages will be returned with the "type":"broken in the response array`), }; }
- src/core/modules/onpage/onpage-api.module.ts:9-25 (registration)Registers the InstantPagesTool by instantiating it and including it in the module's tools map under its getName(), with description, params, and handler.getTools(): Record<string, ToolDefinition> { const tools = [ new ContentParsingTool(this.dataForSEOClient), new InstantPagesTool(this.dataForSEOClient), new LighthouseTool(this.dataForSEOClient), // Add more tools here ]; return tools.reduce((acc, tool) => ({ ...acc, [tool.getName()]: { description: tool.getDescription(), params: tool.getParams(), handler: (params: any) => tool.handle(params), }, }), {}); }