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: add Gmail Filterer example

[email protected]f218296f75cc
diff --git a/fern/assets/images/examples/ai-email-labels.png b/fern/assets/images/examples/ai-email-labels.png
new file mode 100644
index 000000000..ebdcd5d99
Binary files /dev/null and b/fern/assets/images/examples/ai-email-labels.png differ
diff --git a/fern/assets/images/examples/gmail-agent-trace.png b/fern/assets/images/examples/gmail-agent-trace.png
new file mode 100644
index 000000000..d507abd66
Binary files /dev/null and b/fern/assets/images/examples/gmail-agent-trace.png differ
diff --git a/fern/assets/images/examples/trigger-config.png b/fern/assets/images/examples/trigger-config.png
new file mode 100644
index 000000000..9d2877226
Binary files /dev/null and b/fern/assets/images/examples/trigger-config.png differ
diff --git a/fern/assets/images/examples/webhook-secret.png b/fern/assets/images/examples/webhook-secret.png
new file mode 100644
index 000000000..0f51d0b73
Binary files /dev/null and b/fern/assets/images/examples/webhook-secret.png differ
diff --git a/fern/docs.yml b/fern/docs.yml
index 9694f49aa..c15e20ecf 100644
--- a/fern/docs.yml
+++ b/fern/docs.yml
@@ -198,7 +198,7 @@ navigation:
icon: zap
skip-slug: true
contents:
- - page: Gmail Reaper
+ - page: AI Gmail Labeller
path: pages/dist/examples/gmail-filterer.mdx
slug: examples/gmail-reaper
- section: Behind the curtain
@@ -254,1119 +254,21 @@ navigation:
- page: Gmail
slug: tools/gmail
path: tools/gmail.mdx
- - page: Googlesheets
- slug: tools/googlesheets
- path: tools/googlesheets.mdx
- page: Notion
slug: tools/notion
path: tools/notion.mdx
- - page: Shopify
- slug: tools/shopify
- path: tools/shopify.mdx
- - page: Stripe
- slug: tools/stripe
- path: tools/stripe.mdx
- - page: Twitter
- slug: tools/twitter
- path: tools/twitter.mdx
- - section: Crm
- skip-slug: true
- contents:
- - page: Acculynx
- slug: tools/acculynx
- path: tools/acculynx.mdx
- - page: Affinity
- slug: tools/affinity
- path: tools/affinity.mdx
- - page: Agencyzoom
- slug: tools/agencyzoom
- path: tools/agencyzoom.mdx
- - page: Apollo
- slug: tools/apollo
- path: tools/apollo.mdx
- - page: Attio
- slug: tools/attio
- path: tools/attio.mdx
- - page: Close
- slug: tools/close
- path: tools/close.mdx
- - page: Dynamics365
- slug: tools/dynamics365
- path: tools/dynamics365.mdx
- - page: Freshdesk
- slug: tools/freshdesk
- path: tools/freshdesk.mdx
- - page: Gorgias
- slug: tools/gorgias
- path: tools/gorgias.mdx
- - page: Hubspot
- slug: tools/hubspot
- path: tools/hubspot.mdx
- - page: Intercom
- slug: tools/intercom
- path: tools/intercom.mdx
- - page: Kommo
- slug: tools/kommo
- path: tools/kommo.mdx
- - page: Pipedrive
- slug: tools/pipedrive
- path: tools/pipedrive.mdx
- - page: Salesforce
- slug: tools/salesforce
- path: tools/salesforce.mdx
- - page: Simplesat
- slug: tools/simplesat
- path: tools/simplesat.mdx
- - page: Zendesk
- slug: tools/zendesk
- path: tools/zendesk.mdx
- - page: Zoho
- slug: tools/zoho
- path: tools/zoho.mdx
- - page: Zoominfo
- slug: tools/zoominfo
- path: tools/zoominfo.mdx
- - section: Analytics & Data
- skip-slug: true
- contents:
- - page: Amplitude
- slug: tools/amplitude
- path: tools/amplitude.mdx
- - page: Browseai
- slug: tools/browseai
- path: tools/browseai.mdx
- - page: Exa
- slug: tools/exa
- path: tools/exa.mdx
- - page: Firecrawl
- slug: tools/firecrawl
- path: tools/firecrawl.mdx
- - page: Fireflies
- slug: tools/fireflies
- path: tools/fireflies.mdx
- - page: Googlebigquery
- slug: tools/googlebigquery
- path: tools/googlebigquery.mdx
- - page: Kibana
- slug: tools/kibana
- path: tools/kibana.mdx
- - page: Microsoft Clarity
- slug: tools/microsoft_clarity
- path: tools/microsoft_clarity.mdx
- - page: Mixpanel
- slug: tools/mixpanel
- path: tools/mixpanel.mdx
- - page: Peopledatalabs
- slug: tools/peopledatalabs
- path: tools/peopledatalabs.mdx
- - page: Placekey
- slug: tools/placekey
- path: tools/placekey.mdx
- - page: Posthog
- slug: tools/posthog
- path: tools/posthog.mdx
- - page: Serpapi
- slug: tools/serpapi
- path: tools/serpapi.mdx
- - page: Servicenow
- slug: tools/servicenow
- path: tools/servicenow.mdx
- - page: Snowflake
- slug: tools/snowflake
- path: tools/snowflake.mdx
- - page: Tavily
- slug: tools/tavily
- path: tools/tavily.mdx
- - section: Collaboration & Communication
- skip-slug: true
- contents:
- - page: Chatwork
- slug: tools/chatwork
- path: tools/chatwork.mdx
- - page: Dailybot
- slug: tools/dailybot
- path: tools/dailybot.mdx
- - page: Dialpad
- slug: tools/dialpad
- path: tools/dialpad.mdx
- - page: Discordbot
- slug: tools/discordbot
- path: tools/discordbot.mdx
- - page: Echtpost
- slug: tools/echtpost
- path: tools/echtpost.mdx
- - page: Googlemeet
- slug: tools/googlemeet
- path: tools/googlemeet.mdx
- - page: Microsoft Teams
- slug: tools/microsoft_teams
- path: tools/microsoft_teams.mdx
- - page: Outlook
- slug: tools/outlook
- path: tools/outlook.mdx
- - page: Retellai
- slug: tools/retellai
- path: tools/retellai.mdx
- - page: Share Point
- slug: tools/share_point
- path: tools/share_point.mdx
- - page: Slackbot
- slug: tools/slackbot
- path: tools/slackbot.mdx
- - page: Zoom
- slug: tools/zoom
- path: tools/zoom.mdx
- - section: Productivity & Project Management
- skip-slug: true
- contents:
- - page: Airtable
- slug: tools/airtable
- path: tools/airtable.mdx
- - page: Clickup
- slug: tools/clickup
- path: tools/clickup.mdx
- - page: Coda
- slug: tools/coda
- path: tools/coda.mdx
- - page: Googledocs
- slug: tools/googledocs
- path: tools/googledocs.mdx
- - page: Googletasks
- slug: tools/googletasks
- path: tools/googletasks.mdx
- - page: Linear
- slug: tools/linear
- path: tools/linear.mdx
- - page: Linkhut
- slug: tools/linkhut
- path: tools/linkhut.mdx
- - page: Monday
- slug: tools/monday
- path: tools/monday.mdx
- - page: Onepage
- slug: tools/onepage
- path: tools/onepage.mdx
- - page: Shortcut
- slug: tools/shortcut
- path: tools/shortcut.mdx
- - page: Todoist
- slug: tools/todoist
- path: tools/todoist.mdx
- - page: Wrike
- slug: tools/wrike
- path: tools/wrike.mdx
- - section: Developer Tools & Devops
- skip-slug: true
- contents:
- - page: Ably
- slug: tools/ably
- path: tools/ably.mdx
- - page: Baserow
- slug: tools/baserow
- path: tools/baserow.mdx
- - page: Bitbucket
- slug: tools/bitbucket
- path: tools/bitbucket.mdx
- - page: Contentful
- slug: tools/contentful
- path: tools/contentful.mdx
- - page: Datadog
- slug: tools/datadog
- path: tools/datadog.mdx
- - page: Neon
- slug: tools/neon
- path: tools/neon.mdx
- - page: Ngrok
- slug: tools/ngrok
- path: tools/ngrok.mdx
- - page: Pagerduty
- slug: tools/pagerduty
- path: tools/pagerduty.mdx
- - page: Sentry
- slug: tools/sentry
- path: tools/sentry.mdx
- - page: Supabase
- slug: tools/supabase
- path: tools/supabase.mdx
- - page: Zenrows
- slug: tools/zenrows
- path: tools/zenrows.mdx
- - section: Marketing & Social Media
- skip-slug: true
- contents:
- - page: Active Campaign
- slug: tools/active_campaign
- path: tools/active_campaign.mdx
- - page: Ahrefs
- slug: tools/ahrefs
- path: tools/ahrefs.mdx
- - page: Amcards
- slug: tools/amcards
- path: tools/amcards.mdx
- - page: Brandfetch
- slug: tools/brandfetch
- path: tools/brandfetch.mdx
- - page: Crustdata
- slug: tools/crustdata
- path: tools/crustdata.mdx
- - page: Klaviyo
- slug: tools/klaviyo
- path: tools/klaviyo.mdx
- - page: Linkedin
- slug: tools/linkedin
- path: tools/linkedin.mdx
- - page: Mailchimp
- slug: tools/mailchimp
- path: tools/mailchimp.mdx
- - page: Reddit
- slug: tools/reddit
- path: tools/reddit.mdx
- - page: Sendgrid
- slug: tools/sendgrid
- path: tools/sendgrid.mdx
- - page: Twitter Media
- slug: tools/twitter_media
- path: tools/twitter_media.mdx
- - section: Ai & Machine Learning
- skip-slug: true
- contents:
- - page: Humanloop
- slug: tools/humanloop
- path: tools/humanloop.mdx
- - page: Lmnt
- slug: tools/lmnt
- path: tools/lmnt.mdx
- - page: Mem0
- slug: tools/mem0
- path: tools/mem0.mdx
- - page: Perplexityai
- slug: tools/perplexityai
- path: tools/perplexityai.mdx
- - page: Semanticscholar
- slug: tools/semanticscholar
- path: tools/semanticscholar.mdx
- - page: Textrazor
- slug: tools/textrazor
- path: tools/textrazor.mdx
- - page: Typefully
- slug: tools/typefully
- path: tools/typefully.mdx
- - section: Document & File Management
- skip-slug: true
- contents:
- - page: Docusign
- slug: tools/docusign
- path: tools/docusign.mdx
- - page: Dropbox
- slug: tools/dropbox
- path: tools/dropbox.mdx
- - page: Googledrive
- slug: tools/googledrive
- path: tools/googledrive.mdx
- - page: Googlephotos
- slug: tools/googlephotos
- path: tools/googlephotos.mdx
- - page: Googlesuper
- slug: tools/googlesuper
- path: tools/googlesuper.mdx
- - page: One Drive
- slug: tools/one_drive
- path: tools/one_drive.mdx
- - page: Pandadoc
- slug: tools/pandadoc
- path: tools/pandadoc.mdx
- - section: Other / Miscellaneous
- skip-slug: true
- contents:
- - page: Browserbase Tool
- slug: tools/browserbase_tool
- path: tools/browserbase_tool.mdx
- - page: Foursquare
- slug: tools/foursquare
- path: tools/foursquare.mdx
- - page: Google Maps
- slug: tools/google_maps
- path: tools/google_maps.mdx
- - page: Linkup
- slug: tools/linkup
- path: tools/linkup.mdx
- - page: More Trees
- slug: tools/more_trees
- path: tools/more_trees.mdx
- - page: Tinyurl
- slug: tools/tinyurl
- path: tools/tinyurl.mdx
- - page: Yousearch
- slug: tools/yousearch
- path: tools/yousearch.mdx
- - section: Productivity
- skip-slug: true
- contents:
- - page: Asana
- slug: tools/asana
- path: tools/asana.mdx
- - page: Bolna
- slug: tools/bolna
- path: tools/bolna.mdx
- - page: Jira
- slug: tools/jira
- path: tools/jira.mdx
- - page: Slack
- slug: tools/slack
- path: tools/slack.mdx
- - page: Trello
- slug: tools/trello
- path: tools/trello.mdx
- - section: Finance & Accounting
- skip-slug: true
- contents:
- - page: Flutterwave
- slug: tools/flutterwave
- path: tools/flutterwave.mdx
- - page: Quickbooks
- slug: tools/quickbooks
- path: tools/quickbooks.mdx
- - page: Ramp
- slug: tools/ramp
- path: tools/ramp.mdx
- - page: Recallai
- slug: tools/recallai
- path: tools/recallai.mdx
- section: Scheduling & Booking
skip-slug: true
contents:
- - page: Apaleo
- slug: tools/apaleo
- path: tools/apaleo.mdx
- - page: Cal
- slug: tools/cal
- path: tools/cal.mdx
- - page: Calendly
- slug: tools/calendly
- path: tools/calendly.mdx
- page: Googlecalendar
slug: tools/googlecalendar
path: tools/googlecalendar.mdx
- - section: Workflow Automation
- skip-slug: true
- contents:
- - page: Bannerbear
- slug: tools/bannerbear
- path: tools/bannerbear.mdx
- - page: Formsite
- slug: tools/formsite
- path: tools/formsite.mdx
- - page: Process Street
- slug: tools/process_street
- path: tools/process_street.mdx
- - page: Workiom
- slug: tools/workiom
- path: tools/workiom.mdx
- - section: Design & Creative Tools
- skip-slug: true
- contents:
- - page: Canva
- slug: tools/canva
- path: tools/canva.mdx
- - page: Figma
- slug: tools/figma
- path: tools/figma.mdx
- - page: Webflow
- slug: tools/webflow
- path: tools/webflow.mdx
- - section: Email Marketing
- skip-slug: true
- contents:
- - page: Bigmailer
- slug: tools/bigmailer
- path: tools/bigmailer.mdx
- - page: Brevo
- slug: tools/brevo
- path: tools/brevo.mdx
- - page: Emailoctopus
- slug: tools/emailoctopus
- path: tools/emailoctopus.mdx
- - section: Collaboration
- skip-slug: true
- contents:
- - page: Confluence
- slug: tools/confluence
- path: tools/confluence.mdx
- - page: Gong
- slug: tools/gong
- path: tools/gong.mdx
- - section: Education & Lms
- skip-slug: true
- contents:
- - page: Canvas
- slug: tools/canvas
- path: tools/canvas.mdx
- - page: D2Lbrightspace
- slug: tools/d2lbrightspace
- path: tools/d2lbrightspace.mdx
- - section: Finance
- skip-slug: true
- contents:
- - page: Altoviz
- slug: tools/altoviz
- path: tools/altoviz.mdx
- - page: Finage
- slug: tools/finage
- path: tools/finage.mdx
- - section: Time Tracking
- skip-slug: true
- contents:
- - page: Clockify
- slug: tools/clockify
- path: tools/clockify.mdx
- - page: Timecamp
- slug: tools/timecamp
- path: tools/timecamp.mdx
- - section: Web Scraping
- skip-slug: true
- contents:
- - page: Scrape Do
- slug: tools/scrape_do
- path: tools/scrape_do.mdx
- - page: Scrapingant
- slug: tools/scrapingant
- path: tools/scrapingant.mdx
- - section: Accounting
- skip-slug: true
- contents:
- - page: Bill
- slug: tools/bill
- path: tools/bill.mdx
- - section: Advertising & Marketing
- skip-slug: true
- contents:
- - page: Googleads
- slug: tools/googleads
- path: tools/googleads.mdx
- - section: Ai Video
- skip-slug: true
- contents:
- - page: Heygen
- slug: tools/heygen
- path: tools/heygen.mdx
- - section: Api
- skip-slug: true
- contents:
- - page: Screenshotone
- slug: tools/screenshotone
- path: tools/screenshotone.mdx
- - section: Blockchain
- skip-slug: true
- contents:
- - page: Alchemy
- slug: tools/alchemy
- path: tools/alchemy.mdx
- - section: Browser Automation
- skip-slug: true
- contents:
- - page: Browserless
- slug: tools/browserless
- path: tools/browserless.mdx
- - section: Business Intelligence
- skip-slug: true
- contents:
- - page: Klipfolio
- slug: tools/klipfolio
- path: tools/klipfolio.mdx
- - section: Communication
- skip-slug: true
- contents:
- - page: Whatsapp
- slug: tools/whatsapp
- path: tools/whatsapp.mdx
- - section: Compliance
- skip-slug: true
- contents:
- - page: Tpscheck
- slug: tools/tpscheck
- path: tools/tpscheck.mdx
- - section: Cryptocurrency
- skip-slug: true
- contents:
- - page: Coinbase
- slug: tools/coinbase
- path: tools/coinbase.mdx
- - section: Data & Analytics
- skip-slug: true
- contents:
- - page: Excel
- slug: tools/excel
- path: tools/excel.mdx
- - section: Data Services
- skip-slug: true
- contents:
- - page: Enigma
- slug: tools/enigma
- path: tools/enigma.mdx
- - section: Database Management
- skip-slug: true
- contents:
- - page: Ragic
- slug: tools/ragic
- path: tools/ragic.mdx
- - section: Dev Tools
- skip-slug: true
- contents:
- - page: Gitlab
- slug: tools/gitlab
- path: tools/gitlab.mdx
- - section: E Commerce
- skip-slug: true
- contents:
- - page: Junglescout
- slug: tools/junglescout
- path: tools/junglescout.mdx
- - section: Ed
- skip-slug: true
- contents:
- - page: Blackboard
- slug: tools/blackboard
- path: tools/blackboard.mdx
- - section: Email
- skip-slug: true
- contents:
- - page: Resend
- slug: tools/resend
- path: tools/resend.mdx
- - section: Entertainment & Media
- skip-slug: true
- contents:
- - page: Youtube
- slug: tools/youtube
- path: tools/youtube.mdx
- - section: Erp
- skip-slug: true
- contents:
- - page: Bamboohr
- slug: tools/bamboohr
- path: tools/bamboohr.mdx
- - section: Financial Data
- skip-slug: true
- contents:
- - page: Nasdaq Data Link Time Series And Table Data
- slug: tools/nasdaq_data_link_time_series_and_table_data
- path: tools/nasdaq_data_link_time_series_and_table_data.mdx
- - section: Form Backend
- skip-slug: true
- contents:
- - page: Formcarry
- slug: tools/formcarry
- path: tools/formcarry.mdx
- - section: Gaming
- skip-slug: true
- contents:
- - page: Discord
- slug: tools/discord
- path: tools/discord.mdx
- - section: Incident Management
- skip-slug: true
- contents:
- - page: Rootly
- slug: tools/rootly
- path: tools/rootly.mdx
- - section: Internet Security
- skip-slug: true
- contents:
- - page: Nextdns
- slug: tools/nextdns
- path: tools/nextdns.mdx
- - section: Knowledge Base
- skip-slug: true
- contents:
- - page: Box
- slug: tools/box
- path: tools/box.mdx
- - section: Lead Generation
- skip-slug: true
- contents:
- - page: Leadfeeder
- slug: tools/leadfeeder
- path: tools/leadfeeder.mdx
- - section: Maintenance Management
- skip-slug: true
- contents:
- - page: Maintainx
- slug: tools/maintainx
- path: tools/maintainx.mdx
- - section: Marketing
- skip-slug: true
- contents:
- - page: Fomo
- slug: tools/fomo
- path: tools/fomo.mdx
- - section: Natural Language Processing
- skip-slug: true
- contents:
- - page: Rosette Text Analytics
- slug: tools/rosette_text_analytics
- path: tools/rosette_text_analytics.mdx
- - section: Networking
- skip-slug: true
- contents:
- - page: Cloudflare
- slug: tools/cloudflare
- path: tools/cloudflare.mdx
- - section: Nft
- skip-slug: true
- contents:
- - page: Open Sea
- slug: tools/open_sea
- path: tools/open_sea.mdx
- - section: Photography
- skip-slug: true
- contents:
- - page: Smugmug
- slug: tools/smugmug
- path: tools/smugmug.mdx
- - section: Podcast
- skip-slug: true
- contents:
- - page: Listennotes
- slug: tools/listennotes
- path: tools/listennotes.mdx
- - section: Project Management
- skip-slug: true
- contents:
- - page: Rocketlane
- slug: tools/rocketlane
- path: tools/rocketlane.mdx
- - section: Sales
- skip-slug: true
- contents:
- - page: Leadoku
- slug: tools/leadoku
- path: tools/leadoku.mdx
- - section: Security & Compliance
- skip-slug: true
- contents:
- - page: Borneo
- slug: tools/borneo
- path: tools/borneo.mdx
- - section: Seo
- skip-slug: true
- contents:
- - page: Semrush
- slug: tools/semrush
- path: tools/semrush.mdx
- - section: Social Media
- skip-slug: true
- contents:
- - page: Metaads
- slug: tools/metaads
- path: tools/metaads.mdx
- - section: Testing
- skip-slug: true
- contents:
- - page: Bugbug
- slug: tools/bugbug
- path: tools/bugbug.mdx
- - section: Url Shortening
- skip-slug: true
- contents:
- - page: Cutt Ly
- slug: tools/cutt_ly
- path: tools/cutt_ly.mdx
- - section: Vacation Rental Software
- skip-slug: true
- contents:
- - page: Lodgify
- slug: tools/lodgify
- path: tools/lodgify.mdx
- - section: Voice
- skip-slug: true
- contents:
- - page: Elevenlabs
- slug: tools/elevenlabs
- path: tools/elevenlabs.mdx
- - section: Web3 Development
- skip-slug: true
- contents:
- - page: Starton
- slug: tools/starton
- path: tools/starton.mdx
- - section: Website Builders
- skip-slug: true
- contents:
- - page: Brilliant Directories
- slug: tools/brilliant_directories
- path: tools/brilliant_directories.mdx
- - section: Proxy Apps
- skip-slug: true
- contents:
- - page: Accelo
- slug: tools/accelo
- path: tools/accelo.mdx
- - page: Adobe
- slug: tools/adobe
- path: tools/adobe.mdx
- - page: Aero Workflow
- slug: tools/aero_workflow
- path: tools/aero_workflow.mdx
- - page: Amazon
- slug: tools/amazon
- path: tools/amazon.mdx
- - page: Appdrag
- slug: tools/appdrag
- path: tools/appdrag.mdx
- - page: Appsflyer
- slug: tools/appsflyer
- path: tools/appsflyer.mdx
- - page: Ashby
- slug: tools/ashby
- path: tools/ashby.mdx
- - page: Atlassian
- slug: tools/atlassian
- path: tools/atlassian.mdx
- - page: Auth0
- slug: tools/auth0
- path: tools/auth0.mdx
- - page: Axonaut
- slug: tools/axonaut
- path: tools/axonaut.mdx
- - page: Battlenet
- slug: tools/battlenet
- path: tools/battlenet.mdx
- - page: Beeminder
- slug: tools/beeminder
- path: tools/beeminder.mdx
- - page: Bitwarden
- slug: tools/bitwarden
- path: tools/bitwarden.mdx
- - page: Blackbaud
- slug: tools/blackbaud
- path: tools/blackbaud.mdx
- - page: Boldsign
- slug: tools/boldsign
- path: tools/boldsign.mdx
- - page: Botbaba
- slug: tools/botbaba
- path: tools/botbaba.mdx
- - page: Braintree
- slug: tools/braintree
- path: tools/braintree.mdx
- - page: Breezy Hr
- slug: tools/breezy_hr
- path: tools/breezy_hr.mdx
- - page: Brex
- slug: tools/brex
- path: tools/brex.mdx
- - page: Brex Staging
- slug: tools/brex_staging
- path: tools/brex_staging.mdx
- - page: Brightpearl
- slug: tools/brightpearl
- path: tools/brightpearl.mdx
- - page: Browserhub
- slug: tools/browserhub
- path: tools/browserhub.mdx
- - page: Bubble
- slug: tools/bubble
- path: tools/bubble.mdx
- - page: Chmeetings
- slug: tools/chmeetings
- path: tools/chmeetings.mdx
- - page: Coinmarketcal
- slug: tools/coinmarketcal
- path: tools/coinmarketcal.mdx
- - page: Customer Io
- slug: tools/customer_io
- path: tools/customer_io.mdx
- - page: Datagma
- slug: tools/datagma
- path: tools/datagma.mdx
- - page: Datarobot
- slug: tools/datarobot
- path: tools/datarobot.mdx
- - page: Deel
- slug: tools/deel
- path: tools/deel.mdx
- - page: Demio
- slug: tools/demio
- path: tools/demio.mdx
- - page: Digicert
- slug: tools/digicert
- path: tools/digicert.mdx
- - page: Docmosis
- slug: tools/docmosis
- path: tools/docmosis.mdx
- - page: Dropbox Sign
- slug: tools/dropbox_sign
- path: tools/dropbox_sign.mdx
- - page: Epic Games
- slug: tools/epic_games
- path: tools/epic_games.mdx
- - page: Eventbrite
- slug: tools/eventbrite
- path: tools/eventbrite.mdx
- - page: Exist
- slug: tools/exist
- path: tools/exist.mdx
- - page: Facebook
- slug: tools/facebook
- path: tools/facebook.mdx
- - page: Factorial
- slug: tools/factorial
- path: tools/factorial.mdx
- - page: Fitbit
- slug: tools/fitbit
- path: tools/fitbit.mdx
- - page: Freshbooks
- slug: tools/freshbooks
- path: tools/freshbooks.mdx
- - page: Front
- slug: tools/front
- path: tools/front.mdx
- - page: Go To Webinar
- slug: tools/go_to_webinar
- path: tools/go_to_webinar.mdx
- - page: Google Analytics
- slug: tools/google_analytics
- path: tools/google_analytics.mdx
- - page: Googleslides
- slug: tools/googleslides
- path: tools/googleslides.mdx
- - page: Gumroad
- slug: tools/gumroad
- path: tools/gumroad.mdx
- - page: Guru
- slug: tools/guru
- path: tools/guru.mdx
- - page: Hackerrank Work
- slug: tools/hackerrank_work
- path: tools/hackerrank_work.mdx
- - page: Harvest
- slug: tools/harvest
- path: tools/harvest.mdx
- - page: Helcim
- slug: tools/helcim
- path: tools/helcim.mdx
- - page: Highlevel
- slug: tools/highlevel
- path: tools/highlevel.mdx
- - page: Icims Talent Cloud
- slug: tools/icims_talent_cloud
- path: tools/icims_talent_cloud.mdx
- - page: Idea Scale
- slug: tools/idea_scale
- path: tools/idea_scale.mdx
- - page: Interzoid
- slug: tools/interzoid
- path: tools/interzoid.mdx
- - page: Keap
- slug: tools/keap
- path: tools/keap.mdx
- - page: Lastpass
- slug: tools/lastpass
- path: tools/lastpass.mdx
- - page: Launch Darkly
- slug: tools/launch_darkly
- path: tools/launch_darkly.mdx
- - page: Lever
- slug: tools/lever
- path: tools/lever.mdx
- - page: Lever Sandbox
- slug: tools/lever_sandbox
- path: tools/lever_sandbox.mdx
- - page: Lexoffice
- slug: tools/lexoffice
- path: tools/lexoffice.mdx
- - page: Mailerlite
- slug: tools/mailerlite
- path: tools/mailerlite.mdx
- - page: Mboum
- slug: tools/mboum
- path: tools/mboum.mdx
- - page: Metatextai
- slug: tools/metatextai
- path: tools/metatextai.mdx
- - page: Microsoft Tenant
- slug: tools/microsoft_tenant
- path: tools/microsoft_tenant.mdx
- - page: Miro
- slug: tools/miro
- path: tools/miro.mdx
- - page: Mocean
- slug: tools/mocean
- path: tools/mocean.mdx
- - page: Mopinion
- slug: tools/mopinion
- path: tools/mopinion.mdx
- - page: Moxie
- slug: tools/moxie
- path: tools/moxie.mdx
- - page: Moz
- slug: tools/moz
- path: tools/moz.mdx
- - page: Mural
- slug: tools/mural
- path: tools/mural.mdx
- - page: Ncscale
- slug: tools/ncscale
- path: tools/ncscale.mdx
- - page: Netsuite
- slug: tools/netsuite
- path: tools/netsuite.mdx
- - page: Oncehub
- slug: tools/oncehub
- path: tools/oncehub.mdx
- - page: Piggy
- slug: tools/piggy
- path: tools/piggy.mdx
- - page: Precoro
- slug: tools/precoro
- path: tools/precoro.mdx
- - page: Printnode
- slug: tools/printnode
- path: tools/printnode.mdx
- - page: Productboard
- slug: tools/productboard
- path: tools/productboard.mdx
- - page: Qualaroo
- slug: tools/qualaroo
- path: tools/qualaroo.mdx
- - page: Rafflys
- slug: tools/rafflys
- path: tools/rafflys.mdx
- - page: Ravenseotools
- slug: tools/ravenseotools
- path: tools/ravenseotools.mdx
- - page: Ring Central
- slug: tools/ring_central
- path: tools/ring_central.mdx
- - page: Rippling
- slug: tools/rippling
- path: tools/rippling.mdx
- - page: Rocket Reach
- slug: tools/rocket_reach
- path: tools/rocket_reach.mdx
- - page: Sage
- slug: tools/sage
- path: tools/sage.mdx
- - page: Seismic
- slug: tools/seismic
- path: tools/seismic.mdx
- - page: Servicem8
- slug: tools/servicem8
- path: tools/servicem8.mdx
- - page: Smartrecruiters
- slug: tools/smartrecruiters
- path: tools/smartrecruiters.mdx
- - page: Square
- slug: tools/square
- path: tools/square.mdx
- - page: Stack Exchange
- slug: tools/stack_exchange
- path: tools/stack_exchange.mdx
- - page: Survey Monkey
- slug: tools/survey_monkey
- path: tools/survey_monkey.mdx
- - page: Tapform
- slug: tools/tapform
- path: tools/tapform.mdx
- - page: Terminus
- slug: tools/terminus
- path: tools/terminus.mdx
- - page: Timekit
- slug: tools/timekit
- path: tools/timekit.mdx
- - page: Timely
- slug: tools/timely
- path: tools/timely.mdx
- - page: Tinypng
- slug: tools/tinypng
- path: tools/tinypng.mdx
- - page: Tisane
- slug: tools/tisane
- path: tools/tisane.mdx
- - page: Toneden
- slug: tools/toneden
- path: tools/toneden.mdx
- - page: Twitch
- slug: tools/twitch
- path: tools/twitch.mdx
- - page: Venly
- slug: tools/venly
- path: tools/venly.mdx
- - page: Vero
- slug: tools/vero
- path: tools/vero.mdx
- - page: Visme
- slug: tools/visme
- path: tools/visme.mdx
- - page: Waboxapp
- slug: tools/waboxapp
- path: tools/waboxapp.mdx
- - page: Wakatime
- slug: tools/wakatime
- path: tools/wakatime.mdx
- - page: Wave Accounting
- slug: tools/wave_accounting
- path: tools/wave_accounting.mdx
- - page: Webex
- slug: tools/webex
- path: tools/webex.mdx
- - page: Wiz
- slug: tools/wiz
- path: tools/wiz.mdx
- - page: Xero
- slug: tools/xero
- path: tools/xero.mdx
- - page: Yandex
- slug: tools/yandex
- path: tools/yandex.mdx
- - page: Ynab
- slug: tools/ynab
- path: tools/ynab.mdx
- - page: Zenserp
- slug: tools/zenserp
- path: tools/zenserp.mdx
- - page: Zoho Bigin
- slug: tools/zoho_bigin
- path: tools/zoho_bigin.mdx
- - page: Zoho Books
- slug: tools/zoho_books
- path: tools/zoho_books.mdx
- - page: Zoho Desk
- slug: tools/zoho_desk
- path: tools/zoho_desk.mdx
- - page: Zoho Inventory
- slug: tools/zoho_inventory
- path: tools/zoho_inventory.mdx
- - page: Zoho Invoice
- slug: tools/zoho_invoice
- path: tools/zoho_invoice.mdx
- - page: Zoho Mail
- slug: tools/zoho_mail
- path: tools/zoho_mail.mdx
- section: No Auth
skip-slug: true
contents:
- - page: Codeinterpreter
- slug: tools/codeinterpreter
- path: tools/codeinterpreter.mdx
- page: Composio
slug: tools/composio
path: tools/composio.mdx
- - page: Composio Search
- slug: tools/composio_search
- path: tools/composio_search.mdx
- - page: Entelligence
- slug: tools/entelligence
- path: tools/entelligence.mdx
- - page: Hackernews
- slug: tools/hackernews
- path: tools/hackernews.mdx
- - page: Text To Pdf
- slug: tools/text_to_pdf
- path: tools/text_to_pdf.mdx
- - page: Weathermap
- slug: tools/weathermap
- path: tools/weathermap.mdx
- tab: sdk-reference
layout:
- section: Python
diff --git a/fern/fern.config.json b/fern/fern.config.json
index c01a72ba1..42bebfe95 100644
--- a/fern/fern.config.json
+++ b/fern/fern.config.json
@@ -1,4 +1,4 @@
{
"organization": "composio",
- "version": "0.64.14"
+ "version": "0.60.0"
}
\ No newline at end of file
diff --git a/fern/pages/src/examples/gmail-filterer.mdx b/fern/pages/src/examples/gmail-filterer.mdx
index e69de29bb..8f2e13f54 100644
--- a/fern/pages/src/examples/gmail-filterer.mdx
+++ b/fern/pages/src/examples/gmail-filterer.mdx
@@ -0,0 +1,178 @@
+---
+title: AI Gmail Labeller
+subtitle: "A Python app that uses your custom LLM prompt to label your Gmail!"
+image: "https://og.composio.dev/api/og?title=Full%20Stack%20Chat%20App" # image for socials
+keywords: ''
+hide-nav-links: false
+---
+Imagine having an AI assistant that automatically organizes your Gmail inbox by intelligently labeling incoming emails. That's exactly what we'll build in this tutorial.
+
+<Frame>
+ <img src="https://camo.githubusercontent.com/29b105fdcc2e005d8dd76bab0af33081a0567637da1061da6e1664285b843f8d/68747470733a2f2f692e696d6775722e636f6d2f515646337956582e676966" alt="Gmail Labeller" />
+</Frame>
+
+The complete app is available in our [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository. The app has a frontend built with Next.js along with Supabase for authentication.
+
+<Card
+ title="GitHub Repository"
+ href="https://github.com/ComposioHQ/filter-gmails-example"
+ icon="fa-brands fa-github"
+>
+ Explore the complete source code on GitHub
+</Card>
+
+In this guide, we'll focus on the Composio + OpenAI Agents part of the app
+
+## Prerequisites
+- Clone the [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository and set the project up locally.
+- Get a Composio API key. You can get one [here](https://app.composio.dev/developers).
+
+
+## Creating Triggers for users
+[Triggers](/docs/using-triggers) are a way to listen for events from apps. They act as a notification system for your AI applications, enabling your agents to respond dynamically to external events occurring within your apps.
+
+In some cases, triggers require certain configuration to set the correct events. You can inspect and add these properties while enabling the triggers.
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L135-L156"
+ language="python"
+ title="apps/backend/email_processor.py"
+ highlightStart={18}
+ highlightEnd={22}
+/>
+
+Then the trigger can be created with the following code:
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L163-L169"
+ language="python"
+ title="apps/backend/email_processor.py"
+/>
+
+
+## Listening for a trigger event
+<Callout type="info">
+For local development, you can use [ngrok](https://ngrok.com/) to expose your local server to the internet.
+
+```bash
+ngrok http 8000
+```
+
+Then you can set the ngrok URL in the trigger configuration.
+<Frame>
+ <img src="../../../assets/images/examples/trigger-config.png" alt="Trigger configuration" />
+</Frame>
+</Callout>
+
+This is the main webhook endpoint for processing Gmail new message events.
+
+Composio sends a POST request to the webhook endpoint `/composio/webhook` that contains the event data.
+
+It is parsed and then the labelling method `process_gmail_message` is called through a FastAPI Background task.
+
+```python apps/backend/main.py {1-5, 29-33} maxLines=33
[email protected]("/composio/webhook")
+async def listen_webhooks(
+ request: Request,
+ background_tasks: BackgroundTasks
+):
+ """
+ Main webhook endpoint for processing Gmail
+ new message events. This is the core webhook
+ labeling functionality.
+ """
+ # Verify webhook signature
+ # Check if this is a Gmail new message event
+ if (
+ webhook_data.get("type") == "gmail_new_message"
+ or "gmail" in webhook_data.get("type", "").lower()
+ ):
+ gmail_message = GmailMessage.from_composio_payload(
+ webhook_data
+ )
+ # Get the user's custom prompt or use default
+ default_prompt = (
+ initial_prompt or "Default email processing prompt"
+ )
+ user_prompt = get_user_prompt(
+ gmail_message.user_id, default_prompt
+ )
+
+ # Add email processing to background tasks
+ background_tasks.add_task(
+ process_gmail_message,
+ gmail_message,
+ user_prompt
+ )
+
+ logger.info(
+ f"Queued email {gmail_message.id} for processing"
+ )
+ return {"status": "received", "webhook_id": webhook_id}
+```
+
+## Processing the mail using OpenAI Agents SDK
+The `process_gmail_message` method is responsible for processing the email using the OpenAI Agents SDK.
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L14-L24"
+ language="python"
+ title="apps/backend/email_processor.py"
+/>
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L42-L45"
+ language="python"
+ title="apps/backend/email_processor.py"
+/>
+
+We read the first 10k characters of the email body to pass it to the agent. This is done to not overwhelm or surpass the token limits in case of really long emails.
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L50-L60"
+ language="python"
+ title="apps/backend/email_processor.py"
+/>
+
+`user_filter` is the user's custom prompt from the database. We pass it to the agent along with the email body.
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/email_processor.py#L68-L85"
+ language="python"
+ title="apps/backend/email_processor.py"
+/>
+
+You can view the agent trace in OpenAI's [Traces Dashboard](https://platform.openai.com/traces/).
+
+<Frame>
+ <img src="../../../assets/images/examples/gmail-agent-trace.png" alt="Gmail Agent Trace" />
+</Frame>
+
+## Securing the webhooks!
+It is important to validate the webhook signature to ensure the request is coming from Composio.
+
+Generate and store the webhook signature in the environment variables.
+
+<Frame>
+ <img src="../../../assets/images/examples/webhook-secret.png" alt="Webhook Secret" />
+</Frame>
+
+The webhook signature is validated in the `verify_webhook_signature` function.
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/webhook.py#L10-L56"
+ language="python"
+ title="apps/backend/webhook.py"
+/>
+
+In the `/composio/webhook` endpoint, we verify the webhook signature and then parse the request body. If the signature is invalid, we return a 401 status code.
+
+<SnippetCode
+ githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/main.py#L31-L38"
+ language="python"
+ title="apps/backend/main.py"
+/>
+
+## Inspiration
+This example was inspired by an X/Twitter post by [@FarzaTV](https://x.com/FarzaTV/status/1905371012369350857).
+
+We encourage you to check out the [full app](https://github.com/ComposioHQ/filter-gmails-example), fork it, build it and make it your own! Reach out to [[email protected]](mailto:[email protected]) for free credits ;)
diff --git a/fern/scripts/build-snippets.ts b/fern/scripts/build-snippets.ts
index 03a0aeb9f..7e0cb113e 100644
--- a/fern/scripts/build-snippets.ts
+++ b/fern/scripts/build-snippets.ts
@@ -9,8 +9,27 @@ const DOCS_SRC_DIR = path.join(import.meta.dir, '../pages/src');
const PAGES_DIST_DIR = path.join(import.meta.dir, '../pages/dist');
const PROJECT_ROOT = path.join(import.meta.dir, '../..');
+// Custom error class for SnippetCode errors
+class SnippetCodeError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'SnippetCodeError';
+ }
+}
+
+// Type for parsed GitHub URL
+interface ParsedGitHubUrl {
+ owner: string;
+ repo: string;
+ branch: string;
+ filePath: string;
+ startLine?: number;
+ endLine?: number;
+}
+
interface SnippetCodeProps {
- src: string;
+ src?: string;
+ githubUrl?: string;
startLine?: number;
endLine?: number;
highlightStart?: number;
@@ -23,6 +42,99 @@ interface SnippetCodeProps {
path?: string;
}
+// Parse GitHub URL and extract components
+function parseGitHubUrl(url: string): ParsedGitHubUrl {
+ try {
+ // Validate URL format
+ const githubRegex = /^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.+?)(?:#L(\d+)(?:-L(\d+))?)?$/;
+ const match = url.match(githubRegex);
+
+ if (!match) {
+ throw new SnippetCodeError(
+ `Invalid GitHub URL format. Expected: https://github.com/owner/repo/blob/branch/path/to/file.ext#L1-L10\nReceived: ${url}`
+ );
+ }
+
+ const [, owner, repo, branch, filePath, startLineStr, endLineStr] = match;
+
+ return {
+ owner,
+ repo,
+ branch,
+ filePath,
+ startLine: startLineStr ? parseInt(startLineStr, 10) : undefined,
+ endLine: endLineStr ? parseInt(endLineStr, 10) : startLineStr ? parseInt(startLineStr, 10) : undefined
+ };
+ } catch (error) {
+ if (error instanceof SnippetCodeError) {
+ throw error;
+ }
+ throw new SnippetCodeError(`Failed to parse GitHub URL: ${error.message}`);
+ }
+}
+
+// Cache for GitHub content to avoid repeated fetches
+const githubContentCache = new Map<string, { content?: string; error?: string }>();
+
+// Fetch content from GitHub with error handling
+async function fetchGitHubContent(parsedUrl: ParsedGitHubUrl): Promise<{ content?: string; error?: string }> {
+ const cacheKey = `${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
+
+ // Check cache first
+ if (githubContentCache.has(cacheKey)) {
+ return githubContentCache.get(cacheKey)!;
+ }
+
+ try {
+ const rawUrl = `https://raw.githubusercontent.com/${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
+
+ // Create abort controller for timeout
+ const controller = new AbortController();
+ const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
+
+ const response = await fetch(rawUrl, { signal: controller.signal });
+ clearTimeout(timeoutId);
+
+ if (!response.ok) {
+ let error: string;
+ if (response.status === 404) {
+ error = `File not found: ${parsedUrl.filePath} in ${parsedUrl.owner}/${parsedUrl.repo}@${parsedUrl.branch}`;
+ } else {
+ error = `GitHub API error: ${response.status} ${response.statusText}`;
+ }
+ const result = { error };
+ githubContentCache.set(cacheKey, result);
+ return result;
+ }
+
+ const content = await response.text();
+ const result = { content };
+ githubContentCache.set(cacheKey, result);
+ return result;
+ } catch (error: any) {
+ let errorMessage: string;
+ if (error.name === 'AbortError') {
+ errorMessage = `Timeout fetching from GitHub: ${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.filePath}`;
+ } else if (error.message.includes('fetch')) {
+ errorMessage = `Network error fetching from GitHub: ${error.message}`;
+ } else {
+ errorMessage = `Error fetching from GitHub: ${error.message}`;
+ }
+ const result = { error: errorMessage };
+ githubContentCache.set(cacheKey, result);
+ return result;
+ }
+}
+
+// Extract lines from content
+function extractLinesFromContent(content: string, startLine?: number, endLine?: number): string {
+ const lines = content.split('\n');
+ const start = startLine ? startLine - 1 : 0;
+ const end = endLine ? endLine : Math.min(lines.length, 100); // Default to first 100 lines
+
+ return lines.slice(start, end).join('\n');
+}
+
function ensureDistDir() {
// Remove existing dist directory to ensure clean build
@@ -108,16 +220,29 @@ function generateHighlightString(
return `{${relativeStart}-${relativeEnd}}`;
}
-function parseSnippetCodeTags(content: string, contextDir: string): string {
+async function parseSnippetCodeTags(content: string, contextDir: string): Promise<string> {
const exampleCodeRegex = /<SnippetCode\s+([^>]*?)(?:\s*\/?>|>\s*<\/SnippetCode>)/g;
-
- return content.replace(exampleCodeRegex, (match, propsString) => {
+ const matches: Array<{ match: string; propsString: string }> = [];
+
+ let match;
+ while ((match = exampleCodeRegex.exec(content)) !== null) {
+ matches.push({ match: match[0], propsString: match[1] });
+ }
+
+ let result = content;
+
+ for (const { match, propsString } of matches) {
+ const replacement = await (async () => {
// Parse props from the tag
const props: Partial<SnippetCodeProps> = {};
// Extract src
const srcMatch = propsString.match(/src=["']([^"']+)["']/);
if (srcMatch) props.src = srcMatch[1];
+
+ // Extract githubUrl
+ const githubUrlMatch = propsString.match(/githubUrl=["']([^"']+)["']/);
+ if (githubUrlMatch) props.githubUrl = githubUrlMatch[1];
// Extract other numeric props (handle both JSX {1} and quoted "1" syntax)
const startLineMatch = propsString.match(/startLine=(?:["'](\d+)["']|{(\d+)})/);
@@ -169,14 +294,49 @@ function parseSnippetCodeTags(content: string, contextDir: string): string {
props.wordWrap = true;
}
- if (!props.src) {
- console.warn('⚠️ SnippetCode tag missing src attribute:', match);
- return '```\n// Error: SnippetCode tag missing src attribute\n```';
+ // Validate that either src or githubUrl is provided
+ if (!props.src && !props.githubUrl) {
+ const errorMessage = 'SnippetCode tag missing both src and githubUrl attributes';
+ console.warn(`⚠️ ${errorMessage}:`, match);
+ return `\`\`\`error\n${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
}
- // Read the file content
- const codeContent = readFileLines(props.src, contextDir, props.startLine, props.endLine);
- const langInfo = getLanguageFromPath(props.src);
+ let codeContent: string;
+ let filePath: string;
+ let langInfo: { syntax: string; displayName: string };
+
+ try {
+ if (props.githubUrl) {
+ // Handle GitHub URL
+ const parsedUrl = parseGitHubUrl(props.githubUrl);
+
+ // Fetch content from GitHub
+ const fetchResult = await fetchGitHubContent(parsedUrl);
+
+ if (fetchResult.error) {
+ console.error(`❌ SnippetCode Error: ${fetchResult.error}`);
+ return `\`\`\`error\nSnippetCode Error: ${fetchResult.error}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
+ }
+
+ // Extract lines based on URL or manual overrides
+ const startLine = props.startLine || parsedUrl.startLine || 1;
+ const endLine = props.endLine || parsedUrl.endLine || 100;
+
+ codeContent = extractLinesFromContent(fetchResult.content!, startLine, endLine);
+ filePath = parsedUrl.filePath;
+ langInfo = getLanguageFromPath(filePath);
+ } else {
+ // Handle local file
+ codeContent = readFileLines(props.src!, contextDir, props.startLine, props.endLine);
+ filePath = props.src!;
+ langInfo = getLanguageFromPath(filePath);
+ }
+ } catch (error) {
+ const errorMessage = error instanceof SnippetCodeError ? error.message : `Unexpected error: ${error.message}`;
+ console.error(`❌ SnippetCode Error: ${errorMessage}`);
+ return `\`\`\`error\nSnippetCode Error: ${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
+ }
+
const syntax = props.language || langInfo.syntax;
const displayName = langInfo.displayName;
@@ -206,14 +366,19 @@ function parseSnippetCodeTags(content: string, contextDir: string): string {
const codeBlock = `\`\`\`${syntax} ${displayName}${highlightString ? ` ${highlightString}` : ''}${titleComment} maxLines=40 ${props.wordWrap ? 'wordWrap' : ''}\n${codeContent}\n\`\`\``;
return codeBlock;
- });
+ })();
+
+ result = result.replace(match, replacement);
+ }
+
+ return result;
}
-function processFile(srcPath: string, distPath: string) {
+async function processFile(srcPath: string, distPath: string) {
try {
const content = fs.readFileSync(srcPath, 'utf8');
const contextDir = path.dirname(srcPath);
- const processedContent = parseSnippetCodeTags(content, contextDir);
+ const processedContent = await parseSnippetCodeTags(content, contextDir);
// Ensure the directory exists
const distDir = path.dirname(distPath);
@@ -234,11 +399,12 @@ function isMarkdownFile(filename: string): boolean {
return filename.endsWith('.mdx') || filename.endsWith('.md');
}
-function processAllFiles() {
+async function processAllFiles() {
console.log('🔄 Processing all .mdx and .md files...');
- function processDirectory(srcDir: string) {
+ async function processDirectory(srcDir: string) {
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
+ const promises: Promise<void>[] = [];
for (const entry of entries) {
const srcPath = path.join(srcDir, entry.name);
@@ -246,7 +412,7 @@ function processAllFiles() {
if (entry.isDirectory()) {
// Skip dist directory to avoid infinite loops
if (entry.name === 'dist') continue;
- processDirectory(srcPath);
+ promises.push(processDirectory(srcPath));
} else if (entry.isFile() && isMarkdownFile(entry.name)) {
// Calculate the relative path from the source directory
const relativePath = path.relative(DOCS_SRC_DIR, srcPath);
@@ -254,12 +420,14 @@ function processAllFiles() {
// Always preserve directory structure
const distPath = path.join(PAGES_DIST_DIR, relativePath);
- processFile(srcPath, distPath);
+ promises.push(processFile(srcPath, distPath));
}
}
+
+ await Promise.all(promises);
}
- processDirectory(DOCS_SRC_DIR);
+ await processDirectory(DOCS_SRC_DIR);
console.log('✅ All files processed');
}
@@ -278,7 +446,9 @@ function startWatchMode() {
if (eventType === 'change' && fs.existsSync(srcPath)) {
console.log(`🔄 File changed: ${filename}`);
- processFile(srcPath, distPath);
+ processFile(srcPath, distPath).catch(error => {
+ console.error(`❌ Error processing ${filename}:`, error);
+ });
}
});
@@ -310,13 +480,13 @@ function startWatchMode() {
}
// Main function
-function main() {
+async function main() {
console.log('🚀 Starting SnippetCode processor...');
console.log(`Source: ${DOCS_SRC_DIR}`);
console.log(`Dist: ${PAGES_DIST_DIR}`);
ensureDistDir();
- processAllFiles();
+ await processAllFiles();
// Check if we should run in watch mode
const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
@@ -329,4 +499,7 @@ function main() {
}
// Run the main function directly
-main();
+main().catch(error => {
+ console.error('❌ Fatal error:', error);
+ process.exit(1);
+});
diff --git a/fern/snippets/mcp/typescript/openai.ts b/fern/snippets/mcp/typescript/openai.ts
new file mode 100644
index 000000000..5587871ae
--- /dev/null
+++ b/fern/snippets/mcp/typescript/openai.ts
@@ -0,0 +1,51 @@
+import { Composio } from '@composio/core';
+import { OpenAIResponsesProvider } from '@composio/openai';
+import OpenAI from 'openai';
+import { v4 as uuidv4 } from 'uuid';
+
+const openai = new OpenAI({
+ apiKey: process.env.OPENAI_API_KEY,
+});
+
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY,
+ provider: new OpenAIResponsesProvider(),
+});
+
+const mcpConfig = await composio.mcp.create(
+ 'gmail-mcp',
+ [
+ {
+ toolkit: 'GMAIL',
+ allowedTools: ['GMAIL_FETCH_EMAILS'],
+ authConfigId: 'ac_GHetipM5x5s0',
+ },
+ ],
+ { useComposioManagedAuth: true }
+);
+
+console.log(`✅ MCP server created: ${mcpConfig.id}`);
+console.log(`🔧 Available toolkits: ${mcpConfig.toolkits.join(', ')}`);
+
+// Retrieve server URLs for connected accounts
+const mcpTools = await mcpConfig.getServer({
+ userId: "sid"
+});
+
+console.log('MCP Tools:', mcpTools);
+
+const completion = await openai.responses.create({
+ model: 'gpt-4o-mini',
+ input:
+ "I've connected to Gmail and I want to fetch the latest email from my inbox and summarize it",
+ tools: mcpTools,
+});
+
+console.log('\n📬 Email Summary:');
+console.log(completion.output_text);
+
+console.log('\n✅ OpenAI MCP example completed successfully!');
+console.log(
+ '\n💡 Note: The MCP server URLs can also be used to connect from other MCP-compatible clients.'
+);
+console.log(`📍 Server ID for future reference: ${mcpConfig.id}`);