Explore Topics
Topic
40 patterns

AI SDK MCP

Connect your AI agents to the broader tool ecosystem with Model Context Protocol patterns. Browse tool integrations, data source connections, and service patterns built on the Vercel AI SDK.

40 patterns total

All Patterns

HIL Tool Approval Basic preview

Chat assistant with human approval workflows for safe tool execution.

Problems Solved

  • Human approval workflows for AI tools
  • Safe AI tool execution with oversight
  • Interactive chat interface with streaming
  • Rate limiting and abuse prevention
  • Tool categorization and management
  • Real-time approval feedback
  • Type-safe tool processing
  • Modular component architecture

Use Cases

  • Content moderation with human oversight
  • E-commerce shopping cart approval
  • User registration management
  • Payment processing workflows
  • Weather information services
  • Safe AI tool execution patterns
  • Human-AI collaboration interfaces
  • Approval workflow management
APIsstreamTextgatewaystepCountIsconvertToModelMessagestool(tools:
Servicesopenai
Tagsaihuman-in-the-loopai-sdktool-approvalchat-interfacerate-limitingsafe-aiworkflow-management
AI Profile Enrichment Form preview

Analyze user profiles with AI and provide personalized suggestions. Enriches data, suggests improvements, and offers career insights.

Problems Solved

  • Automatically analyzes user profiles using AI
  • Generates relevant professional tags and categories
  • Provides career insights and suggestions
  • Demonstrates AI SDK integration with forms
  • Shows real-time AI analysis with streaming responses

Use Cases

  • Profile enrichment and data augmentation
  • Career insights and skill recommendations
  • Form validation with AI-powered suggestions
  • Real-time streaming form analysis
  • Professional tag and category generation
APIsstreamObjectcreateStreamableValue
Servicesopenai
Tagsaiformprofile-analysiscareer-insightsvercel-ai-sdkstreaming-responseserver-actions
Cheerio Web Scraper preview

Extract content from websites using Cheerio. Includes parsing, link discovery, and rate limiting.

Problems Solved

  • Extract content from websites
  • Fetch links and images from web pages
  • Simple web scraping without complex setup

Use Cases

  • Content aggregation
  • Data collection
  • Website analysis
  • Link extraction
  • Image scraping
Tagscheerioscraperwebdata-extraction
Jina AI Web Scraper preview

Scrape websites using Jina AI with JavaScript rendering and proxy rotation. Handles rate limiting and bot detection.

Problems Solved

  • Extract content from websites
  • Fetch links and images from web pages
  • Bypass common scraping limitations like rate limiting and bot detection
  • Simple web scraping without complex setup

Use Cases

  • Content aggregation
  • Data collection
  • Website analysis
  • Link extraction
  • Image scraping
  • Accessing restricted websites
Servicesjina
Tagsjinascraperwebdata-extractionproxy
Cloudflare Markdown.new Web Scraper preview

Convert any webpage to markdown using Cloudflare's markdown.new. Clean, structured output for AI pipelines and content processing.

Problems Solved

  • Convert web pages to markdown
  • Clean structured output for AI pipelines
  • Content processing without API keys
  • Simple web-to-markdown conversion

Use Cases

  • Content aggregation
  • AI pipeline input
  • Documentation extraction
  • Website analysis
  • Markdown conversion
Servicescloudflare
Tagscloudflaremarkdownscraperwebdata-extraction
Web Search Tool preview

Search the web using OpenAI's tool with real-time results. Includes source verification, citation tracking, and contextual answers.

Problems Solved

  • Search the web with AI
  • Get results with sources
  • Error handling and validation

Use Cases

  • Web search with AI-powered answers
  • Research with source citations
  • Fact-checking and verification
  • Real-time information retrieval
  • Contextual Q&A with web data
APIsgenerateTexttools:
Servicesopenai
Tagsaiwebsearchopenai
PDF Analysis Tool preview

Process PDFs with AI analysis. Extract text, generate summaries, and identify key insights.

Problems Solved

  • Upload and process PDF documents with AI analysis
  • Extract text content and generate summaries

Use Cases

  • Document analysis and summarization
  • Research paper extraction
  • Contract and report processing
  • Key insight identification
  • Multimodal PDF ingestion with AI
APIsstreamText
Servicesopenai
Tagsaipdfanalysisopenai
AI SDK Gemini Flash Text preview

Generate text and analyze market research using Google's Gemini 2.5 Flash. Includes interactive charts and data visualization.

Problems Solved

  • AI-powered text generation and analysis
  • Comprehensive market research with web search
  • Interactive data visualization and charts
  • Time-series data analysis and trends
  • Key metrics and KPI identification
  • Source attribution and research validation
  • Rate limiting to prevent API abuse
  • Professional market research reports

Use Cases

  • Market research and analysis
  • Business intelligence and reporting
  • Data visualization and charting
  • Trend analysis and forecasting
  • Competitive research and analysis
  • Investment research and due diligence
  • Academic research and data analysis
  • Content creation with data insights
APIsgenerateTextgenerateObjecttools:
Servicesgoogle
Tagsgoogletext-generationmarket-researchgeminiaivercel-ai-sdkrate-limitingdata-visualizationchartsinteractive
AI SDK Gemini Flash Image  preview

Generate images using Google's Gemini 2.5 Flash with prompt optimization. Includes style adaptation and customizable parameters.

Problems Solved

  • AI-powered image generation using text prompts
  • Rate limiting to prevent API abuse
  • Comprehensive error handling with user feedback

Use Cases

  • AI image generation from text prompts
  • AI-powered creative tools
  • Content creation and design
  • Marketing and advertising visuals
  • Social media content generation
  • Creative project visualization
APIsgenerateTextgenerateImage
Servicesgoogle
Tagsgoogleimage-generationgeminivercel-ai-sdkrate-limiting
AI SDK Gemini Flash Image Edit preview

Generate and edit images using Google's Gemini 2.5 Flash. Create new images from text or edit existing ones with natural language. Includes version history and image comparison.

Problems Solved

  • AI-powered image generation using text prompts
  • AI-powered image editing with natural language
  • Peak React performance with useReducer state management
  • Version history and image comparison functionality
  • Rate limiting to prevent API abuse
  • Comprehensive error handling with user feedback
  • Interactive editing workflow with undo/reset functionality
  • Custom hooks for maintainable state management
  • O(1) version lookups with refs for optimal performance

Use Cases

  • AI image generation from text prompts
  • AI-powered image editing and modification
  • Version history and image comparison workflows
  • High-performance React applications
  • Creative tools and design workflows
  • Content creation and design
  • Marketing and advertising visuals
  • Social media content generation
  • Creative project visualization
  • Iterative design processes
  • Performance-critical image editing applications
APIsgenerateTextgenerateImagegateway
Servicesgoogle-ai
Tagsaiimage-generationimage-editinggooglegeminivercel-ai-sdkrate-limitingperformanceuseReducerversion-historyimage-comparisoncustom-hooks
AI SDK Gemini Flash Image Merge preview

Generate, edit, and merge images using Google's Gemini 2.5 Flash. Create new images from text, edit existing ones with natural language, or merge two images together. Includes version history and image comparison.

Problems Solved

  • AI-powered image generation using text prompts
  • AI-powered image editing with natural language
  • AI-powered image merging from two source images
  • Version history and image comparison functionality
  • Rate limiting to prevent API abuse
  • Comprehensive error handling with user feedback
  • Interactive editing workflow with undo/reset functionality
  • Custom hooks for maintainable state management

Use Cases

  • AI image generation from text prompts
  • AI-powered image editing and modification
  • AI-powered image merging and composition
  • Version history and image comparison workflows
  • Creative tools and design workflows
  • Content creation and design
  • Marketing and advertising visuals
  • Social media content generation
  • Creative project visualization
  • Iterative design processes
APIsgenerateTextgateway
Servicesgoogle-ai
Tagsaiimage-generationimage-editingimage-merginggooglegeminivercel-ai-sdkrate-limitingversion-historyimage-comparisoncustom-hooks
Claude Web Search Tool preview

Search the web with Claude AI. Includes result filtering, multiple search types, and language support.

Problems Solved

  • Intelligent web search with Claude AI integration
  • Structured search result processing and validation
  • Multiple search types (web, news, images, videos)
  • Language and region-specific search capabilities
  • Safe search and content filtering options
  • Time-range filtering for search results
  • Relevance scoring and result ranking
  • Type-safe search tool implementation with Zod schemas

Use Cases

  • Research and information gathering
  • Fact-checking and verification
  • Content discovery and curation
  • Market research and analysis
  • Academic research and citation
  • News monitoring and tracking
  • Competitive intelligence
  • SEO and content strategy
APIsstreamTexttools:convertToModelMessagestool(generateText
Servicesclaude
Tagsaiwebsearchclaudesearch-toolresearchfact-checkinginformation-discoveryzod-validationtype-safe
Exa Web Search Tool preview

Search with Exa's semantic API and real-time crawling. Includes live content extraction and relevance scoring.

Problems Solved

  • Intelligent web search with Exa's semantic search API
  • Real-time content crawling and extraction
  • Structured search result processing and validation
  • Live content updates with always-on crawling
  • Semantic search capabilities for better relevance
  • Content summarization and snippet generation
  • Publication date tracking and filtering
  • Type-safe search tool implementation with Zod schemas

Use Cases

  • Research and content discovery
  • Real-time information gathering
  • Content curation and analysis
  • Market research and monitoring
  • Academic research and citation
  • News monitoring and tracking
  • Competitive intelligence
  • SEO and content strategy
APIsstreamTextstepCountIsconvertToModelMessagestool(
Servicesexa
Tagsaiwebsearchexasearch-toolresearchcontent-discoverysemantic-searchlive-crawlingzod-validationtype-safe
@exalabs webSearch Tool preview

Search with Exa AI SDK's webSearch tool and Anthropic Claude Sonnet 4.5. Uses @exalabs/ai-sdk for seamless integration.

Problems Solved

  • Intelligent web search with Exa AI SDK integration
  • Simplified tool implementation using @exalabs/ai-sdk
  • Real-time content extraction and semantic search
  • Streaming responses with Anthropic Claude Sonnet 4.5
  • Automatic source attribution and citation
  • Type-safe search tool implementation
  • Seamless AI SDK v6 integration

Use Cases

  • Research and content discovery
  • Real-time information gathering
  • Content curation and analysis
  • Market research and monitoring
  • Academic research and citation
  • News monitoring and tracking
  • Competitive intelligence
  • SEO and content strategy
APIsstreamTextstepCountIsconvertToModelMessagestool(
Servicesexaanthropic
Tagsaiwebsearchexasearch-toolresearchcontent-discoverysemantic-searchlive-crawlingai-sdk-integrationanthropicclaudetype-safe
Firecrawl Scrape Tool Chat preview

Crawl and extract content using Firecrawl's API. Includes URL processing, markdown conversion, and structured data extraction.

Problems Solved

  • Intelligent web crawling and content extraction
  • URL-based content processing and analysis
  • Markdown and HTML format conversion
  • Structured data extraction from web pages
  • Reliable web crawling with error handling
  • Content parsing and format standardization
  • URL validation and processing
  • Type-safe web crawling tool implementation with Zod schemas

Use Cases

  • Web content extraction and analysis
  • URL-based data collection
  • Content format conversion
  • Web scraping and crawling
  • Research and content analysis
  • Data processing workflows
  • Content management systems
  • Automated web content processing
APIsstreamTexttools:stepCountIsconvertToModelMessagestool(
Servicesfirecrawl
Tagsaiwebsearchfirecrawlweb-crawlingcontent-extractionurl-processingmarkdown-conversiondata-collectionzod-validationtype-safe
HIL Needs Approval preview

Demonstrate tool approval with async generators. Includes real-time feedback, approval workflows, and interactive management.

Problems Solved

  • Tool approval patterns with async generator workflows
  • Real-time feedback during tool execution
  • Interactive tool management and approval workflows
  • Safe AI tool execution with user oversight
  • Async generator pattern demonstration
  • Tool execution state management
  • Approval workflow visualization
  • Modern AI agent tool patterns

Use Cases

  • Tool approval workflow demonstrations
  • Safe AI tool execution patterns
  • Interactive tool management interfaces
  • Approval workflow implementations
  • Async generator pattern examples
  • Real-time tool execution feedback
  • Educational AI agent patterns
  • Tool execution state management
APIsnew Agenttool(stepCountIsExperimental_Agenttools:gatewayUIToolInvocation
Servicesgoogle-ai
Tagsaiagentstool-approvalasync-generatorapproval-patternsai-sdk-v5streamingreal-time-feedbacktool-executionworkflow-management
Tool Input Lifecycle Hooks preview

Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.

Problems Solved

  • Track tool input generation in real-time
  • Monitor tool input streaming with lifecycle hooks
  • Understand tool input lifecycle events
  • Debug tool input generation process

Use Cases

  • Learning tool input lifecycle hooks
  • Debugging tool input generation
  • Monitoring tool input streaming
  • Understanding AI SDK tool APIs
APIsstreamTextconvertToModelMessagestool(useChatonInputStartonInputDeltaonInputAvailable
Servicesopenai
Tagsaitoolslifecycle-hooksonInputStartonInputDeltaonInputAvailablestreamingai-sdktool-api
Preliminary Tool Results preview

Return preliminary tool results using async iterables. Stream status updates during tool execution before the final result is available.

Problems Solved

  • Stream preliminary tool results during execution
  • Provide status updates before final result
  • Use async iterables for progressive tool results
  • Display intermediate states during tool execution

Use Cases

  • Streaming tool execution status
  • Progressive tool result updates
  • Long-running tool operations
  • Understanding async generator tool patterns
APIsstreamTextconvertToModelMessagestool(useChatasync-generator
Servicesopenai
Tagsaitoolspreliminary-resultsasync-iterablesgenerator-functionsstreamingai-sdktool-api
Tool API Context preview

Pass arbitrary context from generateText/streamText to tool execution via experimental_context. Access context in tool execute functions for dynamic behavior.

Problems Solved

  • Pass arbitrary context to tool execution
  • Dynamic tool behavior based on context
  • Access context in tool execute functions
  • Customize tool behavior without modifying tool definition

Use Cases

  • Passing user preferences to tools
  • Dynamic API key management
  • Context-aware tool behavior
  • User-specific tool customization
APIsstreamTextconvertToModelMessagestool(useChatexperimental_context
Servicesopenai
Tagsaitoolsexperimental-contextcontextdynamic-behaviorai-sdktool-api
Tool Call Repair preview

Repair invalid tool calls using experimental_repairToolCall. Fix schema validation errors without requiring additional steps that pollute message history.

Problems Solved

  • Repair invalid tool calls automatically
  • Fix schema validation errors without additional steps
  • Handle tool call failures gracefully
  • Use structured outputs for repair

Use Cases

  • Handling invalid tool calls from smaller models
  • Repairing complex schema validation errors
  • Automatic tool call error recovery
  • Improving tool call success rate
APIsstreamTextconvertToModelMessagestool(useChatexperimental_repairToolCallgenerateObjectNoSuchToolError
Servicesopenai
Tagsaitoolstool-call-repairexperimental-repairToolCallschema-validationerror-handlingai-sdktool-api
Dynamic Tool preview

Create dynamic tools with runtime-generated schemas using dynamicTool. Demonstrates unit conversion tools where schema adapts based on conversion type (temperature, length, weight, currency) and supports dynamic model selection.

Problems Solved

  • Create tools with runtime-generated schemas
  • Adapt tool schemas based on user selection
  • Support dynamic model selection
  • Demonstrate dynamic tool creation patterns
  • Handle tools with unknown schemas at compile time

Use Cases

  • Unit conversion tools with dynamic schemas
  • MCP (Model Context Protocol) tools
  • User-defined functions at runtime
  • Tools loaded from external sources
  • Dynamic tool configuration based on user input
APIsstreamTextconvertToModelMessagesdynamicTooluseChatprepareSendMessagesRequest
Servicesopenaianthropicgoogle
Tagsaitoolsdynamic-toolruntime-toolsunit-converterschema-generationdynamic-schemaai-sdktool-apimodel-selection
Structured Agent Output: Output.choice preview

Demonstrate structured agent outputs using ToolLoopAgent with Output.choice. Constrain agent outputs to predefined choices for predictable, type-safe responses.

Problems Solved

  • Constrain agent outputs to predefined choices
  • Ensure type-safe agent responses
  • Create predictable agent outputs
  • Integrate structured outputs with tool-calling agents

Use Cases

  • Clothing recommendation systems with constrained choices
  • Form validation and structured data collection
  • API responses with guaranteed formats
  • Type-safe agent workflows
APIsToolLoopAgentOutput.choiceagent.generatetool
Servicesopenai
Tagsaiagentsstructured-outputstool-loop-agentoutput-choiceai-sdkagent-api
Structured Agent Output: Output.array preview

Demonstrate structured agent outputs using ToolLoopAgent with Output.array. Returns structured array output with element schema for predictable, type-safe responses.

Problems Solved

  • Generate structured array outputs with element schemas
  • Ensure type-safe agent responses
  • Create predictable agent outputs
  • Integrate structured outputs with tool-calling agents

Use Cases

  • Multi-location data aggregation with structured arrays
  • Form validation and structured data collection
  • API responses with guaranteed formats
  • Type-safe agent workflows
APIsToolLoopAgentOutput.arrayagent.generatetool
Servicesopenai
Tagsaiagentsstructured-outputstool-loop-agentoutput-arrayai-sdkagent-api
Generate Speech (OpenAI) preview

Convert text to speech using OpenAI's API. Includes multiple voices, speed control, and real-time playback for voiceovers and accessibility.

APIsgenerateSpeech
Servicesopenai
Tagsaigenerate-speechopenaiaudiotts
Transcribe Audio (OpenAI) preview

Transcribe audio files using OpenAI's API. Includes real-time transcription and language detection.

APIstranscribe
Servicesopenai
Tagsaitranscribeopenaiaudiospeech-to-text
Generate Text preview

Generate text from prompts using AI. Simple interface with character counting and response rendering.

APIsgenerateTextconvertToModelMessages
Servicesopenaiperplexity
Tagsaiprompttext-generationai-sdkopenai
Stream Text preview

Stream text responses from AI prompts in real-time. Includes character counting and live response rendering with useCompletion.

APIsstreamTextuseCompletion
Servicesopenai
Tagsaiprompttext-generationstreamingai-sdkopenai
Streaming Structured Output preview

Stream structured output from AI prompts in real-time using streamText with Output.object(). Generate typed data with useObject and live rendering.

APIsstreamTextOutput.objectuseObject
Servicesopenai
Tagsaipromptobject-generationstreamingstructured-dataai-sdkopenaizod
OpenAI Structured Output preview

Generate structured output from AI prompts using OpenAI. Create typed data with generateText and Output.object().

APIsgenerateTextOutput.object
Servicesopenai
Tagsaipromptobject-generationstructured-dataai-sdkopenaizod
Claude Structured Output preview

Generate structured output from AI prompts using Anthropic Claude. Create typed data with generateText and Output.object().

APIsgenerateTextOutput.object
Servicesanthropic
Tagsaipromptobject-generationstructured-dataai-sdkclaudeanthropiczod
Gemini Structured Output preview

Generate structured output from AI prompts using Google Gemini. Create typed data with generateText and Output.object().

APIsgenerateTextOutput.object
Servicesgoogle
Tagsaipromptobject-generationstructured-dataai-sdkgooglegeminizod
Generate Image (OpenAI) preview

Generate images from text prompts using OpenAI's DALL-E 3. Create high-quality images with AI.

APIsexperimental_generateImage
Servicesopenai
Tagsaiimage-generationdalleai-sdkopenai
Generate Image (Fal.ai) preview

Generate images from text prompts using Fal.ai's Flux model. Fast and high-quality image generation.

APIsexperimental_generateImage
Servicesfal
Tagsaiimage-generationfluxfalai-sdk
Generate Speech (ElevenLabs) preview

Convert text to speech using ElevenLabs API. Includes multiple voices and high-quality audio generation.

APIsexperimental_generateSpeech
Serviceselevenlabs
Tagsaigenerate-speechelevenlabsaudiottsai-sdk
Transcribe Audio (ElevenLabs) preview

Transcribe audio files using ElevenLabs API. Includes real-time transcription and language detection.

APIsexperimental_transcribe
Serviceselevenlabs
Tagsaitranscribeelevenlabsaudiospeech-to-textai-sdk
Search - Exa AI (robust) preview

Search the web using Exa's semantic API and real-time crawling. Includes URL search, content extraction, Wikipedia, Reddit, and news search tools.

APIsstreamTextconvertToCoreMessagestool(useChat
Servicesopenaiexa
Tagsaisearchexaweb-searchsemantic-searchresearchtoolsai-sdk
Search - Firecrawl (robust) preview

Search the web using Firecrawl's API and real-time crawling. Includes URL search, content extraction, Wikipedia, Reddit, and news search tools.

APIsstreamTextconvertToCoreMessagestool(useChat
Servicesopenaifirecrawl
Tagsaisearchfirecrawlweb-searchsemantic-searchresearchtoolsai-sdk
Scrape - Cheerio (lightweight) preview

Scrape websites using Cheerio's fast HTML parser. Includes URL scraping, website crawling, and content extraction without external API costs.

APIsstreamTextconvertToCoreMessagestool(useChat
Servicesopenai
Tagsaiscrapecheerioweb-scrapinghtml-parsingresearchtoolsai-sdklightweightno-api-cost
Scrape - Jina AI (advanced) preview

Scrape websites using Jina AI's reader service with JavaScript rendering. Includes URL scraping, website crawling, and content extraction with AI-powered parsing.

APIsstreamTextconvertToCoreMessagestool(useChat
Servicesopenaijina
Tagsaiscrapejinaweb-scrapingjavascript-renderingresearchtoolsai-sdkadvancedreader-service
Scrape - Markdown.new (free) preview

Scrape websites using Cloudflare's markdown.new service. Extract clean markdown content from any URL. No API key required.

APIsstreamTextconvertToCoreMessagestool(useChat
Servicesopenaimarkdown.new
Tagsaiscrapemarkdown-newweb-scrapingcloudflareno-api-keytoolsai-sdk

Browse by Category

End of AI SDK MCP