@devries-cameron20 / composio Mirror · read-only / commits / 8a7f82270
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 15:45 UTC

fix(fumadocs): add Twoslash fixes for examples and exclude reference docs

- Exclude /reference/ docs from Twoslash validation via collection-level mdxOptions - Fix hono.mdx with proper imports and declares for type checking - Fix vercel-chat.mdx with @noErrors for partial code snippets - Add @noErrors to changelog code blocks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 13, 2026 at 15:37 UTC 8a7f822709a2858f49a8da70f99ea1a3b8db7032
5 files changed +53 -1
fumadocs/content/changelog/01-12-26-tool-router-improvements.mdx
+11
@@ -21,6 +21,10 @@ Added `waitForConnections` (TypeScript) / `wait_for_connections` (Python) proper
21
22 **TypeScript:**
23 ```typescript
24 +import { Composio } from '@composio/core';
25 +const composio = new Composio({ apiKey: 'your-api-key' });
26 +const userId = 'user_123';
27 +// ---cut---
28 const session = await composio.toolRouter.create(userId, {
29 manageConnections: {
30 enable: true,
@@ -48,6 +52,10 @@ Introduced new modifier types for better session-based tool execution: `SessionE
52
53 **TypeScript:**
54 ```typescript
55 +import { Composio } from '@composio/core';
56 +const composio = new Composio({ apiKey: 'your-api-key' });
57 +const session = await composio.toolRouter.create('user_123', { manageConnections: { enable: true } });
58 +// ---cut---
59 const tools = await session.tools({
60 modifySchema: ({ toolSlug, toolkitSlug, schema }) => schema,
61 beforeExecute: ({ toolSlug, toolkitSlug, sessionId, params }) => params,
@@ -76,6 +84,9 @@ Added `getRawToolRouterMetaTools` (TypeScript) / `get_raw_tool_router_meta_tools
84
85 **TypeScript:**
86 ```typescript
87 +import { Composio } from '@composio/core';
88 +const composio = new Composio({ apiKey: 'your-api-key' });
89 +// ---cut---
90 const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123', {
91 modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
92 // Customize schema
fumadocs/content/changelog/12-30-25.mdx
+1
@@ -88,6 +88,7 @@ message_text = payload["data"]["message_text"]
88 ```
89
90 ```typescript
91 +// @noErrors
92 // Before (V2)
93 const triggerSlug = payload.type; // "gmail_new_gmail_message"
94 const connectionId = payload.data.connection_id;
fumadocs/content/examples/hono.mdx
+20 -1
@@ -108,6 +108,9 @@ export async function createAuthConfig(composioClient: Composio<OpenAIProvider>)
108 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.
109
110 ```typescript
111 +import { Composio } from '@composio/core';
112 +import { OpenAIProvider } from '@composio/openai';
113 +// ---cut---
114 export async function fetchAuthConfig(composioClient: Composio<OpenAIProvider>) {
115 /**
116 * 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
137
138 ```typescript
139 import { Hono } from 'hono';
140 +import { Composio } from '@composio/core';
141 +import { OpenAIProvider } from '@composio/openai';
142
143 +declare function fetchAuthConfig(client: Composio<OpenAIProvider>): Promise<{ id: string } | null>;
144 +declare function createAuthConfig(client: Composio<OpenAIProvider>): Promise<{ id: string }>;
145 +declare const composioClient: Composio<OpenAIProvider>;
146 +// ---cut---
147 // Function to initiate a connected account
148 export async function createConnection(composioClient: Composio<OpenAIProvider>, userId: string) {
149 /**
@@ -213,6 +222,16 @@ Check [config/composio.ts](./src/config/composio.ts) module for more details.
222 When invoking an agent, make sure you validate the `user_id`.
223
224 ```typescript
225 +import { Composio } from '@composio/core';
226 +import { OpenAIProvider } from '@composio/openai';
227 +import { OpenAI } from 'openai';
228 +import { Hono } from 'hono';
229 +
230 +const app = new Hono();
231 +declare const composioClient: Composio<OpenAIProvider>;
232 +declare const openaiClient: OpenAI;
233 +declare function runGmailAgent(c: Composio<OpenAIProvider>, o: OpenAI, u: string, p: string): Promise<any[]>;
234 +// ---cut---
235 export function checkConnectedAccountExists(
236 composioClient: Composio<OpenAIProvider>,
237 userId: string,
@@ -236,7 +255,7 @@ export function checkConnectedAccountExists(
255 });
256 }
257
239 -export async function validateUserId(userId: string, composioClient: ComposioClient): Promise<string> {
258 +export async function validateUserId(userId: string, composioClient: Composio<OpenAIProvider>): Promise<string> {
259 /**
260 * Validate the user id, if no connected account is found, create a new connection.
261 */
fumadocs/content/examples/vercel-chat.mdx
+9
@@ -71,6 +71,7 @@ First, we fetch all connected accounts for a user and create a mapping of toolki
71 slugs to their connection IDs:
72
73 ```typescript app/api/composio/toolkits.ts
74 +// @noErrors
75 export async function GET() {
76 // ... auth logic ...
77
@@ -93,6 +94,7 @@ export async function GET() {
94 Next, we fetch toolkit information for each supported toolkit and combine it with the connection status:
95
96 ```typescript app/api/composio/toolkits.ts
97 +// @noErrors
98 export async function GET() {
99 // ... auth logic ...
100 // ... connected accounts mapping ...
@@ -133,6 +135,7 @@ When a user wants to connect their account, we create a connection request that
135
136
137 ```typescript app/api/connections/initiate/route.ts
138 +// @noErrors
139 export async function POST(request: Request) {
140 // ... auth and validation ...
141
@@ -160,6 +163,7 @@ After initiating a connection, we need to wait for the OAuth flow to complete. W
163
164
165 ```typescript app/api/connections/status/route.ts
166 +// @noErrors
167 export async function GET(request: Request) {
168 // ... auth and validation ...
169
@@ -182,6 +186,7 @@ export async function GET(request: Request) {
186 When a user wants to disconnect their account, we remove the connection using the connection ID:
187
188 ```typescript app/api/connections/delete/route.ts
189 +// @noErrors
190 export async function DELETE(request: Request) {
191 // ... auth and validation ...
192
@@ -206,6 +211,7 @@ Once users have connected their accounts, we need to track which toolkits are en
211 We keep track of which toolkits the user has enabled in the chat interface:
212
213 ```typescript components/chat.tsx
214 +// @noErrors
215 const { ... } = useChat({
216 // ... other config ...
217 experimental_prepareRequestBody: (body) => {
@@ -229,6 +235,7 @@ const { ... } = useChat({
235 We fetch Composio tools based on the enabled toolkit slugs:
236
237 ```typescript lib/ai/tools/composio.ts
238 +// @noErrors
239 export async function getComposioTools(userId: string, toolkitSlugs: string[]) {
240 // ... validation ...
241
@@ -240,6 +247,7 @@ export async function getComposioTools(userId: string, toolkitSlugs: string[]) {
247 ```
248
249 ```typescript app/api/chat.ts
250 +// @noErrors
251 export async function POST(request: Request) {
252 // ... auth and parsing ...
253
@@ -267,6 +275,7 @@ By default, tool calls appear as raw JSON in the chat interface. To create a bet
275 You can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:
276
277 ```typescript components/messages.tsx
278 +// @noErrors
279 if (type === 'tool-invocation') {
280 const { toolInvocation } = part;
281 const { toolName, toolCallId, state, args, result } = toolInvocation;
fumadocs/source.config.ts
+12
@@ -4,6 +4,7 @@ import {
4 defineCollections,
5 frontmatterSchema,
6 metaSchema,
7 + applyMdxPreset,
8 } from 'fumadocs-mdx/config';
9 import { transformerTwoslash } from '@shikijs/twoslash';
10 import { z } from 'zod';
@@ -39,10 +40,21 @@ export const toolRouter = defineDocs({
40 },
41 });
42
43 +// Reference docs use defineCollections with custom mdxOptions to exclude twoslash
44 +// (SDK reference docs are auto-generated and don't need type checking)
45 export const reference = defineDocs({
46 dir: 'content/reference',
47 docs: {
48 schema: docsSchema,
49 + mdxOptions: applyMdxPreset({
50 + rehypeCodeOptions: {
51 + themes: {
52 + light: 'github-light',
53 + dark: 'github-dark',
54 + },
55 + // No twoslash transformer - SDK reference docs skip type checking
56 + },
57 + }),
58 },
59 meta: {
60 schema: metaSchema,