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: add dynamic toolkit pages to search index
Sushmithamallesh60f3b52cc331
diff --git a/docs/app/api/search/route.ts b/docs/app/api/search/route.tsindex deb44ee8e..12cbf4ea9 100644--- a/docs/app/api/search/route.ts+++ b/docs/app/api/search/route.ts@@ -3,6 +3,7 @@ import { docs, cookbooks, toolkits } from 'fumadocs-mdx:collections/server';import { createSearchAPI } from 'fumadocs-core/search/server';import { loader } from 'fumadocs-core/source';import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';+import { getAllToolkitsSync } from '@/lib/toolkit-data';// Create loaders directly here to avoid the problematic lib/source.ts importconst docsSource = loader({@@ -23,19 +24,36 @@ const toolkitsSource = loader({plugins: [lucideIconsPlugin()],});-const allPages = [+// MDX pages from Fumadocs sources+const mdxIndexes = [...docsSource.getPages(),...cookbooksSource.getPages(),...toolkitsSource.getPages(),-];+].map((page) => ({+ id: page.url,+ title: page.data.title ?? 'Untitled',+ description: page.data.description,+ url: page.url,+ structuredData: page.data.structuredData,+ keywords: 'keywords' in page.data ? page.data.keywords : undefined,+}));++// Dynamic toolkit pages from toolkits.json+const mdxToolkitSlugs = new Set(+ toolkitsSource.getPages().map((page) => page.slugs.join('/')),+);++const dynamicToolkitIndexes = getAllToolkitsSync()+ .filter((toolkit) => !mdxToolkitSlugs.has(toolkit.slug))+ .map((toolkit) => ({+ id: `/toolkits/${toolkit.slug}`,+ title: toolkit.name,+ description: toolkit.description,+ url: `/toolkits/${toolkit.slug}`,+ structuredData: { headings: [], contents: [] },+ keywords: [toolkit.slug, toolkit.category].filter(Boolean) as string[],+ }));export const { GET } = createSearchAPI('advanced', {- indexes: allPages.map((page) => ({- id: page.url,- title: page.data.title ?? 'Untitled',- description: page.data.description,- url: page.url,- structuredData: page.data.structuredData,- keywords: 'keywords' in page.data ? page.data.keywords : undefined,- })),+ indexes: [...mdxIndexes, ...dynamicToolkitIndexes],});