Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(docs): Restructure llms.txt to match sidebar navigation
Rewrite llms.txt to follow the exact structure from meta.json: - Get Started (index, quickstart, providers) - Core Concepts (users-and-sessions, authentication, tools-and-toolkits) - Getting Started (configuring-sessions, authenticating-users, toolkits) - Guides (white-labeling, multiple accounts, custom auth) - Features (triggers, cli, mcp) - Direct Tool Execution Guides (tools-direct, auth-configuration) - Resources (debugging, migration, troubleshooting) - Examples, API Reference, Toolkits Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 28, 2026 at 00:00 UTC
02fc070072f94e6586f37534abc300dbf8ba0004
1 file changed
+58
-46
docs/app/llms.txt/route.ts
+58
-46
@@ -9,85 +9,97 @@ export async function GET() {
9
const referencePages = referenceSource.getPages();
10
const toolkitsPages = toolkitsSource.getPages();
11
12
- // Group docs pages by directory
13
- const groupedDocs = new Map<string, typeof docsPages>();
14
-
12
+ // Create a map for quick lookup by slug path
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ const pageMap = new Map<string, any>();
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);
16
+ pageMap.set(page.slugs.join('/'), page);
17
}
18
25
- // Format page as simple URL (like Cursor's llms.txt)
19
+ // Format page as simple URL
20
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21
const formatPage = (page: any) =>
22
`- https://docs.composio.dev${page.url}.md`;
23
30
- // Build sections based on actual folder structure
31
- const coreDocs = groupedDocs.get('core') || [];
32
- const providerDocs = groupedDocs.get('providers') || [];
33
- const toolsDirectDocs = groupedDocs.get('tools-direct') || [];
34
- const authConfigDocs = groupedDocs.get('auth-configuration') || [];
35
- const authenticatingUsersDocs = groupedDocs.get('authenticating-users') || [];
36
- const toolkitsDocs = groupedDocs.get('toolkits') || [];
37
- const troubleshootingDocs = groupedDocs.get('troubleshooting') || [];
38
- const migrationDocs = groupedDocs.get('migration-guide') || [];
39
-
24
+ // Get page by slug path, return empty string if not found
25
+ const getPage = (slugPath: string) => {
26
+ const page = pageMap.get(slugPath);
27
+ return page ? formatPage(page) : '';
28
+ };
29
+
30
+ // Get all pages in a folder
31
+ const getFolderPages = (folder: string) => {
32
+ return docsPages
33
+ .filter(p => p.slugs[0] === folder)
34
+ .map(formatPage)
35
+ .join('\n');
36
+ };
37
+
38
+ // Build the index following the exact sidebar structure from meta.json
39
const index = `# Composio Documentation
40
41
> Composio is the simplest way to connect AI agents to external tools and services. Build AI agents with 800+ tools across GitHub, Slack, Gmail, and more.
42
44
-## Getting Started
43
+## Get Started
44
+
45
+${getPage('index')}
46
+${getPage('quickstart')}
47
46
-${coreDocs.filter(p => ['quickstart', 'index'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
47
-${toolsDirectDocs.filter(p => ['authenticating-tools', 'executing-tools', 'fetching-tools'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
48
+### Providers
49
+
50
+${getFolderPages('providers')}
51
52
## Core Concepts
53
51
-${coreDocs.filter(p => ['tools-and-toolkits', 'authentication', 'users-and-sessions', 'configuring-sessions'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
54
+${getPage('users-and-sessions')}
55
+${getPage('authentication')}
56
+${getPage('tools-and-toolkits')}
57
+
58
+## Getting Started
59
+
60
+${getPage('configuring-sessions')}
61
+
62
+### Authenticating Users
63
53
-## Authentication & Users
64
+${getFolderPages('authenticating-users')}
65
55
-${authenticatingUsersDocs.map(formatPage).join('\n')}
56
-${coreDocs.filter(p => ['managing-multiple-connected-accounts', 'using-custom-auth-configuration', 'white-labeling-authentication'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
66
+### Toolkits
67
58
-## Auth Configuration
68
+${getFolderPages('toolkits')}
69
60
-${authConfigDocs.map(formatPage).join('\n')}
70
+## Guides
71
62
-## Tools & Execution
72
+${getPage('white-labeling-authentication')}
73
+${getPage('managing-multiple-connected-accounts')}
74
+${getPage('using-custom-auth-configuration')}
75
64
-${toolsDirectDocs.filter(p => ['custom-tools', 'toolkit-versioning'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
65
-${toolkitsDocs.map(formatPage).join('\n')}
76
+## Features
77
67
-## Modify Tool Behavior
78
+${getPage('triggers')}
79
+${getPage('cli')}
80
+${getPage('single-toolkit-mcp')}
81
69
-${toolsDirectDocs.filter(p => p.slugs.includes('modify-tool-behavior')).map(formatPage).join('\n')}
82
+## Direct Tool Execution Guides
83
71
-## MCP (Model Context Protocol)
84
+### Tools
85
73
-${coreDocs.filter(p => ['single-toolkit-mcp'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
86
+${getFolderPages('tools-direct')}
87
75
-## Triggers
88
+### Auth Configuration
89
77
-${coreDocs.filter(p => ['triggers'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
90
+${getFolderPages('auth-configuration')}
91
79
-## Providers
92
+## Resources
93
81
-${providerDocs.map(formatPage).join('\n')}
94
+${getPage('debugging-info')}
95
83
-## Troubleshooting
96
+### Migration Guide
97
85
-${troubleshootingDocs.map(formatPage).join('\n')}
86
-${coreDocs.filter(p => ['cli', 'debugging-info'].some(s => p.slugs.includes(s))).map(formatPage).join('\n')}
98
+${getFolderPages('migration-guide')}
99
88
-## Migration Guides
100
+### Troubleshooting
101
90
-${migrationDocs.map(formatPage).join('\n')}
102
+${getFolderPages('troubleshooting')}
103
104
## Examples
105