MCPcopy
hub / github.com/colinhacks/zod / GET

Function GET

packages/docs/app/llms.txt/route.ts:40–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40export async function GET() {
41 const pages = source.getPages();
42
43 // Generate LLMS.txt content
44 let txt = `# Zod
45
46> Zod is a TypeScript-first schema validation library with static type inference. This documentation provides comprehensive coverage of Zod 4's features, API, and usage patterns.
47
48`;
49
50 // Process each page
51 for (const page of pages) {
52 // Skip separator entries that start with "---"
53 const title = stringifyTitle(page.data.title);
54 if (title.startsWith("---")) {
55 continue;
56 }
57
58 // Create section for each page
59 txt += `## ${title || "Untitled"}\n\n`;
60
61 // Add main page link with description from frontmatter
62 const pageUrl = `https://zod.dev${page.url}`;
63 const description = page.data.description || "Documentation page";
64 txt += `- [${title || "Untitled"}](${pageUrl}): ${description}\n`;
65
66 // Add TOC sections for deep linking
67 if (page.data.toc && page.data.toc.length > 0) {
68 // Group sections by depth for better organization
69 const sections = page.data.toc.filter((item: any) => item.depth >= 2 && item.depth <= 4);
70
71 if (sections.length > 0) {
72 txt += "\n";
73
74 for (const section of sections) {
75 const sectionTitle = stringifyTitle(section.title);
76 if (!sectionTitle) continue;
77
78 const anchor = section.url.replace("#", "");
79 const fullUrl = `https://zod.dev${page.url}?id=${anchor}`;
80
81 txt += `- [${sectionTitle}](${fullUrl})\n`;
82 }
83 }
84 }
85
86 txt += "\n";
87 }
88
89 txt += `---
90
91This documentation covers Zod v4, a TypeScript-first schema validation library. Use the URLs above to access specific pages and sections for detailed information about schema definition, validation, error handling, and advanced patterns.
92`;
93
94 return new Response(txt, {
95 headers: {
96 "Content-Type": "text/plain; charset=utf-8",
97 },

Callers

nothing calls this directly

Calls 2

stringifyTitleFunction · 0.85
startsWithMethod · 0.65

Tested by

no test coverage detected