@devries-cameron20 / composio-1 / commits / 81b2bc3b6
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(docs): improve llms.txt with structured sections

Follow industry best practices from Stripe, Vercel, Mintlify: - Organize pages into semantic sections (Getting Started, Auth, Providers, etc.) - Use .mdx extension in URLs for direct markdown access - Add descriptions after colons for each link - Include Tool Router, Examples, and API Reference sections Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 19, 2026 at 14:02 UTC 81b2bc3b61a26e33efbedee2e393cf524e9fd533
1 file changed +82 -6
docs/app/llms.txt/route.ts
+82 -6
@@ -1,22 +1,98 @@
1 -import { source } from '@/lib/source';
1 +import { source, toolRouterSource, referenceSource, examplesSource } from '@/lib/source';
2
3 export const revalidate = false;
4
5 export async function GET() {
6 try {
7 - const pages = source.getPages();
7 + const docsPages = source.getPages();
8 + const toolRouterPages = toolRouterSource.getPages();
9 + const referencePages = referenceSource.getPages();
10 + const examplesPages = examplesSource.getPages();
11 +
12 + // Group docs pages by directory
13 + const groupedDocs = new Map<string, typeof docsPages>();
14 +
15 + for (const page of docsPages) {
16 + const slugs = page.slugs;
17 + // Get category from first slug if nested, otherwise 'core'
18 + const category = slugs.length > 1 ? slugs[0] : 'core';
19 + if (!groupedDocs.has(category)) {
20 + groupedDocs.set(category, []);
21 + }
22 + groupedDocs.get(category)!.push(page);
23 + }
24 +
25 + // Format page as markdown link with .mdx extension
26 + // eslint-disable-next-line @typescript-eslint/no-explicit-any
27 + const formatPage = (page: any) =>
28 + `- [${page.data.title}](https://composio.dev${page.url}.mdx): ${page.data.description || ''}`;
29 +
30 + // Build sections
31 + const coreDocs = groupedDocs.get('core') || [];
32 + const providerDocs = groupedDocs.get('providers') || [];
33 + const modifierDocs = groupedDocs.get('modify-tool-behavior') || [];
34 + const troubleshootingDocs = groupedDocs.get('troubleshooting') || [];
35 + const migrationDocs = groupedDocs.get('migration-guide') || [];
36 + const nativeToolsDocs = groupedDocs.get('native-tools') || [];
37
38 const index = `# Composio Documentation
39
11 -> Composio is the simplest way to connect AI agents to external tools and services.
40 +> Composio is the simplest way to connect AI agents to external tools and services. Build AI agents with 250+ tools across GitHub, Slack, Gmail, and more.
41 +
42 +## Getting Started
43 +
44 +${coreDocs.filter(p => ['quickstart', 'index', 'authenticating-tools', 'executing-tools', 'fetching-tools'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
45 +
46 +## Authentication & Users
47 +
48 +${coreDocs.filter(p => ['connected-accounts', 'user-management', 'custom-auth-configs', 'programmatic-auth-configs', 'custom-auth-params'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
49 +
50 +## Tools & Execution
51 +
52 +${coreDocs.filter(p => ['custom-tools', 'toolkit-versioning', 'capabilities'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
53 +${nativeToolsDocs.length > 0 ? nativeToolsDocs.map(formatPage).join('\n') : ''}
54 +
55 +## MCP (Model Context Protocol)
56 +
57 +${coreDocs.filter(p => p.slugs.some(s => s.startsWith('mcp'))).map(formatPage).join('\n')}
58 +
59 +## Triggers
60 +
61 +${coreDocs.filter(p => ['using-triggers'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
62 +
63 +## Modify Tool Behavior
64 +
65 +${modifierDocs.map(formatPage).join('\n')}
66 +
67 +## Providers
68 +
69 +${providerDocs.map(formatPage).join('\n')}
70 +
71 +## Tool Router
72 +
73 +${toolRouterPages.map(formatPage).join('\n')}
74 +
75 +## Troubleshooting
76 +
77 +${troubleshootingDocs.map(formatPage).join('\n')}
78 +${coreDocs.filter(p => ['cli', 'debugging-info'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
79 +
80 +## Migration Guides
81 +
82 +${migrationDocs.map(formatPage).join('\n')}
83 +
84 +## API Reference
85 +
86 +${referencePages.slice(0, 20).map(formatPage).join('\n')}
87 +${referencePages.length > 20 ? `\n... and ${referencePages.length - 20} more API reference pages` : ''}
88
13 -## Docs
89 +## Examples
90
15 -${pages.map((page) => `- [${page.data.title}](https://composio.dev${page.url}): ${page.data.description || ''}`).join('\n')}
91 +${examplesPages.map(formatPage).join('\n')}
92
93 ## Full Documentation
94
19 -For the complete documentation in a single file, see: https://composio.dev/llms-full.txt
95 +- [llms-full.txt](https://composio.dev/llms-full.txt): Complete documentation in a single file for LLM context
96 `;
97
98 return new Response(index, {