filament_discover_docs
Find live documentation routes for FilamentPHP admin panels to access official guides and component references for building Laravel applications.
Instructions
Discover live documentation routes from filamentphp.com
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | 5.x |
Implementation Reference
- src/lib/doc-fetcher.ts:169-190 (handler)The core logic for discovering documentation routes from filamentphp.com.
export async function discoverDocRoutes(version: "4.x" | "5.x"): Promise<DiscoveredDocRoute[]> { const docsRootUrl = `${DOCS_BASE_URL}/${version}`; try { const html = await fetchHtml(docsRootUrl); const $ = cheerio.load(html); const routes = new Map<string, DiscoveredDocRoute>(); $("a[href]").each((_, link) => { const href = $(link).attr("href"); if (!href) { return; } const absolute = href.startsWith("http") ? href : `https://filamentphp.com${href}`; const routeMatch = absolute.match(new RegExp(`/docs/${version}/([^/#?]+)/([^/#?]+)`)); if (!routeMatch) { return; } const category = normalizeSegment(routeMatch[1]); - src/tools/index.ts:193-220 (registration)The MCP tool registration and response handling for 'filament_discover_docs'.
server.tool("filament_discover_docs", "Discover live documentation routes from filamentphp.com", { version: versionSchema, }, async ({ version }) => { try { const routes = await discoverDocRoutes(version); if (routes.length === 0) { return { content: [{ type: "text", text: "# No Live Routes Found\n\nCould not discover documentation routes right now. Use `filament_list_docs` for fallback static sections.", }], }; } return { content: [{ type: "text", text: `# Live Docs Routes (${version})\n\n${routes.map((route) => `- ${route.category}/${route.section} → ${route.url}`).join("\n")}`, }], }; } catch (error) { return { content: [{ type: "text", text: formatErrorMessage("Docs Route Discovery Failed", error, "Try again shortly or use `filament_list_docs`."), }], };