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: create script to add opengraph images. (#1626)

Siddharth Balyan4921ddfe0886
diff --git a/fern/pages/authentication/custom-auth-configs.mdx b/fern/pages/authentication/custom-auth-configs.mdx
index 21d298d15..878d54df6 100644
--- a/fern/pages/authentication/custom-auth-configs.mdx
+++ b/fern/pages/authentication/custom-auth-configs.mdx
@@ -1,6 +1,6 @@
---
title: Custom Auth Configs
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Custom%20Auth%20Configs" # image for socials
subtitle: "Guide to using customising auth configs for a toolkit "
keywords: ""
hide-nav-links: true
diff --git a/fern/pages/authentication/custom-auth-params.mdx b/fern/pages/authentication/custom-auth-params.mdx
index 820f2d64c..2e56b1631 100644
--- a/fern/pages/authentication/custom-auth-params.mdx
+++ b/fern/pages/authentication/custom-auth-params.mdx
@@ -1,6 +1,6 @@
---
title: Custom Auth Parameters
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Custom%20Auth%20Parameters" # image for socials
subtitle: "Guide to injecting custom credentials in headers or parameters for a toolkit"
keywords: ""
hide-nav-links: true
diff --git a/fern/pages/authentication/programmatic-auth-configs.mdx b/fern/pages/authentication/programmatic-auth-configs.mdx
index dfc826bad..5255bae75 100644
--- a/fern/pages/authentication/programmatic-auth-configs.mdx
+++ b/fern/pages/authentication/programmatic-auth-configs.mdx
@@ -1,6 +1,6 @@
---
title: Programmatic Auth Configs
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Programmatic%20Auth%20Configs" # image for socials
subtitle: "Guide to creating auth configs programmatically"
keywords: ""
hide-nav-links: true
diff --git a/fern/pages/examples/src/hello-world.mdx b/fern/pages/examples/src/hello-world.mdx
index 6fd5a2ad3..d016baa17 100644
--- a/fern/pages/examples/src/hello-world.mdx
+++ b/fern/pages/examples/src/hello-world.mdx
@@ -1,6 +1,6 @@
---
title: Hello World!
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Hello%20World%21" # image for socials
description: "A simple example of how to use the Composio SDK to call tools."
keywords: "hello world, composio, sdk, tool calling"
subtitle: ""
diff --git a/fern/pages/examples/src/sample-script/sample-script.mdx b/fern/pages/examples/src/sample-script/sample-script.mdx
index 5966aebb6..da59228fc 100644
--- a/fern/pages/examples/src/sample-script/sample-script.mdx
+++ b/fern/pages/examples/src/sample-script/sample-script.mdx
@@ -1,6 +1,6 @@
---
title: Sample Script
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Sample%20Script" # image for socials
description: "A simple example of python script that uses the Composio SDK to call tools."
keywords: "hello world python, composio, sdk, tool calling"
subtitle: ""
diff --git a/fern/pages/examples/src/sample-webserver/sample-webserver.mdx b/fern/pages/examples/src/sample-webserver/sample-webserver.mdx
index 0db1c9563..ff648e154 100644
--- a/fern/pages/examples/src/sample-webserver/sample-webserver.mdx
+++ b/fern/pages/examples/src/sample-webserver/sample-webserver.mdx
@@ -1,6 +1,6 @@
---
title: A basic web server
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=A%20basic%20web%20server" # image for socials
description: "A simple example of a web server that uses the Composio SDK to call tools."
keywords: "web server, composio, sdk, tool calling"
subtitle: ""
diff --git a/fern/pages/examples/src/vercel-composio.mdx b/fern/pages/examples/src/vercel-composio.mdx
index b695051e6..a7149a900 100644
--- a/fern/pages/examples/src/vercel-composio.mdx
+++ b/fern/pages/examples/src/vercel-composio.mdx
@@ -1,7 +1,7 @@
---
title: Fully featured AI chatbot with Composio
slug: /examples/vercel
-image: ""
+image: "https://og.composio.dev/api/og?title=Fully%20featured%20AI%20chatbot%20with%20Composio" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/get-started/dev-setup.mdx b/fern/pages/get-started/dev-setup.mdx
index 2e88159cf..77d70872f 100644
--- a/fern/pages/get-started/dev-setup.mdx
+++ b/fern/pages/get-started/dev-setup.mdx
@@ -2,7 +2,7 @@
title: IDE and Agent Setup
subtitle: "Setup your AI IDE and agent to help you ship faster with Composio"
slug: /docs/dev-setup
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=IDE%20and%20Agent%20Setup" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/get-started/providers.mdx b/fern/pages/get-started/providers.mdx
index 7f5486da4..3ffc90fcc 100644
--- a/fern/pages/get-started/providers.mdx
+++ b/fern/pages/get-started/providers.mdx
@@ -1,7 +1,7 @@
---
title: Providers
slug: /docs/toolsets
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Providers" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/get-started/quickstart.mdx b/fern/pages/get-started/quickstart.mdx
index 0d3e776a7..acc7c2e0b 100644
--- a/fern/pages/get-started/quickstart.mdx
+++ b/fern/pages/get-started/quickstart.mdx
@@ -1,6 +1,6 @@
---
title: Quickstart
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Quickstart" # image for socials
description: "Add authenticated tool-calling to any LLM agent in three steps."
keywords: ""
subtitle: ""
@@ -90,7 +90,7 @@ print(result)
```
</Tab>
<Tab title="Anthropic (Typescript)">
-You may install the Anthropic SDK as well!
+You may install the Anthropic provider as well!
**Installation**
```bash
@@ -135,7 +135,7 @@ console.log("✅ Tool results:", result);
```
</Tab>
<Tab title="Vercel AI SDK (Typescript)">
-You may install the Vercel AI SDK as well!
+You may install the Vercel AI provider as well!
**Installation**
```bash
diff --git a/fern/pages/get-started/welcome.mdx b/fern/pages/get-started/welcome.mdx
index de7936ccf..1c06cbd04 100644
--- a/fern/pages/get-started/welcome.mdx
+++ b/fern/pages/get-started/welcome.mdx
@@ -1,6 +1,6 @@
---
title: Welcome to Composio
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Welcome%20to%20Composio" # image for socials
keywords: ""
subtitle: "Our API and SDKs enable developers to build AI applications and experiences that are a step above the rest."
hide-nav-links: false
diff --git a/fern/pages/mcp/introduction.mdx b/fern/pages/mcp/introduction.mdx
index cef833c7f..390422844 100644
--- a/fern/pages/mcp/introduction.mdx
+++ b/fern/pages/mcp/introduction.mdx
@@ -1,7 +1,7 @@
---
title: Composio MCP Servers
subtitle: "Guide to working with Composio MCP servers"
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Composio%20MCP%20Servers" # image for socials
keywords: ""
hide-nav-links: true
---
diff --git a/fern/pages/providers/anthropic.mdx b/fern/pages/providers/anthropic.mdx
index 9ae0d0058..988cbaa78 100644
--- a/fern/pages/providers/anthropic.mdx
+++ b/fern/pages/providers/anthropic.mdx
@@ -1,7 +1,7 @@
---
title: Anthropic Provider
slug: /providers/anthropic
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Anthropic%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/crewai.mdx b/fern/pages/providers/crewai.mdx
index f47843f16..911580076 100644
--- a/fern/pages/providers/crewai.mdx
+++ b/fern/pages/providers/crewai.mdx
@@ -1,7 +1,7 @@
---
title: CrewAI Provider
slug: /providers/crewai
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=CrewAI%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/custom.mdx b/fern/pages/providers/custom.mdx
index 6b94c40a1..1f842f670 100644
--- a/fern/pages/providers/custom.mdx
+++ b/fern/pages/providers/custom.mdx
@@ -1,7 +1,7 @@
---
title: Custom Providers
slug: /toolsets/custom
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Custom%20Providers" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/google-adk.mdx b/fern/pages/providers/google-adk.mdx
index 260463637..a32ea0789 100644
--- a/fern/pages/providers/google-adk.mdx
+++ b/fern/pages/providers/google-adk.mdx
@@ -1,7 +1,7 @@
---
title: Google ADK Provider
slug: /providers/google-adk
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Google%20ADK%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/langgraph.mdx b/fern/pages/providers/langgraph.mdx
index e947f58e2..e299eec1a 100644
--- a/fern/pages/providers/langgraph.mdx
+++ b/fern/pages/providers/langgraph.mdx
@@ -1,7 +1,7 @@
---
title: LangGraph Provider
slug: /providers/langgraph
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=LangGraph%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/mastra.mdx b/fern/pages/providers/mastra.mdx
index 734f6ed82..a99132a2f 100644
--- a/fern/pages/providers/mastra.mdx
+++ b/fern/pages/providers/mastra.mdx
@@ -1,7 +1,7 @@
---
title: Mastra Provider
slug: /providers/mastra
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Mastra%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/openai-agents.mdx b/fern/pages/providers/openai-agents.mdx
index 3f9094b64..22090dc92 100644
--- a/fern/pages/providers/openai-agents.mdx
+++ b/fern/pages/providers/openai-agents.mdx
@@ -1,7 +1,7 @@
---
title: OpenAI Agents Provider
slug: /providers/openai-agents
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=OpenAI%20Agents%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/openai.mdx b/fern/pages/providers/openai.mdx
index cd39e5030..01f6802ba 100644
--- a/fern/pages/providers/openai.mdx
+++ b/fern/pages/providers/openai.mdx
@@ -1,7 +1,7 @@
---
title: OpenAI Providers
slug: /providers/openai
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=OpenAI%20Providers" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/providers/vercel.mdx b/fern/pages/providers/vercel.mdx
index 6e97750c7..24180a610 100644
--- a/fern/pages/providers/vercel.mdx
+++ b/fern/pages/providers/vercel.mdx
@@ -1,7 +1,7 @@
---
title: Vercel AI SDK Provider
slug: /providers/vercel
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Vercel%20AI%20SDK%20Provider" # image for socials
keywords: ""
hide-nav-links: false
---
diff --git a/fern/pages/tool-calling/after-execution-modifiers.mdx b/fern/pages/tool-calling/after-execution-modifiers.mdx
index a348b0b70..1e31cad01 100644
--- a/fern/pages/tool-calling/after-execution-modifiers.mdx
+++ b/fern/pages/tool-calling/after-execution-modifiers.mdx
@@ -1,6 +1,6 @@
---
title: After Execution Modifiers
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=After%20Execution%20Modifiers" # image for socials
keywords: ""
subtitle: "Learn how to use after execution modifiers to transform tool results after execution."
hide-nav-links: false
diff --git a/fern/pages/tool-calling/authenticating-tools.mdx b/fern/pages/tool-calling/authenticating-tools.mdx
index 1cfc007c0..038b6628f 100644
--- a/fern/pages/tool-calling/authenticating-tools.mdx
+++ b/fern/pages/tool-calling/authenticating-tools.mdx
@@ -1,6 +1,6 @@
---
title: Authenticating Tools
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Authenticating%20Tools" # image for socials
keywords: ""
subtitle: "Learn how to authenticate tools"
hide-nav-links: false
diff --git a/fern/pages/tool-calling/before-execution-modifiers.mdx b/fern/pages/tool-calling/before-execution-modifiers.mdx
index 66ff9b4cb..c3ee5e178 100644
--- a/fern/pages/tool-calling/before-execution-modifiers.mdx
+++ b/fern/pages/tool-calling/before-execution-modifiers.mdx
@@ -1,6 +1,6 @@
---
title: Before Execution Modifiers
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Before%20Execution%20Modifiers" # image for socials
keywords: ""
subtitle: "Learn how to use before execution modifiers to modify tool arguments before execution."
hide-nav-links: false
diff --git a/fern/pages/tool-calling/custom-tools.mdx b/fern/pages/tool-calling/custom-tools.mdx
index e9e8ba9be..7317bbe06 100644
--- a/fern/pages/tool-calling/custom-tools.mdx
+++ b/fern/pages/tool-calling/custom-tools.mdx
@@ -1,6 +1,6 @@
---
title: Creating custom tools
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Creating%20custom%20tools" # image for socials
keywords: ""
subtitle: "Learn how to extend Composio's toolkits with your own tools"
hide-nav-links: false
diff --git a/fern/pages/tool-calling/executing-tools.mdx b/fern/pages/tool-calling/executing-tools.mdx
index cc18dfa04..5c996a6ea 100644
--- a/fern/pages/tool-calling/executing-tools.mdx
+++ b/fern/pages/tool-calling/executing-tools.mdx
@@ -1,6 +1,6 @@
---
title: Executing Tools
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Executing%20Tools" # image for socials
keywords: ""
subtitle: "Learn how to execute Composio's tools with different providers and frameworks"
hide-nav-links: false
diff --git a/fern/pages/tool-calling/fetching-tools.mdx b/fern/pages/tool-calling/fetching-tools.mdx
index ca1f50db5..51a8246e5 100644
--- a/fern/pages/tool-calling/fetching-tools.mdx
+++ b/fern/pages/tool-calling/fetching-tools.mdx
@@ -1,6 +1,6 @@
---
title: Fetching and Filtering Tools
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Fetching%20and%20Filtering%20Tools" # image for socials
keywords: ""
subtitle: "Learn how to fetch and filter Composio's tools and toolsets"
hide-nav-links: false
diff --git a/fern/pages/tool-calling/schema-modifiers.mdx b/fern/pages/tool-calling/schema-modifiers.mdx
index 625193e35..380a61026 100644
--- a/fern/pages/tool-calling/schema-modifiers.mdx
+++ b/fern/pages/tool-calling/schema-modifiers.mdx
@@ -1,6 +1,6 @@
---
title: Schema Modifiers
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Schema%20Modifiers" # image for socials
keywords: ""
subtitle: "Learn how to use schema modifiers to transform tool schemas before they are seen by agents."
hide-nav-links: false
diff --git a/fern/pages/triggers/using-triggers.mdx b/fern/pages/triggers/using-triggers.mdx
index 3bbd6212f..a40d5fcb9 100644
--- a/fern/pages/triggers/using-triggers.mdx
+++ b/fern/pages/triggers/using-triggers.mdx
@@ -1,7 +1,7 @@
---
title: Using Triggers
subtitle: Send payloads to your system based on external events
-image: "" # image for socials
+image: "https://og.composio.dev/api/og?title=Using%20Triggers" # image for socials
keywords: ""
hide-nav-links: true
---
diff --git a/fern/scripts/add_og_imgs.py b/fern/scripts/add_og_imgs.py
new file mode 100644
index 000000000..e73bacc77
--- /dev/null
+++ b/fern/scripts/add_og_imgs.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python3
+"""
+Script to update image properties in MDX frontmatter for social media previews.
+
+This script processes all MDX files in the fern/pages directory and adds or updates
+the 'image' property in the frontmatter with a URL that generates social media
+preview images based on the page title.
+
+Usage:
+ python scripts/update_mdx_images.py [--dry-run] [--verbose]
+
+Options:
+ --dry-run Show what would be changed without making actual changes
+ --verbose Show detailed output for all processed files
+"""
+
+import argparse
+import os
+import re
+import sys
+from pathlib import Path
+from urllib.parse import quote
+
+
+def extract_title_from_frontmatter(frontmatter):
+ """Extract the title from frontmatter string."""
+ # Handle different title formats:
+ # title: Simple Title
+ # title: "Quoted Title"
+ # title: 'Single Quoted Title'
+ title_patterns = [
+ r"^title:\s*[\"']([^\"']+)[\"']\s*$", # Quoted titles
+ r"^title:\s*([^#\n]+?)(?:\s*#.*)?$", # Unquoted titles (with optional comments)
+ ]
+
+ for pattern in title_patterns:
+ match = re.search(pattern, frontmatter, re.MULTILINE)
+ if match:
+ return match.group(1).strip()
+
+ return None
+
+
+def has_frontmatter(content):
+ """Check if content has valid frontmatter."""
+ return content.startswith("---") and content.count("---") >= 2
+
+
+def update_mdx_image(file_path, dry_run=False, verbose=False):
+ """
+ Update the image property in MDX frontmatter based on the title.
+
+ Args:
+ file_path: Path to the MDX file
+ dry_run: If True, don't actually modify files
+ verbose: If True, show detailed output
+
+ Returns:
+ dict: Result information with keys 'updated', 'message', 'title'
+ """
+ try:
+ with open(file_path, "r", encoding="utf-8") as f:
+ content = f.read()
+ except Exception as e:
+ return {"updated": False, "message": f"Error reading file: {e}", "title": None}
+
+ # Check if file has frontmatter
+ if not has_frontmatter(content):
+ return {"updated": False, "message": "No frontmatter found", "title": None}
+
+ # Split frontmatter and content
+ parts = content.split("---", 2)
+ if len(parts) < 3:
+ return {"updated": False, "message": "Invalid frontmatter format", "title": None}
+
+ frontmatter = parts[1]
+ body = parts[2]
+
+ # Extract title from frontmatter
+ title = extract_title_from_frontmatter(frontmatter)
+ if not title:
+ return {"updated": False, "message": "No title found in frontmatter", "title": None}
+
+ # Create the image URL
+ encoded_title = quote(title)
+ image_url = f'"https://og.composio.dev/api/og?title={encoded_title}"'
+
+ # Check if image property already exists
+ image_pattern = r"^image:\s*.*$"
+ image_match = re.search(image_pattern, frontmatter, re.MULTILINE)
+
+ if image_match:
+ # Check if it's already the correct URL
+ current_image_line = image_match.group(0)
+ if image_url in current_image_line:
+ return {"updated": False, "message": "Image URL already up to date", "title": title}
+
+ # Update existing image property
+ new_frontmatter = re.sub(
+ image_pattern,
+ f"image: {image_url} # image for socials",
+ frontmatter,
+ flags=re.MULTILINE,
+ )
+ action = "Updated existing"
+ else:
+ # Add image property after title
+ title_pattern = r"^title:\s*.*$"
+ title_match = re.search(title_pattern, frontmatter, re.MULTILINE)
+
+ if not title_match:
+ return {
+ "updated": False,
+ "message": "Could not find title line to insert image after",
+ "title": title,
+ }
+
+ title_line = title_match.group(0)
+ new_image_line = f"image: {image_url} # image for socials"
+ new_frontmatter = frontmatter.replace(title_line, f"{title_line}\n{new_image_line}")
+ action = "Added new"
+
+ # Don't write if dry run
+ if dry_run:
+ return {"updated": True, "message": f"{action} image property (DRY RUN)", "title": title}
+
+ # Reconstruct the file content
+ new_content = f"---{new_frontmatter}---{body}"
+
+ # Write back to file
+ try:
+ with open(file_path, "w", encoding="utf-8") as f:
+ f.write(new_content)
+
+ return {"updated": True, "message": f"{action} image property", "title": title}
+ except Exception as e:
+ return {"updated": False, "message": f"Error writing file: {e}", "title": title}
+
+
+def main():
+ """Process all MDX files in fern/pages directory."""
+ parser = argparse.ArgumentParser(
+ description="Update image properties in MDX frontmatter for social media previews"
+ )
+ parser.add_argument(
+ "--dry-run",
+ action="store_true",
+ help="Show what would be changed without making actual changes",
+ )
+ parser.add_argument(
+ "--verbose", action="store_true", help="Show detailed output for all processed files"
+ )
+
+ args = parser.parse_args()
+
+ # Determine the pages directory relative to script location
+ script_dir = Path(__file__).parent
+ pages_dir = script_dir.parent / "pages"
+
+ if not pages_dir.exists():
+ print(f"Error: Pages directory not found at {pages_dir}")
+ print("Make sure to run this script from the fern directory")
+ sys.exit(1)
+
+ # Find all MDX files
+ mdx_files = list(pages_dir.rglob("*.mdx"))
+
+ if not mdx_files:
+ print("No MDX files found in pages directory")
+ return
+
+ print(f"Found {len(mdx_files)} MDX files")
+ if args.dry_run:
+ print("🔍 DRY RUN MODE - No files will be modified")
+ print()
+
+ # Process files
+ updated_count = 0
+ skipped_count = 0
+ error_count = 0
+
+ for mdx_file in sorted(mdx_files):
+ rel_path = mdx_file.relative_to(pages_dir)
+
+ try:
+ result = update_mdx_image(mdx_file, dry_run=args.dry_run, verbose=args.verbose)
+
+ if result["updated"]:
+ updated_count += 1
+ status = "✅" if not args.dry_run else "🔄"
+ print(f"{status} {rel_path}")
+ if args.verbose or args.dry_run:
+ print(f" Title: {result['title']}")
+ print(f" Action: {result['message']}")
+ else:
+ skipped_count += 1
+ if args.verbose:
+ print(f"⏭️ {rel_path}")
+ print(f" Reason: {result['message']}")
+ if result["title"]:
+ print(f" Title: {result['title']}")
+
+ except Exception as e:
+ error_count += 1
+ print(f"❌ {rel_path}")
+ print(f" Error: {e}")
+
+ # Summary
+ print(f"\n📊 Summary:")
+ print(f" Total files: {len(mdx_files)}")
+ print(f" Updated: {updated_count}")
+ print(f" Skipped: {skipped_count}")
+ if error_count > 0:
+ print(f" Errors: {error_count}")
+
+ if args.dry_run and updated_count > 0:
+ print(f"\n💡 Run without --dry-run to apply {updated_count} changes")
+
+
+if __name__ == "__main__":
+ main()