@devries-cameron20 / composio-1 / commits / 6a527e08e
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): add PageActions and .md support to toolkit pages

- Add Copy page and Share feedback to toolkit pages - Generate markdown on-the-fly for JSON toolkit pages - MDX toolkit pages use standard getLLMText Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 19, 2026 at 15:30 UTC 6a527e08e122881ac1bc70273b42308c6331a108
2 files changed +85 -20
docs/app/(home)/toolkits/[[...slug]]/page.tsx
+10 -5
@@ -3,6 +3,7 @@ import { notFound } from 'next/navigation';
3 import { getMDXComponents } from '@/mdx-components';
4 import { ToolkitDetail } from '@/components/toolkits/toolkit-detail';
5 import { ToolkitsLanding } from '@/components/toolkits/toolkits-landing';
6 +import { PageActions } from '@/components/page-actions';
7 import { readFile } from 'fs/promises';
8 import { join } from 'path';
9 import type { Metadata } from 'next';
@@ -101,6 +102,7 @@ export default async function ToolkitsPage({ params }: { params: Promise<{ slug?
102 const MDXContent = page.data.body;
103 return (
104 <article className="prose prose-fd max-w-none">
105 + <PageActions path={page.url} />
106 <MDXContent components={getMDXComponents()} />
107 </article>
108 );
@@ -114,11 +116,14 @@ export default async function ToolkitsPage({ params }: { params: Promise<{ slug?
116
117 if (toolkit) {
118 return (
117 - <ToolkitDetail
118 - toolkit={toolkit}
119 - tools={toolkit.tools}
120 - triggers={toolkit.triggers}
121 - />
119 + <>
120 + <PageActions path={`/toolkits/${toolkit.slug}`} />
121 + <ToolkitDetail
122 + toolkit={toolkit}
123 + tools={toolkit.tools}
124 + triggers={toolkit.triggers}
125 + />
126 + </>
127 );
128 }
129 }
docs/app/llms.mdx/[[...slug]]/route.ts
+75 -15
@@ -3,9 +3,13 @@ import {
3 toolRouterSource,
4 referenceSource,
5 examplesSource,
6 + toolkitsSource,
7 getLLMText,
8 } from '@/lib/source';
9 import { notFound } from 'next/navigation';
10 +import { readFile } from 'fs/promises';
11 +import { join } from 'path';
12 +import type { Toolkit } from '@/types/toolkit';
13
14 export const revalidate = false;
15
@@ -15,8 +19,50 @@ const sources = [
19 { prefix: 'tool-router', source: toolRouterSource },
20 { prefix: 'reference', source: referenceSource },
21 { prefix: 'examples', source: examplesSource },
22 + { prefix: 'toolkits', source: toolkitsSource },
23 ];
24
25 +// Generate markdown from toolkit JSON data
26 +function toolkitToMarkdown(toolkit: Toolkit): string {
27 + const lines: string[] = [
28 + `# ${toolkit.name.trim()}`,
29 + '',
30 + toolkit.description,
31 + '',
32 + `- **Category:** ${toolkit.category || 'Uncategorized'}`,
33 + `- **Auth:** ${toolkit.authSchemes.join(', ') || 'None'}`,
34 + `- **Tools:** ${toolkit.toolCount}`,
35 + `- **Triggers:** ${toolkit.triggerCount}`,
36 + ];
37 +
38 + if (toolkit.tools.length > 0) {
39 + lines.push('', '## Tools', '');
40 + for (const tool of toolkit.tools) {
41 + lines.push(`### ${tool.name}`, '', tool.description, '');
42 + }
43 + }
44 +
45 + if (toolkit.triggers.length > 0) {
46 + lines.push('', '## Triggers', '');
47 + for (const trigger of toolkit.triggers) {
48 + lines.push(`### ${trigger.name}`, '', trigger.description, '');
49 + }
50 + }
51 +
52 + return lines.join('\n');
53 +}
54 +
55 +async function getToolkit(slug: string): Promise<Toolkit | null> {
56 + try {
57 + const filePath = join(process.cwd(), 'public/data/toolkits.json');
58 + const data = await readFile(filePath, 'utf-8');
59 + const toolkits = JSON.parse(data) as Toolkit[];
60 + return toolkits.find((t) => t.slug === slug) || null;
61 + } catch {
62 + return null;
63 + }
64 +}
65 +
66 export async function GET(
67 _req: Request,
68 { params }: { params: Promise<{ slug?: string[] }> }
@@ -28,25 +74,39 @@ export async function GET(
74 const match = sources.find((s) => s.prefix === prefix);
75 if (!match) notFound();
76
31 - // Get the page from that source
77 + // Get the page from that source (MDX pages)
78 const page = match.source.getPage(rest.length > 0 ? rest : undefined);
33 - if (!page) notFound();
79
35 - try {
36 - return new Response(await getLLMText(page), {
37 - headers: {
38 - 'Content-Type': 'text/markdown; charset=utf-8',
39 - },
40 - });
41 - } catch {
42 - // Graceful fallback
43 - return new Response(
44 - `# ${page.data.title} (${page.url})\n\n${page.data.description || ''}`,
45 - {
80 + if (page) {
81 + try {
82 + return new Response(await getLLMText(page), {
83 + headers: {
84 + 'Content-Type': 'text/markdown; charset=utf-8',
85 + },
86 + });
87 + } catch {
88 + return new Response(
89 + `# ${page.data.title} (${page.url})\n\n${page.data.description || ''}`,
90 + {
91 + headers: {
92 + 'Content-Type': 'text/markdown; charset=utf-8',
93 + },
94 + }
95 + );
96 + }
97 + }
98 +
99 + // Special handling for JSON toolkit pages
100 + if (prefix === 'toolkits' && rest.length === 1) {
101 + const toolkit = await getToolkit(rest[0]);
102 + if (toolkit) {
103 + return new Response(toolkitToMarkdown(toolkit), {
104 headers: {
105 'Content-Type': 'text/markdown; charset=utf-8',
106 },
49 - }
50 - );
107 + });
108 + }
109 }
110 +
111 + notFound();
112 }