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(fumadocs): add Twoslash fixes for examples and exclude reference docs
Sushmithamallesh8a7f822709a2
diff --git a/fumadocs/content/changelog/01-12-26-tool-router-improvements.mdx b/fumadocs/content/changelog/01-12-26-tool-router-improvements.mdxindex f131ad182..d1fbc6610 100644--- a/fumadocs/content/changelog/01-12-26-tool-router-improvements.mdx+++ b/fumadocs/content/changelog/01-12-26-tool-router-improvements.mdx@@ -21,6 +21,10 @@ Added `waitForConnections` (TypeScript) / `wait_for_connections` (Python) proper**TypeScript:**```typescript+import { Composio } from '@composio/core';+const composio = new Composio({ apiKey: 'your-api-key' });+const userId = 'user_123';+// ---cut---const session = await composio.toolRouter.create(userId, {manageConnections: {enable: true,@@ -48,6 +52,10 @@ Introduced new modifier types for better session-based tool execution: `SessionE**TypeScript:**```typescript+import { Composio } from '@composio/core';+const composio = new Composio({ apiKey: 'your-api-key' });+const session = await composio.toolRouter.create('user_123', { manageConnections: { enable: true } });+// ---cut---const tools = await session.tools({modifySchema: ({ toolSlug, toolkitSlug, schema }) => schema,beforeExecute: ({ toolSlug, toolkitSlug, sessionId, params }) => params,@@ -76,6 +84,9 @@ Added `getRawToolRouterMetaTools` (TypeScript) / `get_raw_tool_router_meta_tools**TypeScript:**```typescript+import { Composio } from '@composio/core';+const composio = new Composio({ apiKey: 'your-api-key' });+// ---cut---const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123', {modifySchema: ({ toolSlug, toolkitSlug, schema }) => {// Customize schemadiff --git a/fumadocs/content/changelog/12-30-25.mdx b/fumadocs/content/changelog/12-30-25.mdxindex fd8ae7365..1fb891431 100644--- a/fumadocs/content/changelog/12-30-25.mdx+++ b/fumadocs/content/changelog/12-30-25.mdx@@ -88,6 +88,7 @@ message_text = payload["data"]["message_text"]``````typescript+// @noErrors// Before (V2)const triggerSlug = payload.type; // "gmail_new_gmail_message"const connectionId = payload.data.connection_id;diff --git a/fumadocs/content/examples/hono.mdx b/fumadocs/content/examples/hono.mdxindex c327ff2b3..344b67a54 100644--- a/fumadocs/content/examples/hono.mdx+++ b/fumadocs/content/examples/hono.mdx@@ -108,6 +108,9 @@ export async function createAuthConfig(composioClient: Composio<OpenAIProvider>)This will create a Gmail authentication config to authenticate your app's users. Ideally, create one authentication object per project, so check for an existing auth config before creating a new one.```typescript+import { Composio } from '@composio/core';+import { OpenAIProvider } from '@composio/openai';+// ---cut---export async function fetchAuthConfig(composioClient: Composio<OpenAIProvider>) {/*** Fetch the auth config for a given user id.@@ -134,7 +137,13 @@ Once you have authentication management in place, we can start with connecting y```typescriptimport { Hono } from 'hono';+import { Composio } from '@composio/core';+import { OpenAIProvider } from '@composio/openai';+declare function fetchAuthConfig(client: Composio<OpenAIProvider>): Promise<{ id: string } | null>;+declare function createAuthConfig(client: Composio<OpenAIProvider>): Promise<{ id: string }>;+declare const composioClient: Composio<OpenAIProvider>;+// ---cut---// Function to initiate a connected accountexport async function createConnection(composioClient: Composio<OpenAIProvider>, userId: string) {/**@@ -213,6 +222,16 @@ Check [config/composio.ts](./src/config/composio.ts) module for more details.When invoking an agent, make sure you validate the `user_id`.```typescript+import { Composio } from '@composio/core';+import { OpenAIProvider } from '@composio/openai';+import { OpenAI } from 'openai';+import { Hono } from 'hono';++const app = new Hono();+declare const composioClient: Composio<OpenAIProvider>;+declare const openaiClient: OpenAI;+declare function runGmailAgent(c: Composio<OpenAIProvider>, o: OpenAI, u: string, p: string): Promise<any[]>;+// ---cut---export function checkConnectedAccountExists(composioClient: Composio<OpenAIProvider>,userId: string,@@ -236,7 +255,7 @@ export function checkConnectedAccountExists(});}-export async function validateUserId(userId: string, composioClient: ComposioClient): Promise<string> {+export async function validateUserId(userId: string, composioClient: Composio<OpenAIProvider>): Promise<string> {/*** Validate the user id, if no connected account is found, create a new connection.*/diff --git a/fumadocs/content/examples/vercel-chat.mdx b/fumadocs/content/examples/vercel-chat.mdxindex a7c7a67b1..f3b1bd51f 100644--- a/fumadocs/content/examples/vercel-chat.mdx+++ b/fumadocs/content/examples/vercel-chat.mdx@@ -71,6 +71,7 @@ First, we fetch all connected accounts for a user and create a mapping of toolkislugs to their connection IDs:```typescript app/api/composio/toolkits.ts+// @noErrorsexport async function GET() {// ... auth logic ...@@ -93,6 +94,7 @@ export async function GET() {Next, we fetch toolkit information for each supported toolkit and combine it with the connection status:```typescript app/api/composio/toolkits.ts+// @noErrorsexport async function GET() {// ... auth logic ...// ... connected accounts mapping ...@@ -133,6 +135,7 @@ When a user wants to connect their account, we create a connection request that```typescript app/api/connections/initiate/route.ts+// @noErrorsexport async function POST(request: Request) {// ... auth and validation ...@@ -160,6 +163,7 @@ After initiating a connection, we need to wait for the OAuth flow to complete. W```typescript app/api/connections/status/route.ts+// @noErrorsexport async function GET(request: Request) {// ... auth and validation ...@@ -182,6 +186,7 @@ export async function GET(request: Request) {When a user wants to disconnect their account, we remove the connection using the connection ID:```typescript app/api/connections/delete/route.ts+// @noErrorsexport async function DELETE(request: Request) {// ... auth and validation ...@@ -206,6 +211,7 @@ Once users have connected their accounts, we need to track which toolkits are enWe keep track of which toolkits the user has enabled in the chat interface:```typescript components/chat.tsx+// @noErrorsconst { ... } = useChat({// ... other config ...experimental_prepareRequestBody: (body) => {@@ -229,6 +235,7 @@ const { ... } = useChat({We fetch Composio tools based on the enabled toolkit slugs:```typescript lib/ai/tools/composio.ts+// @noErrorsexport async function getComposioTools(userId: string, toolkitSlugs: string[]) {// ... validation ...@@ -240,6 +247,7 @@ export async function getComposioTools(userId: string, toolkitSlugs: string[]) {``````typescript app/api/chat.ts+// @noErrorsexport async function POST(request: Request) {// ... auth and parsing ...@@ -267,6 +275,7 @@ By default, tool calls appear as raw JSON in the chat interface. To create a betYou can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:```typescript components/messages.tsx+// @noErrorsif (type === 'tool-invocation') {const { toolInvocation } = part;const { toolName, toolCallId, state, args, result } = toolInvocation;diff --git a/fumadocs/source.config.ts b/fumadocs/source.config.tsindex ebb0218b2..08ee9abb0 100644--- a/fumadocs/source.config.ts+++ b/fumadocs/source.config.ts@@ -4,6 +4,7 @@ import {defineCollections,frontmatterSchema,metaSchema,+ applyMdxPreset,} from 'fumadocs-mdx/config';import { transformerTwoslash } from '@shikijs/twoslash';import { z } from 'zod';@@ -39,10 +40,21 @@ export const toolRouter = defineDocs({},});+// Reference docs use defineCollections with custom mdxOptions to exclude twoslash+// (SDK reference docs are auto-generated and don't need type checking)export const reference = defineDocs({dir: 'content/reference',docs: {schema: docsSchema,+ mdxOptions: applyMdxPreset({+ rehypeCodeOptions: {+ themes: {+ light: 'github-light',+ dark: 'github-dark',+ },+ // No twoslash transformer - SDK reference docs skip type checking+ },+ }),},meta: {schema: metaSchema,