@devries-cameron20 / composio-1 / commits / 09ff5915c
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 ToolTypeFlow selector for Native Tools vs MCP

- Create tool-type-selector.tsx component with card-based selection - Add MCP logo assets (light and dark variants) - Update OpenAI Agents page with new structure - Register components in mdx-components.tsx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 23, 2026 at 16:18 UTC 09ff5915cbf382a58ac6fea6b9fb526c11476a7b
5 files changed +306
docs/components/tool-type-selector.tsx new
+177
@@ -0,0 +1,177 @@
1 +'use client';
2 +
3 +import Image from 'next/image';
4 +import {
5 + createContext,
6 + useContext,
7 + useState,
8 + useEffect,
9 + useRef,
10 + type ReactNode,
11 +} from 'react';
12 +import { Wrench } from 'lucide-react';
13 +
14 +// Types
15 +interface ToolTypeData {
16 + id: string;
17 + name: string;
18 + icon: 'native' | 'mcp';
19 +}
20 +
21 +interface ToolTypeContextValue {
22 + selectedId: string;
23 + setSelectedId: (id: string) => void;
24 + registerToolType: (data: ToolTypeData) => void;
25 + toolTypes: ToolTypeData[];
26 +}
27 +
28 +// Context to share state between ToolTypeFlow and ToolTypeOption
29 +const ToolTypeContext = createContext<ToolTypeContextValue | null>(null);
30 +
31 +export function useToolType() {
32 + const context = useContext(ToolTypeContext);
33 + return context?.selectedId ?? null;
34 +}
35 +
36 +// Tool type option component - registers itself and conditionally renders content
37 +interface ToolTypeOptionProps {
38 + id: string;
39 + name: string;
40 + icon: 'native' | 'mcp';
41 + children: ReactNode;
42 +}
43 +
44 +export function ToolTypeOption({ id, name, icon, children }: ToolTypeOptionProps) {
45 + const context = useContext(ToolTypeContext);
46 + const hasRegistered = useRef(false);
47 +
48 + useEffect(() => {
49 + if (context && !hasRegistered.current) {
50 + context.registerToolType({ id, name, icon });
51 + hasRegistered.current = true;
52 + }
53 + }, [context, id, name, icon]);
54 +
55 + // Only render if this tool type is selected
56 + if (!context || context.selectedId !== id) {
57 + return null;
58 + }
59 +
60 + return <>{children}</>;
61 +}
62 +
63 +// Card component for tool type selection
64 +interface ToolTypeCardProps {
65 + id: string;
66 + name: string;
67 + icon: 'native' | 'mcp';
68 + selected: boolean;
69 + onSelect: () => void;
70 +}
71 +
72 +function ToolTypeCard({ name, icon, selected, onSelect }: ToolTypeCardProps) {
73 + return (
74 + <button
75 + type="button"
76 + onClick={onSelect}
77 + className={`
78 + flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-all
79 + focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-500 focus-visible:ring-offset-2
80 + ${selected
81 + ? 'border-[var(--composio-orange)] bg-fd-accent/30'
82 + : 'border-fd-border bg-fd-card hover:bg-fd-accent/50 hover:border-[color-mix(in_srgb,var(--composio-orange)_50%,transparent)]'
83 + }
84 + `}
85 + >
86 + <div className="flex h-6 w-6 shrink-0 items-center justify-center">
87 + {icon === 'native' ? (
88 + <Wrench
89 + size={20}
90 + className={selected ? 'text-fd-foreground' : 'text-fd-muted-foreground'}
91 + />
92 + ) : (
93 + <>
94 + <Image
95 + src="/images/mcp-logo.svg"
96 + alt="MCP logo"
97 + width={20}
98 + height={20}
99 + className="h-5 w-5 dark:hidden"
100 + />
101 + <Image
102 + src="/images/mcp-logo-dark.svg"
103 + alt="MCP logo"
104 + width={20}
105 + height={20}
106 + className="h-5 w-5 hidden dark:block"
107 + />
108 + </>
109 + )}
110 + </div>
111 + <span className="text-sm font-medium text-fd-foreground">{name}</span>
112 + </button>
113 + );
114 +}
115 +
116 +// Main wrapper component
117 +interface ToolTypeFlowProps {
118 + children: ReactNode;
119 +}
120 +
121 +export function ToolTypeFlow({ children }: ToolTypeFlowProps) {
122 + const [toolTypes, setToolTypes] = useState<ToolTypeData[]>([]);
123 + const [selectedId, setSelectedId] = useState<string>('');
124 + const registeredIds = useRef<Set<string>>(new Set());
125 +
126 + const registerToolType = (data: ToolTypeData) => {
127 + if (!registeredIds.current.has(data.id)) {
128 + registeredIds.current.add(data.id);
129 + setToolTypes((prev) => {
130 + // Check if already exists
131 + if (prev.some((t) => t.id === data.id)) {
132 + return prev;
133 + }
134 + return [...prev, data];
135 + });
136 + }
137 + };
138 +
139 + // Set default selection to first tool type once registered
140 + useEffect(() => {
141 + if (toolTypes.length > 0 && !selectedId) {
142 + setSelectedId(toolTypes[0].id);
143 + }
144 + }, [toolTypes, selectedId]);
145 +
146 + const contextValue: ToolTypeContextValue = {
147 + selectedId,
148 + setSelectedId,
149 + registerToolType,
150 + toolTypes,
151 + };
152 +
153 + return (
154 + <ToolTypeContext.Provider value={contextValue}>
155 + {/* Tool type selector */}
156 + {toolTypes.length > 0 && (
157 + <div className="not-prose mb-6">
158 + <div className="flex gap-3">
159 + {toolTypes.map((toolType) => (
160 + <ToolTypeCard
161 + key={toolType.id}
162 + id={toolType.id}
163 + name={toolType.name}
164 + icon={toolType.icon}
165 + selected={selectedId === toolType.id}
166 + onSelect={() => setSelectedId(toolType.id)}
167 + />
168 + ))}
169 + </div>
170 + </div>
171 + )}
172 +
173 + {/* Render all children - ToolTypeOption will conditionally show based on selection */}
174 + {children}
175 + </ToolTypeContext.Provider>
176 + );
177 +}
docs/content/docs/providers/openai-agents.mdx
+124
@@ -4,6 +4,130 @@ description: Use Composio with OpenAI's Agents SDK
4 keywords: [agents sdk]
5 ---
6
7 +OpenAI Agents SDK is a lightweight framework for building agentic AI apps with minimal abstractions.
8 +
9 +## Usage
10 +
11 +<ToolTypeFlow>
12 +
13 +<ToolTypeOption id="native" name="Native Tools" icon="native">
14 +<Steps>
15 +<Step>
16 +### Install
17 +
18 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
19 +<Tab value="Python">
20 +```bash
21 +pip install composio composio-openai-agents openai-agents
22 +```
23 +</Tab>
24 +<Tab value="TypeScript">
25 +```bash
26 +npm install @composio/core @composio/openai-agents @openai/agents
27 +```
28 +</Tab>
29 +</Tabs>
30 +</Step>
31 +
32 +<Step>
33 +### Configure API Keys
34 +
35 +<Callout type="info">
36 +Set `COMPOSIO_API_KEY` with your API key from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` with your [OpenAI API key](https://platform.openai.com/api-keys).
37 +</Callout>
38 +
39 +```txt title=".env"
40 +COMPOSIO_API_KEY=xxxxxxxxx
41 +OPENAI_API_KEY=xxxxxxxxx
42 +```
43 +</Step>
44 +
45 +<Step>
46 +### Create session and run agent
47 +
48 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
49 +<Tab value="Python">
50 +```python
51 +# TODO: Native tools Python code
52 +```
53 +</Tab>
54 +<Tab value="TypeScript">
55 +```typescript
56 +// TODO: Native tools TypeScript code
57 +```
58 +</Tab>
59 +</Tabs>
60 +</Step>
61 +</Steps>
62 +</ToolTypeOption>
63 +
64 +<ToolTypeOption id="mcp" name="MCP" icon="mcp">
65 +<Steps>
66 +<Step>
67 +### Install
68 +
69 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
70 +<Tab value="Python">
71 +```bash
72 +pip install composio openai-agents
73 +```
74 +</Tab>
75 +<Tab value="TypeScript">
76 +```bash
77 +npm install @composio/core @openai/agents
78 +```
79 +</Tab>
80 +</Tabs>
81 +</Step>
82 +
83 +<Step>
84 +### Configure API Keys
85 +
86 +<Callout type="info">
87 +Set `COMPOSIO_API_KEY` with your API key from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` with your [OpenAI API key](https://platform.openai.com/api-keys).
88 +</Callout>
89 +
90 +```txt title=".env"
91 +COMPOSIO_API_KEY=xxxxxxxxx
92 +OPENAI_API_KEY=xxxxxxxxx
93 +```
94 +</Step>
95 +
96 +<Step>
97 +### Create session and run agent
98 +
99 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
100 +<Tab value="Python">
101 +```python
102 +# TODO: MCP Python code
103 +```
104 +</Tab>
105 +<Tab value="TypeScript">
106 +```typescript
107 +// TODO: MCP TypeScript code
108 +```
109 +</Tab>
110 +</Tabs>
111 +</Step>
112 +</Steps>
113 +</ToolTypeOption>
114 +
115 +</ToolTypeFlow>
116 +
117 +<Accordions>
118 +<Accordion title="Direct tool usage">
119 +TODO: Direct tool usage content
120 +</Accordion>
121 +
122 +<Accordion title="Direct MCP usage">
123 +TODO: Direct MCP usage content
124 +</Accordion>
125 +</Accordions>
126 +
127 +---
128 +
129 +## Old Content (to be removed)
130 +
131 The OpenAI Agents Provider is a provider that formats the Composio tools into an object compatible with OpenAI's Agents API.
132
133 OpenAI Agents SDK is different from the OpenAI SDK. It helps build agentic AI apps in a lightweight, easy-to-use package with very few abstractions.
docs/mdx-components.tsx
+3
@@ -9,6 +9,7 @@ import { Card, Cards } from 'fumadocs-ui/components/card';
9 import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
10 import { ProviderCard, ProviderGrid } from '@/components/provider-card';
11 import { FrameworkSelector, QuickstartFlow, FrameworkOption } from '@/components/quickstart';
12 +import { ToolTypeFlow, ToolTypeOption } from '@/components/tool-type-selector';
13 import { Figure } from '@/components/figure';
14 import { Video } from '@/components/video';
15 import { CapabilityCard, CapabilityList } from '@/components/capability-card';
@@ -50,6 +51,8 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
51 FrameworkSelector,
52 QuickstartFlow,
53 FrameworkOption,
54 + ToolTypeFlow,
55 + ToolTypeOption,
56 Figure,
57 Video,
58 CapabilityCard,
docs/public/images/mcp-logo-dark.svg new
+1
@@ -0,0 +1 @@
1 +<svg fill="#ffffff" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ModelContextProtocol</title><path d="M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"></path><path d="M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"></path></svg>
docs/public/images/mcp-logo.svg new
+1
@@ -0,0 +1 @@
1 +<svg fill="#1a1a1a" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ModelContextProtocol</title><path d="M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"></path><path d="M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"></path></svg>