Skip to main content
Glama

Lighthouse MCP

by mizchi
l1-get-report.tsโ€ข1.69 kB
/** * L1: Get Report Tool */ import { getDefaultStorage } from '../core/reportStorage.js'; export interface L1GetReportParams { reportId: string; } export interface L1GetReportResult { reportId: string; data: any; // Raw Lighthouse report data metadata: { url: string; device: string; categories: string[]; timestamp: number; }; } export const l1GetReportTool = { name: 'l1_get_report', description: 'Get raw Lighthouse report data by ID (Layer 1)', inputSchema: { type: 'object', properties: { reportId: { type: 'string', description: 'Report ID', }, }, required: ['reportId'], }, execute: async (params: any) => { const result = await executeL1GetReport(params); return { type: 'text', text: JSON.stringify(result, null, 2) }; } }; export async function executeL1GetReport(params: L1GetReportParams): Promise<L1GetReportResult> { const { reportId } = params; const storage = getDefaultStorage(); const allReports = storage.getAllReports(); if (allReports.isErr()) { throw new Error(`Failed to get reports: ${allReports.error.message}`); } const reportMeta = allReports.value.find(r => r.id === reportId); if (!reportMeta) { throw new Error(`Report not found: ${reportId}`); } const report = storage.loadReport(reportMeta); if (report.isErr()) { throw new Error(`Failed to load report: ${report.error.message}`); } return { reportId, data: report.value, metadata: { url: reportMeta.url, device: reportMeta.device, categories: reportMeta.categories, timestamp: reportMeta.timestamp, }, }; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mizchi/lighthouse-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server