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
docs: extract Steps code properly for prompt copy, improve prompt text
Sushmitha Malleshcaf085fce6f5
diff --git a/docs/components/quickstart/prompt-banner.tsx b/docs/components/quickstart/prompt-banner.tsxindex fda2993f5..6d61594ca 100644--- a/docs/components/quickstart/prompt-banner.tsx+++ b/docs/components/quickstart/prompt-banner.tsx@@ -11,9 +11,54 @@ export function PromptBanner({ children }: PromptBannerProps) {const [copied, setCopied] = useState(false);const contentRef = useRef<HTMLDivElement>(null);+ const extractSteps = (stepsEl: Element): string => {+ const parts: string[] = [];+ const steps = stepsEl.querySelectorAll('.fd-step');++ steps.forEach((step) => {+ // Step title+ const title = step.querySelector('h3, h4, [class*="StepTitle"]');+ if (title) parts.push(`### ${title.textContent?.trim()}`);++ // Code blocks — preserve as fenced code+ const codeBlocks = step.querySelectorAll('pre code');+ codeBlocks.forEach((code) => {+ // Try to detect language from class (e.g. "language-python")+ const langClass = Array.from(code.classList).find(c => c.startsWith('language-'));+ const lang = langClass?.replace('language-', '') ?? '';+ parts.push(`\`\`\`${lang}\n${code.textContent?.trim()}\n\`\`\``);+ });++ // Callouts / prose text (skip if it's just whitespace)+ const paragraphs = step.querySelectorAll(':scope > p, :scope > div:not(:has(pre)) > p');+ paragraphs.forEach((p) => {+ const text = p.textContent?.trim();+ if (text) parts.push(text);+ });+ });++ return parts.join('\n\n');+ };+const handleCopy = () => {- const text = contentRef.current?.innerText ?? '';- navigator.clipboard.writeText(text);+ const promptMeta = contentRef.current?.innerText ?? '';++ // Walk siblings after the banner to find the .fd-steps element+ let sibling = contentRef.current?.closest('.not-prose')?.nextElementSibling;+ let stepsText = '';+ while (sibling) {+ if (sibling.classList.contains('fd-steps')) {+ stepsText = extractSteps(sibling);+ break;+ }+ sibling = sibling.nextElementSibling;+ }++ const fullPrompt = stepsText+ ? `${promptMeta}\n\n## Code from tutorial\n\n${stepsText}`+ : promptMeta;++ navigator.clipboard.writeText(fullPrompt);setCopied(true);setTimeout(() => setCopied(false), 2000);};diff --git a/docs/content/docs/quickstart.mdx b/docs/content/docs/quickstart.mdxindex 2ba267146..a740a0943 100644--- a/docs/content/docs/quickstart.mdx+++ b/docs/content/docs/quickstart.mdx@@ -18,7 +18,7 @@ Build your first AI agent with Composio Tools. You'll create a [session](/docs/uGive your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools from that session, and pass them to your Agent.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**@@ -201,7 +201,7 @@ readline.close();Give your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint. Composio handles authentication, tool discovery, and execution. You create a **session** for a user and pass the MCP connection to your Agent.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**@@ -405,7 +405,7 @@ readline.close();Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools, wrap them in an SDK MCP server, and pass that server to ClaudeAgentOptions.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**@@ -617,7 +617,7 @@ readline.close();Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint. Composio handles authentication, tool discovery, and execution. You create a **session** for a user and pass the MCP connection to ClaudeAgentOptions.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**@@ -846,7 +846,7 @@ readline.close();Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio. Composio handles authentication, tool discovery, and execution. You create a **session** for a user, get tools from that session, and pass them to `streamText` or `generateText`. TypeScript only.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**@@ -989,7 +989,7 @@ readline.close();Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.) via Composio's hosted MCP server. No provider package needed — you connect directly to Composio's MCP endpoint using `@ai-sdk/mcp`. Composio handles authentication, tool discovery, and execution. TypeScript only.-Use the install commands and code examples from this page as reference.+The complete code examples from the official tutorial are included below.**Key concepts**