Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Fix llms.txt routes - add error handling for getText failures
Sushmithamalleshf3bbbdf44f63
diff --git a/fumadocs/app/llms-full.txt/route.ts b/fumadocs/app/llms-full.txt/route.tsindex d494d2cbb..65655e37d 100644--- a/fumadocs/app/llms-full.txt/route.ts+++ b/fumadocs/app/llms-full.txt/route.ts@@ -1,10 +1,24 @@-import { getLLMText, source } from '@/lib/source';+import { source } from '@/lib/source';export const revalidate = false;export async function GET() {- const scan = source.getPages().map(getLLMText);- const scanned = await Promise.all(scan);+ const pages = source.getPages();+ const results: string[] = [];- return new Response(scanned.join('\n\n'));+ for (const page of pages) {+ try {+ const processed = await page.data.getText('processed');+ results.push(`# ${page.data.title}\n\n${processed}`);+ } catch {+ // Fallback to basic info if getText fails+ results.push(`# ${page.data.title}\n\n${page.data.description || ''}`);+ }+ }++ return new Response(results.join('\n\n'), {+ headers: {+ 'Content-Type': 'text/plain; charset=utf-8',+ },+ });}diff --git a/fumadocs/app/llms.txt/route.ts b/fumadocs/app/llms.txt/route.tsindex 625617381..2dcb4383e 100644--- a/fumadocs/app/llms.txt/route.ts+++ b/fumadocs/app/llms.txt/route.ts@@ -3,9 +3,10 @@ import { source } from '@/lib/source';export const revalidate = false;export async function GET() {- const pages = source.getPages();+ try {+ const pages = source.getPages();- const index = `# Composio Documentation+ const index = `# Composio Documentation> Composio is the simplest way to connect AI agents to external tools and services.@@ -18,9 +19,13 @@ ${pages.map((page) => `- [${page.data.title}](https://composio.dev${page.url}):For the complete documentation in a single file, see: https://composio.dev/llms-full.txt`;- return new Response(index, {- headers: {- 'Content-Type': 'text/plain; charset=utf-8',- },- });+ return new Response(index, {+ headers: {+ 'Content-Type': 'text/plain; charset=utf-8',+ },+ });+ } catch (error) {+ console.error('Error generating llms.txt:', error);+ return new Response('Error generating documentation index', { status: 500 });+ }}