@devries-cameron20 / composio-1 / commits / f3bbbdf44
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.

Fix llms.txt routes - add error handling for getText failures

Sushmithamallesh committed Jan 4, 2026 at 23:58 UTC f3bbbdf44f63fc239fbbd5b1b523d29c7dd9a7bd
2 files changed +30 -11
fumadocs/app/llms-full.txt/route.ts
+18 -4
@@ -1,10 +1,24 @@
1 -import { getLLMText, source } from '@/lib/source';
1 +import { source } from '@/lib/source';
2
3 export const revalidate = false;
4
5 export async function GET() {
6 - const scan = source.getPages().map(getLLMText);
7 - const scanned = await Promise.all(scan);
6 + const pages = source.getPages();
7 + const results: string[] = [];
8
9 - return new Response(scanned.join('\n\n'));
9 + for (const page of pages) {
10 + try {
11 + const processed = await page.data.getText('processed');
12 + results.push(`# ${page.data.title}\n\n${processed}`);
13 + } catch {
14 + // Fallback to basic info if getText fails
15 + results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);
16 + }
17 + }
18 +
19 + return new Response(results.join('\n\n'), {
20 + headers: {
21 + 'Content-Type': 'text/plain; charset=utf-8',
22 + },
23 + });
24 }
fumadocs/app/llms.txt/route.ts
+12 -7
@@ -3,9 +3,10 @@ import { source } from '@/lib/source';
3 export const revalidate = false;
4
5 export async function GET() {
6 - const pages = source.getPages();
6 + try {
7 + const pages = source.getPages();
8
8 - const index = `# Composio Documentation
9 + const index = `# Composio Documentation
10
11 > Composio is the simplest way to connect AI agents to external tools and services.
12
@@ -18,9 +19,13 @@ ${pages.map((page) => `- [${page.data.title}](https://composio.dev${page.url}):
19 For the complete documentation in a single file, see: https://composio.dev/llms-full.txt
20 `;
21
21 - return new Response(index, {
22 - headers: {
23 - 'Content-Type': 'text/plain; charset=utf-8',
24 - },
25 - });
22 + return new Response(index, {
23 + headers: {
24 + 'Content-Type': 'text/plain; charset=utf-8',
25 + },
26 + });
27 + } catch (error) {
28 + console.error('Error generating llms.txt:', error);
29 + return new Response('Error generating documentation index', { status: 500 });
30 + }
31 }