dataforseo-mcp-server
Version:
A Model Context Protocol (MCP) server for the DataForSEO API, enabling modular and extensible integration of DataForSEO endpoints with support for both HTTP and SSE transports.
38 lines • 1.47 kB
JavaScript
import { z } from 'zod';
import { BaseTool } from '../../base.tool.js';
export class LighthouseTool extends BaseTool {
client;
constructor(client) {
super(client);
this.client = client;
}
getName() {
return 'on_page_lighthouse';
}
getDescription() {
return 'The OnPage Lighthouse API is based on Google’s open-source Lighthouse project for measuring the quality of web pages and web apps.';
}
getParams() {
return {
url: z.string().describe("URL of the page to parse"),
enable_javascript: z.boolean().optional().describe("Enable JavaScript rendering"),
custom_user_agent: z.string().optional().describe("Custom User-Agent header"),
accept_language: z.string().optional().describe("Accept-Language header value"),
};
}
async handle(params) {
try {
const response = await this.dataForSEOClient.makeRequest('/v3/on_page/lighthouse/live/json', 'POST', [{
url: params.url,
enable_javascript: params.enable_javascript,
custom_user_agent: params.custom_user_agent,
accept_language: params.accept_language,
}]);
return this.validateAndFormatResponse(response);
}
catch (error) {
return this.formatErrorResponse(error);
}
}
}
//# sourceMappingURL=lighthouse.tool.js.map