Skip to main content
Glama
LLM_DOCS_RECOMMENDATION.mdโ€ข9.93 kB
# Recommendation: Switch to Svelte LLM-Optimized Documentation **Date:** 2025-11-06 **Status:** ๐ŸŽฏ **HIGHLY RECOMMENDED** --- ## Executive Summary Svelte now provides **LLM-optimized documentation files** that are vastly superior to web scraping: - โœ… Official format designed for LLMs - โœ… Single file download (~1 MB for full docs) - โœ… Includes both Svelte AND SvelteKit - โœ… No HTML parsing required - โœ… Maintained by Svelte team - โœ… Much more reliable **Recommendation:** Switch SvelteKit docs to use `llms-full.txt` immediately! --- ## Available Files ### 1. llms-full.txt - **URL:** `https://svelte.dev/llms-full.txt` - **Size:** 1,067,289 bytes (~1.04 MB) - **Content:** Complete Svelte + SvelteKit documentation - **Includes:** All examples, notes, legacy compatibility info ### 2. llms-medium.txt - **URL:** `https://svelte.dev/llms-medium.txt` - **Size:** 708,976 bytes (~692 KB) - **Content:** Condensed documentation - **Excludes:** Examples, legacy notes, supplementary info ### Format Structure ``` <SYSTEM>This is the full developer documentation for Svelte and SvelteKit.</SYSTEM> # Start of Svelte documentation # Overview Svelte is a framework for building user interfaces... [Full Svelte documentation] # Start of SvelteKit documentation [Full SvelteKit documentation] ``` --- ## Comparison Matrix | Factor | Current Web Scraping | LLM txt Files | |--------|---------------------|---------------| | **Reliability** | ๐Ÿ”ด Breaks on HTML changes | โœ… Stable text format | | **Maintenance** | ๐Ÿ”ด Must update selectors | โœ… Zero maintenance | | **Performance** | ๐Ÿ”ด 4 HTTP requests | โœ… 1 HTTP request | | **File Size** | ๐ŸŸก ~250KB (4 pages) | โœ… 1MB (everything!) | | **Coverage** | ๐Ÿ”ด Only 4 topics | โœ… Complete docs | | **Parsing** | ๐Ÿ”ด Complex (cheerio/turndown) | โœ… Simple (raw text) | | **Official Support** | โŒ No | โœ… Maintained by Svelte | | **LLM Optimized** | โŒ No | โœ… Yes - designed for this! | | **Updates** | ๐ŸŸก Manual URL maintenance | โœ… Automatic with Svelte releases | --- ## Current Implementation Issues ### What We're Scraping Now (4 pages): 1. routing 2. load 3. form-actions 4. hooks ### What's Missing: - Layouts - Pages - Server - Errors - Links - State management - Advanced routing - Configuration - Deployment - And ~50+ more topics! **Problem:** We only get 4 topics out of 50+ available. **Solution:** One file gives us EVERYTHING. --- ## Implementation Comparison ### Current Approach (Complex) ```javascript // Multiple steps: 1. Fetch HTML from 4 different URLs 2. Parse HTML with cheerio 3. Remove navigation elements 4. Convert HTML to Markdown with turndown 5. Clean up markdown 6. Add metadata 7. Save 4 separate files // Dependencies: - axios - cheerio - turndown // Fragility: - Breaks if HTML structure changes - Must maintain selector list - Different selectors per site ``` ### New Approach (Simple) ```javascript // Single step: 1. Download one text file 2. Save it // Dependencies: - axios (or fetch) // Fragility: - None - it's plain text - Maintained by Svelte team - Designed for this purpose ``` --- ## Proposed Implementation ### Option A: Single File Approach (Recommended) ```javascript async function updateSvelteDocs() { console.log('๐Ÿ“š Updating Svelte/SvelteKit documentation...'); const url = 'https://svelte.dev/llms-full.txt'; const outputPath = path.join(__dirname, '..', 'content', 'docs', 'svelte-full.txt'); try { const response = await axios.get(url); const content = `# Svelte and SvelteKit Documentation > Last updated: ${new Date().toISOString()} > Source: ${url} > Size: ${response.data.length} bytes ${response.data} --- *This documentation was automatically downloaded from Svelte's official LLM-optimized format.* `; await fs.writeFile(outputPath, content, 'utf-8'); console.log(`โœ… Updated: svelte-full.txt (${response.data.length} bytes)`); } catch (error) { console.error(`โŒ Failed to update: ${error.message}`); } } ``` ### Option B: Split by Section ```javascript async function updateSvelteDocs() { const response = await axios.get('https://svelte.dev/llms-full.txt'); const content = response.data; // Split into Svelte and SvelteKit sections const [sveltePart, svelteKitPart] = content.split('# Start of SvelteKit documentation'); // Save separately await fs.writeFile('content/docs/svelte.txt', sveltePart.trim()); await fs.writeFile('content/docs/sveltekit.txt', svelteKitPart.trim()); } ``` --- ## MCP Server Tool Updates ### Current Tools (Limited Scope) ```typescript tools: [ 'get_sveltekit_doc' // Only works for our 4 topics 'list_sveltekit_topics' // Only lists 4 topics ] ``` ### New Approach Options **Option 1: Single Comprehensive Tool** ```typescript { name: "get_svelte_docs", description: "Get complete Svelte and SvelteKit documentation (LLM-optimized)", inputSchema: { format: z.enum(['full', 'medium']).optional() } } ``` **Option 2: Search Within Docs** ```typescript { name: "search_svelte_docs", description: "Search Svelte/SvelteKit documentation for specific topics", inputSchema: { query: z.string(), section: z.enum(['svelte', 'sveltekit', 'both']).optional() } } ``` **Option 3: Keep Current + Add Full** ```typescript tools: [ 'get_sveltekit_doc', // Keep for backward compatibility 'get_svelte_full_docs', // NEW: Complete docs 'search_svelte_docs' // NEW: Search capability ] ``` --- ## Migration Strategy ### Phase 1: Add New Source (Non-Breaking) 1. Add `llms-full.txt` download to update script 2. Save as `content/docs/svelte-full.txt` 3. Keep existing 4-page scraping for compatibility 4. Add new tool `get_svelte_full_docs` ### Phase 2: Deprecate Old Approach 1. Update documentation to recommend new tool 2. Add deprecation notice to old tools 3. Monitor usage ### Phase 3: Remove Old Code 1. Remove web scraping for SvelteKit 2. Remove cheerio/turndown dependencies (if only for Svelte) 3. Simplify codebase --- ## Benefits Summary ### Developer Experience - โœ… Complete documentation access - โœ… LLM-optimized format - โœ… Faster updates (1 request vs 4) - โœ… More reliable (no HTML parsing) ### Maintenance - โœ… Zero selector maintenance - โœ… Automatic updates from Svelte - โœ… Simpler codebase - โœ… Fewer dependencies ### Performance - โœ… Single HTTP request - โœ… No HTML parsing overhead - โœ… Smaller codebase - โœ… Faster content updates ### Coverage - โœ… 100% of Svelte docs - โœ… 100% of SvelteKit docs - โœ… All examples included - โœ… Always up-to-date with releases --- ## What About Tailwind? ### Status: No LLM Files Available Checked these URLs: - โŒ `https://tailwindcss.com/llms.txt` - 404 - โŒ `https://tailwindcss.com/llms-full.txt` - 404 - โŒ `https://tailwindcss.com/docs.txt` - 404 **Recommendation for Tailwind:** - Keep current web scraping approach - Or consider GitHub repo (if user is comfortable) - Monitor for Tailwind to add LLM-optimized docs --- ## Immediate Action Items ### High Priority 1. โœ… Update `scripts/update-content.js` to use `llms-full.txt` 2. โœ… Test the new download process 3. โœ… Update MCP tools to serve the complete docs 4. โœ… Update documentation/README ### Medium Priority 1. Add search functionality for the full docs 2. Consider splitting Svelte vs SvelteKit sections 3. Add tool to get specific sections ### Low Priority 1. Remove old web scraping code for Svelte 2. Clean up unused dependencies 3. Monitor Tailwind for LLM docs --- ## Code Changes Required ### 1. Update update-content.js ```javascript // BEFORE: 4 separate page scrapes const CONTENT_SOURCES = { sveltekit: { baseUrl: 'https://svelte.dev/docs/kit', topics: [ { name: 'routing', url: '/routing' }, { name: 'load', url: '/load' }, // ... only 4 topics ] } }; // AFTER: Single file download const CONTENT_SOURCES = { svelte: { type: 'llm-optimized', url: 'https://svelte.dev/llms-full.txt', outputFile: 'svelte-full.txt' } }; ``` ### 2. Update MCP Server Tools ```typescript // Add new tool server.registerTool( "get_svelte_docs", { title: "Get Complete Svelte Documentation", description: "Get the complete Svelte and SvelteKit documentation in LLM-optimized format.", inputSchema: {} }, async (request) => { const filePath = path.join(CONFIG.contentBasePath, 'docs', 'svelte-full.txt'); const content = await fs.readFile(filePath, 'utf-8'); return { content: [{ type: "text" as const, text: content }] }; } ); ``` --- ## Risks & Mitigations ### Risk 1: File Format Changes **Likelihood:** Low **Impact:** Low **Mitigation:** Svelte team maintains this specifically for LLMs; unlikely to break ### Risk 2: File Size Growth **Likelihood:** Medium **Impact:** Low **Mitigation:** Currently 1MB, which is acceptable. Can switch to `llms-medium.txt` if needed ### Risk 3: Breaking Changes for Users **Likelihood:** Low **Impact:** Medium **Mitigation:** Add new tools alongside existing ones; deprecate gradually --- ## Recommendation ### Immediate: Switch to LLM Files โœ… **Why:** 1. **Official Support** - Svelte team maintains this format 2. **Complete Coverage** - Get all docs, not just 4 pages 3. **Simplicity** - No HTML parsing, no maintenance 4. **Reliability** - Stable text format won't break 5. **Performance** - One request vs four 6. **LLM Optimized** - Designed specifically for this use case! **How:** 1. Update `update-content.js` to download `llms-full.txt` 2. Save to `content/docs/svelte-full.txt` 3. Add new MCP tool `get_svelte_docs` 4. Keep Tailwind web scraping as-is **When:** ๐Ÿš€ **NOW** - This is a no-brainer improvement --- **Implementation Time:** ~30 minutes **Risk Level:** โœ… Very Low **Benefit Level:** ๐Ÿš€ Very High **Status:** โœ… **APPROVED - PROCEED WITH IMPLEMENTATION**

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/CaullenOmdahl/Tailwind-Svelte-Assistant'

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