Skip to content

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 all sections

Sushmithamallesh9b076b0ec834
diff --git a/docs/app/(home)/reference/[[...slug]]/page.tsx b/docs/app/(home)/reference/[[...slug]]/page.tsx
index 06e3c9767..053c3cb61 100644
--- a/docs/app/(home)/reference/[[...slug]]/page.tsx
+++ b/docs/app/(home)/reference/[[...slug]]/page.tsx
@@ -12,6 +12,7 @@ import { getMDXComponents } from '@/mdx-components';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import type { ApiPageProps } from 'fumadocs-openapi/ui';
+import { PageActions } from '@/components/page-actions';
interface OpenAPIPageData {
title: string;
@@ -49,7 +50,8 @@ export default async function Page({
return (
<DocsPage toc={mdxData.toc} full={mdxData.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
<DocsTitle>{mdxData.title}</DocsTitle>
- <DocsDescription>{mdxData.description}</DocsDescription>
+ <DocsDescription className="mb-2">{mdxData.description}</DocsDescription>
+ <PageActions path={page.url} />
<DocsBody>
<MDX
components={getMDXComponents({
diff --git a/docs/app/llms.mdx/examples/[[...slug]]/route.ts b/docs/app/llms.mdx/examples/[[...slug]]/route.ts
new file mode 100644
index 000000000..24fd699eb
--- /dev/null
+++ b/docs/app/llms.mdx/examples/[[...slug]]/route.ts
@@ -0,0 +1,24 @@
+import { examplesSource } from '@/lib/source';
+import { getLLMText } from '@/lib/source';
+import { notFound } from 'next/navigation';
+
+export const revalidate = false;
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug?: string[] }> }
+) {
+ const { slug } = await params;
+ const page = examplesSource.getPage(slug);
+ if (!page) notFound();
+
+ return new Response(await getLLMText(page), {
+ headers: {
+ 'Content-Type': 'text/markdown; charset=utf-8',
+ },
+ });
+}
+
+export function generateStaticParams() {
+ return examplesSource.generateParams();
+}
diff --git a/docs/app/llms.mdx/reference/[[...slug]]/route.ts b/docs/app/llms.mdx/reference/[[...slug]]/route.ts
new file mode 100644
index 000000000..bc3f499da
--- /dev/null
+++ b/docs/app/llms.mdx/reference/[[...slug]]/route.ts
@@ -0,0 +1,24 @@
+import { referenceSource } from '@/lib/source';
+import { getLLMText } from '@/lib/source';
+import { notFound } from 'next/navigation';
+
+export const revalidate = false;
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug?: string[] }> }
+) {
+ const { slug } = await params;
+ const page = referenceSource.getPage(slug);
+ if (!page) notFound();
+
+ return new Response(await getLLMText(page), {
+ headers: {
+ 'Content-Type': 'text/markdown; charset=utf-8',
+ },
+ });
+}
+
+export function generateStaticParams() {
+ return referenceSource.generateParams();
+}
diff --git a/docs/app/llms.mdx/tool-router/[[...slug]]/route.ts b/docs/app/llms.mdx/tool-router/[[...slug]]/route.ts
new file mode 100644
index 000000000..fb933fbe6
--- /dev/null
+++ b/docs/app/llms.mdx/tool-router/[[...slug]]/route.ts
@@ -0,0 +1,24 @@
+import { toolRouterSource } from '@/lib/source';
+import { getLLMText } from '@/lib/source';
+import { notFound } from 'next/navigation';
+
+export const revalidate = false;
+
+export async function GET(
+ _req: Request,
+ { params }: { params: Promise<{ slug?: string[] }> }
+) {
+ const { slug } = await params;
+ const page = toolRouterSource.getPage(slug);
+ if (!page) notFound();
+
+ return new Response(await getLLMText(page), {
+ headers: {
+ 'Content-Type': 'text/markdown; charset=utf-8',
+ },
+ });
+}
+
+export function generateStaticParams() {
+ return toolRouterSource.generateParams();
+}
diff --git a/docs/lib/create-docs-page.tsx b/docs/lib/create-docs-page.tsx
index a0836742a..c6a385978 100644
--- a/docs/lib/create-docs-page.tsx
+++ b/docs/lib/create-docs-page.tsx
@@ -8,6 +8,7 @@ import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/mdx-components';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
+import { PageActions } from '@/components/page-actions';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Source = any;
@@ -23,7 +24,8 @@ export function createDocsPage(source: Source) {
return (
<DocsPage toc={page.data.toc} full={page.data.full} footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
<DocsTitle>{page.data.title}</DocsTitle>
- <DocsDescription>{page.data.description}</DocsDescription>
+ <DocsDescription className="mb-2">{page.data.description}</DocsDescription>
+ <PageActions path={page.url} />
<DocsBody>
<MDX
components={getMDXComponents({
diff --git a/docs/next.config.mjs b/docs/next.config.mjs
index 6081edc05..9c7f5441a 100644
--- a/docs/next.config.mjs
+++ b/docs/next.config.mjs
@@ -13,15 +13,27 @@ const config = {
},
async rewrites() {
return [
- // Support both .md and .mdx extensions for AI agents
- {
- source: '/docs/:path*.mdx',
- destination: '/llms.mdx/docs/:path*',
- },
- {
- source: '/docs/:path*.md',
- destination: '/llms.mdx/docs/:path*',
- },
+ // Support .md and .mdx extensions for AI agents across all sections
+ // Docs
+ { source: '/docs/:path*.mdx', destination: '/llms.mdx/docs/:path*' },
+ { source: '/docs/:path*.md', destination: '/llms.mdx/docs/:path*' },
+ { source: '/docs.md', destination: '/llms.mdx/docs' },
+ { source: '/docs.mdx', destination: '/llms.mdx/docs' },
+ // Tool Router
+ { source: '/tool-router/:path*.mdx', destination: '/llms.mdx/tool-router/:path*' },
+ { source: '/tool-router/:path*.md', destination: '/llms.mdx/tool-router/:path*' },
+ { source: '/tool-router.md', destination: '/llms.mdx/tool-router' },
+ { source: '/tool-router.mdx', destination: '/llms.mdx/tool-router' },
+ // Examples
+ { source: '/examples/:path*.mdx', destination: '/llms.mdx/examples/:path*' },
+ { source: '/examples/:path*.md', destination: '/llms.mdx/examples/:path*' },
+ { source: '/examples.md', destination: '/llms.mdx/examples' },
+ { source: '/examples.mdx', destination: '/llms.mdx/examples' },
+ // Reference
+ { source: '/reference/:path*.mdx', destination: '/llms.mdx/reference/:path*' },
+ { source: '/reference/:path*.md', destination: '/llms.mdx/reference/:path*' },
+ { source: '/reference.md', destination: '/llms.mdx/reference' },
+ { source: '/reference.mdx', destination: '/llms.mdx/reference' },
];
},
async redirects() {