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 ToolTypeFlow selector for Native Tools vs MCP

Sushmithamallesh09ff5915cbf3
diff --git a/docs/components/tool-type-selector.tsx b/docs/components/tool-type-selector.tsx
new file mode 100644
index 000000000..ba15f7f43
--- /dev/null
+++ b/docs/components/tool-type-selector.tsx
@@ -0,0 +1,177 @@
+'use client';
+
+import Image from 'next/image';
+import {
+ createContext,
+ useContext,
+ useState,
+ useEffect,
+ useRef,
+ type ReactNode,
+} from 'react';
+import { Wrench } from 'lucide-react';
+
+// Types
+interface ToolTypeData {
+ id: string;
+ name: string;
+ icon: 'native' | 'mcp';
+}
+
+interface ToolTypeContextValue {
+ selectedId: string;
+ setSelectedId: (id: string) => void;
+ registerToolType: (data: ToolTypeData) => void;
+ toolTypes: ToolTypeData[];
+}
+
+// Context to share state between ToolTypeFlow and ToolTypeOption
+const ToolTypeContext = createContext<ToolTypeContextValue | null>(null);
+
+export function useToolType() {
+ const context = useContext(ToolTypeContext);
+ return context?.selectedId ?? null;
+}
+
+// Tool type option component - registers itself and conditionally renders content
+interface ToolTypeOptionProps {
+ id: string;
+ name: string;
+ icon: 'native' | 'mcp';
+ children: ReactNode;
+}
+
+export function ToolTypeOption({ id, name, icon, children }: ToolTypeOptionProps) {
+ const context = useContext(ToolTypeContext);
+ const hasRegistered = useRef(false);
+
+ useEffect(() => {
+ if (context && !hasRegistered.current) {
+ context.registerToolType({ id, name, icon });
+ hasRegistered.current = true;
+ }
+ }, [context, id, name, icon]);
+
+ // Only render if this tool type is selected
+ if (!context || context.selectedId !== id) {
+ return null;
+ }
+
+ return <>{children}</>;
+}
+
+// Card component for tool type selection
+interface ToolTypeCardProps {
+ id: string;
+ name: string;
+ icon: 'native' | 'mcp';
+ selected: boolean;
+ onSelect: () => void;
+}
+
+function ToolTypeCard({ name, icon, selected, onSelect }: ToolTypeCardProps) {
+ return (
+ <button
+ type="button"
+ onClick={onSelect}
+ className={`
+ flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-all
+ focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-orange-500 focus-visible:ring-offset-2
+ ${selected
+ ? 'border-[var(--composio-orange)] bg-fd-accent/30'
+ : 'border-fd-border bg-fd-card hover:bg-fd-accent/50 hover:border-[color-mix(in_srgb,var(--composio-orange)_50%,transparent)]'
+ }
+ `}
+ >
+ <div className="flex h-6 w-6 shrink-0 items-center justify-center">
+ {icon === 'native' ? (
+ <Wrench
+ size={20}
+ className={selected ? 'text-fd-foreground' : 'text-fd-muted-foreground'}
+ />
+ ) : (
+ <>
+ <Image
+ src="/images/mcp-logo.svg"
+ alt="MCP logo"
+ width={20}
+ height={20}
+ className="h-5 w-5 dark:hidden"
+ />
+ <Image
+ src="/images/mcp-logo-dark.svg"
+ alt="MCP logo"
+ width={20}
+ height={20}
+ className="h-5 w-5 hidden dark:block"
+ />
+ </>
+ )}
+ </div>
+ <span className="text-sm font-medium text-fd-foreground">{name}</span>
+ </button>
+ );
+}
+
+// Main wrapper component
+interface ToolTypeFlowProps {
+ children: ReactNode;
+}
+
+export function ToolTypeFlow({ children }: ToolTypeFlowProps) {
+ const [toolTypes, setToolTypes] = useState<ToolTypeData[]>([]);
+ const [selectedId, setSelectedId] = useState<string>('');
+ const registeredIds = useRef<Set<string>>(new Set());
+
+ const registerToolType = (data: ToolTypeData) => {
+ if (!registeredIds.current.has(data.id)) {
+ registeredIds.current.add(data.id);
+ setToolTypes((prev) => {
+ // Check if already exists
+ if (prev.some((t) => t.id === data.id)) {
+ return prev;
+ }
+ return [...prev, data];
+ });
+ }
+ };
+
+ // Set default selection to first tool type once registered
+ useEffect(() => {
+ if (toolTypes.length > 0 && !selectedId) {
+ setSelectedId(toolTypes[0].id);
+ }
+ }, [toolTypes, selectedId]);
+
+ const contextValue: ToolTypeContextValue = {
+ selectedId,
+ setSelectedId,
+ registerToolType,
+ toolTypes,
+ };
+
+ return (
+ <ToolTypeContext.Provider value={contextValue}>
+ {/* Tool type selector */}
+ {toolTypes.length > 0 && (
+ <div className="not-prose mb-6">
+ <div className="flex gap-3">
+ {toolTypes.map((toolType) => (
+ <ToolTypeCard
+ key={toolType.id}
+ id={toolType.id}
+ name={toolType.name}
+ icon={toolType.icon}
+ selected={selectedId === toolType.id}
+ onSelect={() => setSelectedId(toolType.id)}
+ />
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Render all children - ToolTypeOption will conditionally show based on selection */}
+ {children}
+ </ToolTypeContext.Provider>
+ );
+}
diff --git a/docs/content/docs/providers/openai-agents.mdx b/docs/content/docs/providers/openai-agents.mdx
index ba0d70814..34042f7ee 100644
--- a/docs/content/docs/providers/openai-agents.mdx
+++ b/docs/content/docs/providers/openai-agents.mdx
@@ -4,6 +4,130 @@ description: Use Composio with OpenAI's Agents SDK
keywords: [agents sdk]
---
+OpenAI Agents SDK is a lightweight framework for building agentic AI apps with minimal abstractions.
+
+## Usage
+
+<ToolTypeFlow>
+
+<ToolTypeOption id="native" name="Native Tools" icon="native">
+<Steps>
+<Step>
+### Install
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```bash
+pip install composio composio-openai-agents openai-agents
+```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install @composio/core @composio/openai-agents @openai/agents
+```
+</Tab>
+</Tabs>
+</Step>
+
+<Step>
+### Configure API Keys
+
+<Callout type="info">
+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).
+</Callout>
+
+```txt title=".env"
+COMPOSIO_API_KEY=xxxxxxxxx
+OPENAI_API_KEY=xxxxxxxxx
+```
+</Step>
+
+<Step>
+### Create session and run agent
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```python
+# TODO: Native tools Python code
+```
+</Tab>
+<Tab value="TypeScript">
+```typescript
+// TODO: Native tools TypeScript code
+```
+</Tab>
+</Tabs>
+</Step>
+</Steps>
+</ToolTypeOption>
+
+<ToolTypeOption id="mcp" name="MCP" icon="mcp">
+<Steps>
+<Step>
+### Install
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```bash
+pip install composio openai-agents
+```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install @composio/core @openai/agents
+```
+</Tab>
+</Tabs>
+</Step>
+
+<Step>
+### Configure API Keys
+
+<Callout type="info">
+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).
+</Callout>
+
+```txt title=".env"
+COMPOSIO_API_KEY=xxxxxxxxx
+OPENAI_API_KEY=xxxxxxxxx
+```
+</Step>
+
+<Step>
+### Create session and run agent
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```python
+# TODO: MCP Python code
+```
+</Tab>
+<Tab value="TypeScript">
+```typescript
+// TODO: MCP TypeScript code
+```
+</Tab>
+</Tabs>
+</Step>
+</Steps>
+</ToolTypeOption>
+
+</ToolTypeFlow>
+
+<Accordions>
+<Accordion title="Direct tool usage">
+TODO: Direct tool usage content
+</Accordion>
+
+<Accordion title="Direct MCP usage">
+TODO: Direct MCP usage content
+</Accordion>
+</Accordions>
+
+---
+
+## Old Content (to be removed)
+
The OpenAI Agents Provider is a provider that formats the Composio tools into an object compatible with OpenAI's Agents API.
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.
diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsx
index 36f884a5f..a64baaa8e 100644
--- a/docs/mdx-components.tsx
+++ b/docs/mdx-components.tsx
@@ -9,6 +9,7 @@ import { Card, Cards } from 'fumadocs-ui/components/card';
import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
import { ProviderCard, ProviderGrid } from '@/components/provider-card';
import { FrameworkSelector, QuickstartFlow, FrameworkOption } from '@/components/quickstart';
+import { ToolTypeFlow, ToolTypeOption } from '@/components/tool-type-selector';
import { Figure } from '@/components/figure';
import { Video } from '@/components/video';
import { CapabilityCard, CapabilityList } from '@/components/capability-card';
@@ -50,6 +51,8 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
FrameworkSelector,
QuickstartFlow,
FrameworkOption,
+ ToolTypeFlow,
+ ToolTypeOption,
Figure,
Video,
CapabilityCard,
diff --git a/docs/public/images/mcp-logo-dark.svg b/docs/public/images/mcp-logo-dark.svg
new file mode 100644
index 000000000..df2999988
--- /dev/null
+++ b/docs/public/images/mcp-logo-dark.svg
@@ -0,0 +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>
diff --git a/docs/public/images/mcp-logo.svg b/docs/public/images/mcp-logo.svg
new file mode 100644
index 000000000..f564b9aa1
--- /dev/null
+++ b/docs/public/images/mcp-logo.svg
@@ -0,0 +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>