[ Skip to content ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_aibuiltin_tools)
**Join us at the inaugural PyAI Conf in San Francisco on March 10th![Learn More](https://pyai.events/?utm_source=pydantic-ai) **
[ ![logo](https://ai.pydantic.dev/img/logo-white.svg) ](https://ai.pydantic.dev/ "Pydantic AI")
Pydantic AI
pydantic_ai.builtin_tools
Type to start searching
[ pydantic/pydantic-ai
  * v1.63.0
  * 15.1k
  * 1.7k

](https://github.com/pydantic/pydantic-ai "Go to repository")
[ ![logo](https://ai.pydantic.dev/img/logo-white.svg) ](https://ai.pydantic.dev/ "Pydantic AI") Pydantic AI
[ pydantic/pydantic-ai
  * v1.63.0
  * 15.1k
  * 1.7k

](https://github.com/pydantic/pydantic-ai "Go to repository")
  * [ Pydantic AI  ](https://ai.pydantic.dev/)
  * [ Installation  ](https://ai.pydantic.dev/install/)
  * [ Getting Help  ](https://ai.pydantic.dev/help/)
  * [ Troubleshooting  ](https://ai.pydantic.dev/troubleshooting/)
  * [ Pydantic AI Gateway  ](https://ai.pydantic.dev/gateway/)
  * Documentation
    * Core Concepts
      * [ Agents  ](https://ai.pydantic.dev/agent/)
      * [ Dependencies  ](https://ai.pydantic.dev/dependencies/)
      * [ Function Tools  ](https://ai.pydantic.dev/tools/)
      * [ Output  ](https://ai.pydantic.dev/output/)
      * [ Messages and chat history  ](https://ai.pydantic.dev/message-history/)
      * [ Direct Model Requests  ](https://ai.pydantic.dev/direct/)
    * Models & Providers
      * [ Overview  ](https://ai.pydantic.dev/models/overview/)
      * [ OpenAI  ](https://ai.pydantic.dev/models/openai/)
      * [ Anthropic  ](https://ai.pydantic.dev/models/anthropic/)
      * [ Google  ](https://ai.pydantic.dev/models/google/)
      * [ xAI  ](https://ai.pydantic.dev/models/xai/)
      * [ Bedrock  ](https://ai.pydantic.dev/models/bedrock/)
      * [ Cerebras  ](https://ai.pydantic.dev/models/cerebras/)
      * [ Cohere  ](https://ai.pydantic.dev/models/cohere/)
      * [ Groq  ](https://ai.pydantic.dev/models/groq/)
      * [ Hugging Face  ](https://ai.pydantic.dev/models/huggingface/)
      * [ Mistral  ](https://ai.pydantic.dev/models/mistral/)
      * [ OpenRouter  ](https://ai.pydantic.dev/models/openrouter/)
      * [ Outlines  ](https://ai.pydantic.dev/models/outlines/)
    * Tools & Toolsets
      * [ Function Tools  ](https://ai.pydantic.dev/tools/)
      * [ Advanced Tool Features  ](https://ai.pydantic.dev/tools-advanced/)
      * [ Toolsets  ](https://ai.pydantic.dev/toolsets/)
      * [ Deferred Tools  ](https://ai.pydantic.dev/deferred-tools/)
      * [ Built-in Tools  ](https://ai.pydantic.dev/builtin-tools/)
      * [ Common Tools  ](https://ai.pydantic.dev/common-tools/)
      * [ Third-Party Tools  ](https://ai.pydantic.dev/third-party-tools/)
    * Advanced Features
      * [ Image, Audio, Video & Document Input  ](https://ai.pydantic.dev/input/)
      * [ Thinking  ](https://ai.pydantic.dev/thinking/)
      * [ HTTP Request Retries  ](https://ai.pydantic.dev/retries/)
    * MCP
      * [ Overview  ](https://ai.pydantic.dev/mcp/overview/)
      * [ Client  ](https://ai.pydantic.dev/mcp/client/)
      * [ FastMCP Client  ](https://ai.pydantic.dev/mcp/fastmcp-client/)
      * [ Server  ](https://ai.pydantic.dev/mcp/server/)
    * [ Multi-Agent Patterns  ](https://ai.pydantic.dev/multi-agent-applications/)
    * [ Web Chat UI  ](https://ai.pydantic.dev/web/)
    * [ Embeddings  ](https://ai.pydantic.dev/embeddings/)
    * [ Testing  ](https://ai.pydantic.dev/testing/)
  * Pydantic Evals
    * [ Overview  ](https://ai.pydantic.dev/evals/)
    * Getting Started
      * [ Quick Start  ](https://ai.pydantic.dev/evals/quick-start/)
      * [ Core Concepts  ](https://ai.pydantic.dev/evals/core-concepts/)
    * Evaluators
      * [ Overview  ](https://ai.pydantic.dev/evals/evaluators/overview/)
      * [ Built-in Evaluators  ](https://ai.pydantic.dev/evals/evaluators/built-in/)
      * [ LLM Judge  ](https://ai.pydantic.dev/evals/evaluators/llm-judge/)
      * [ Custom Evaluators  ](https://ai.pydantic.dev/evals/evaluators/custom/)
      * [ Report Evaluators  ](https://ai.pydantic.dev/evals/evaluators/report-evaluators/)
      * [ Span-Based  ](https://ai.pydantic.dev/evals/evaluators/span-based/)
    * How-To Guides
      * [ Logfire Integration  ](https://ai.pydantic.dev/evals/how-to/logfire-integration/)
      * [ Dataset Management  ](https://ai.pydantic.dev/evals/how-to/dataset-management/)
      * [ Dataset Serialization  ](https://ai.pydantic.dev/evals/how-to/dataset-serialization/)
      * [ Concurrency & Performance  ](https://ai.pydantic.dev/evals/how-to/concurrency/)
      * [ Multi-Run Evaluation  ](https://ai.pydantic.dev/evals/how-to/multi-run/)
      * [ Retry Strategies  ](https://ai.pydantic.dev/evals/how-to/retry-strategies/)
      * [ Metrics & Attributes  ](https://ai.pydantic.dev/evals/how-to/metrics-attributes/)
    * Examples
      * [ Simple Validation  ](https://ai.pydantic.dev/evals/examples/simple-validation/)
  * Pydantic Graph
    * [ Overview  ](https://ai.pydantic.dev/graph/)
    * [ Beta API  ](https://ai.pydantic.dev/graph/beta/)
      * [ Steps  ](https://ai.pydantic.dev/graph/beta/steps/)
      * [ Joins & Reducers  ](https://ai.pydantic.dev/graph/beta/joins/)
      * [ Decisions  ](https://ai.pydantic.dev/graph/beta/decisions/)
      * [ Parallel Execution  ](https://ai.pydantic.dev/graph/beta/parallel/)
  * Integrations
    * [ Debugging & Monitoring with Pydantic Logfire  ](https://ai.pydantic.dev/logfire/)
    * Durable Execution
      * [ Overview  ](https://ai.pydantic.dev/durable_execution/overview/)
      * [ Temporal  ](https://ai.pydantic.dev/durable_execution/temporal/)
      * [ DBOS  ](https://ai.pydantic.dev/durable_execution/dbos/)
      * [ Prefect  ](https://ai.pydantic.dev/durable_execution/prefect/)
    * UI Event Streams
      * [ Overview  ](https://ai.pydantic.dev/ui/overview/)
      * [ AG-UI  ](https://ai.pydantic.dev/ui/ag-ui/)
      * [ Vercel AI  ](https://ai.pydantic.dev/ui/vercel-ai/)
    * [ Agent2Agent (A2A)  ](https://ai.pydantic.dev/a2a/)
  * Related Packages
    * [ clai  ](https://ai.pydantic.dev/cli/)
  * Examples
    * [ Setup  ](https://ai.pydantic.dev/examples/setup/)
    * Getting Started
      * [ Pydantic Model  ](https://ai.pydantic.dev/examples/pydantic-model/)
      * [ Weather agent  ](https://ai.pydantic.dev/examples/weather-agent/)
    * Conversational Agents
      * [ Chat App with FastAPI  ](https://ai.pydantic.dev/examples/chat-app/)
      * [ Bank support  ](https://ai.pydantic.dev/examples/bank-support/)
    * Data & Analytics
      * [ SQL Generation  ](https://ai.pydantic.dev/examples/sql-gen/)
      * [ Data Analyst  ](https://ai.pydantic.dev/examples/data-analyst/)
      * [ RAG  ](https://ai.pydantic.dev/examples/rag/)
    * Streaming
      * [ Stream markdown  ](https://ai.pydantic.dev/examples/stream-markdown/)
      * [ Stream whales  ](https://ai.pydantic.dev/examples/stream-whales/)
    * Complex Workflows
      * [ Flight booking  ](https://ai.pydantic.dev/examples/flight-booking/)
      * [ Question Graph  ](https://ai.pydantic.dev/examples/question-graph/)
    * Business Applications
      * [ Slack Lead Qualifier with Modal  ](https://ai.pydantic.dev/examples/slack-lead-qualifier/)
    * UI Examples
      * [ Agent User Interaction (AG-UI)  ](https://ai.pydantic.dev/examples/ag-ui/)
  * API Reference
    * pydantic_ai
      * [ pydantic_ai.ag_ui  ](https://ai.pydantic.dev/api/ag_ui/)
      * [ pydantic_ai.agent  ](https://ai.pydantic.dev/api/agent/)
      * pydantic_ai.builtin_tools  [ pydantic_ai.builtin_tools  ](https://ai.pydantic.dev/api/builtin_tools/)
        * [ builtin_tools  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools)
        * [ BUILTIN_TOOL_TYPES  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.BUILTIN_TOOL_TYPES)
        * [ ImageAspectRatio  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageAspectRatio)
        * [ AbstractBuiltinTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.kind)
          * [ unique_id  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.unique_id)
          * [ label  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.label)
        * [ WebSearchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool)
          * [ search_context_size  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.search_context_size)
          * [ user_location  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.user_location)
          * [ blocked_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.blocked_domains)
          * [ allowed_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.allowed_domains)
          * [ max_uses  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.max_uses)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.kind)
        * [ WebSearchUserLocation  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation)
          * [ city  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.city)
          * [ country  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.country)
          * [ region  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.region)
          * [ timezone  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.timezone)
        * [ CodeExecutionTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.CodeExecutionTool)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.CodeExecutionTool.kind)
        * [ WebFetchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool)
          * [ max_uses  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.max_uses)
          * [ allowed_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.allowed_domains)
          * [ blocked_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.blocked_domains)
          * [ enable_citations  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.enable_citations)
          * [ max_content_tokens  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.max_content_tokens)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.kind)
        * [ UrlContextTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.UrlContextTool)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.UrlContextTool.kind)
        * [ ImageGenerationTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool)
          * [ background  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.background)
          * [ input_fidelity  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.input_fidelity)
          * [ moderation  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.moderation)
          * [ output_compression  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.output_compression)
          * [ output_format  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.output_format)
          * [ partial_images  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.partial_images)
          * [ quality  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.quality)
          * [ size  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.size)
          * [ aspect_ratio  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.aspect_ratio)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.kind)
        * [ MemoryTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MemoryTool)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MemoryTool.kind)
        * [ MCPServerTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool)
          * [ id  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.id)
          * [ url  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.url)
          * [ authorization_token  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.authorization_token)
          * [ description  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.description)
          * [ allowed_tools  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.allowed_tools)
          * [ headers  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.headers)
        * [ FileSearchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool)
          * [ file_store_ids  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool.file_store_ids)
          * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool.kind)
        * [ DEPRECATED_BUILTIN_TOOLS  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.DEPRECATED_BUILTIN_TOOLS)
        * [ SUPPORTED_BUILTIN_TOOLS  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.SUPPORTED_BUILTIN_TOOLS)
      * [ pydantic_ai.common_tools  ](https://ai.pydantic.dev/api/common_tools/)
      * [ pydantic_ai — Concurrency  ](https://ai.pydantic.dev/api/concurrency/)
      * [ pydantic_ai.direct  ](https://ai.pydantic.dev/api/direct/)
      * [ pydantic_ai.durable_exec  ](https://ai.pydantic.dev/api/durable_exec/)
      * [ pydantic_ai.embeddings  ](https://ai.pydantic.dev/api/embeddings/)
      * [ pydantic_ai.exceptions  ](https://ai.pydantic.dev/api/exceptions/)
      * [ pydantic_ai.ext  ](https://ai.pydantic.dev/api/ext/)
      * [ pydantic_ai.format_prompt  ](https://ai.pydantic.dev/api/format_prompt/)
      * [ pydantic_ai.mcp  ](https://ai.pydantic.dev/api/mcp/)
      * [ pydantic_ai.messages  ](https://ai.pydantic.dev/api/messages/)
      * [ pydantic_ai.models.anthropic  ](https://ai.pydantic.dev/api/models/anthropic/)
      * [ pydantic_ai.models  ](https://ai.pydantic.dev/api/models/base/)
      * [ pydantic_ai.models.bedrock  ](https://ai.pydantic.dev/api/models/bedrock/)
      * [ pydantic_ai.models.cerebras  ](https://ai.pydantic.dev/api/models/cerebras/)
      * [ pydantic_ai.models.cohere  ](https://ai.pydantic.dev/api/models/cohere/)
      * [ pydantic_ai.models.fallback  ](https://ai.pydantic.dev/api/models/fallback/)
      * [ pydantic_ai.models.function  ](https://ai.pydantic.dev/api/models/function/)
      * [ pydantic_ai.models.google  ](https://ai.pydantic.dev/api/models/google/)
      * [ pydantic_ai.models.xai  ](https://ai.pydantic.dev/api/models/xai/)
      * [ pydantic_ai.models.groq  ](https://ai.pydantic.dev/api/models/groq/)
      * [ pydantic_ai.models.huggingface  ](https://ai.pydantic.dev/api/models/huggingface/)
      * [ pydantic_ai.models.instrumented  ](https://ai.pydantic.dev/api/models/instrumented/)
      * [ pydantic_ai.models.mcp_sampling  ](https://ai.pydantic.dev/api/models/mcp-sampling/)
      * [ pydantic_ai.models.mistral  ](https://ai.pydantic.dev/api/models/mistral/)
      * [ pydantic_ai.models.openai  ](https://ai.pydantic.dev/api/models/openai/)
      * [ pydantic_ai.models.openrouter  ](https://ai.pydantic.dev/api/models/openrouter/)
      * [ pydantic_ai.models.outlines  ](https://ai.pydantic.dev/api/models/outlines/)
      * [ pydantic_ai.models.test  ](https://ai.pydantic.dev/api/models/test/)
      * [ pydantic_ai.models.wrapper  ](https://ai.pydantic.dev/api/models/wrapper/)
      * [ pydantic_ai.output  ](https://ai.pydantic.dev/api/output/)
      * [ pydantic_ai.profiles  ](https://ai.pydantic.dev/api/profiles/)
      * [ pydantic_ai.providers  ](https://ai.pydantic.dev/api/providers/)
      * [ pydantic_ai.result  ](https://ai.pydantic.dev/api/result/)
      * [ pydantic_ai.retries  ](https://ai.pydantic.dev/api/retries/)
      * [ pydantic_ai.run  ](https://ai.pydantic.dev/api/run/)
      * [ pydantic_ai.settings  ](https://ai.pydantic.dev/api/settings/)
      * [ pydantic_ai.tools  ](https://ai.pydantic.dev/api/tools/)
      * [ pydantic_ai.toolsets  ](https://ai.pydantic.dev/api/toolsets/)
      * [ pydantic_ai.ui.ag_ui  ](https://ai.pydantic.dev/api/ui/ag_ui/)
      * [ pydantic_ai.ui  ](https://ai.pydantic.dev/api/ui/base/)
      * [ pydantic_ai.ui.vercel_ai  ](https://ai.pydantic.dev/api/ui/vercel_ai/)
      * [ pydantic_ai.usage  ](https://ai.pydantic.dev/api/usage/)
    * pydantic_evals
      * [ pydantic_evals.dataset  ](https://ai.pydantic.dev/api/pydantic_evals/dataset/)
      * [ pydantic_evals.evaluators  ](https://ai.pydantic.dev/api/pydantic_evals/evaluators/)
      * [ pydantic_evals.reporting  ](https://ai.pydantic.dev/api/pydantic_evals/reporting/)
      * [ pydantic_evals.otel  ](https://ai.pydantic.dev/api/pydantic_evals/otel/)
      * [ pydantic_evals.generation  ](https://ai.pydantic.dev/api/pydantic_evals/generation/)
    * pydantic_graph
      * [ pydantic_graph  ](https://ai.pydantic.dev/api/pydantic_graph/graph/)
      * [ pydantic_graph.nodes  ](https://ai.pydantic.dev/api/pydantic_graph/nodes/)
      * [ pydantic_graph.persistence  ](https://ai.pydantic.dev/api/pydantic_graph/persistence/)
      * [ pydantic_graph.mermaid  ](https://ai.pydantic.dev/api/pydantic_graph/mermaid/)
      * [ pydantic_graph.exceptions  ](https://ai.pydantic.dev/api/pydantic_graph/exceptions/)
      * Beta API
        * [ pydantic_graph.beta  ](https://ai.pydantic.dev/api/pydantic_graph/beta/)
        * [ pydantic_graph.beta.graph  ](https://ai.pydantic.dev/api/pydantic_graph/beta_graph/)
        * [ pydantic_graph.beta.graph_builder  ](https://ai.pydantic.dev/api/pydantic_graph/beta_graph_builder/)
        * [ pydantic_graph.beta.step  ](https://ai.pydantic.dev/api/pydantic_graph/beta_step/)
        * [ pydantic_graph.beta.join  ](https://ai.pydantic.dev/api/pydantic_graph/beta_join/)
        * [ pydantic_graph.beta.decision  ](https://ai.pydantic.dev/api/pydantic_graph/beta_decision/)
        * [ pydantic_graph.beta.node  ](https://ai.pydantic.dev/api/pydantic_graph/beta_node/)
    * fasta2a
      * [ fasta2a  ](https://ai.pydantic.dev/api/fasta2a/)
  * Project
    * [ Contributing  ](https://ai.pydantic.dev/contributing/)
    * [ Upgrade Guide  ](https://ai.pydantic.dev/changelog/)
    * [ Version policy  ](https://ai.pydantic.dev/version-policy/)


  * [ builtin_tools  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools)
  * [ BUILTIN_TOOL_TYPES  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.BUILTIN_TOOL_TYPES)
  * [ ImageAspectRatio  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageAspectRatio)
  * [ AbstractBuiltinTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.kind)
    * [ unique_id  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.unique_id)
    * [ label  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool.label)
  * [ WebSearchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool)
    * [ search_context_size  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.search_context_size)
    * [ user_location  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.user_location)
    * [ blocked_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.blocked_domains)
    * [ allowed_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.allowed_domains)
    * [ max_uses  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.max_uses)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchTool.kind)
  * [ WebSearchUserLocation  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation)
    * [ city  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.city)
    * [ country  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.country)
    * [ region  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.region)
    * [ timezone  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation.timezone)
  * [ CodeExecutionTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.CodeExecutionTool)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.CodeExecutionTool.kind)
  * [ WebFetchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool)
    * [ max_uses  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.max_uses)
    * [ allowed_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.allowed_domains)
    * [ blocked_domains  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.blocked_domains)
    * [ enable_citations  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.enable_citations)
    * [ max_content_tokens  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.max_content_tokens)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool.kind)
  * [ UrlContextTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.UrlContextTool)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.UrlContextTool.kind)
  * [ ImageGenerationTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool)
    * [ background  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.background)
    * [ input_fidelity  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.input_fidelity)
    * [ moderation  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.moderation)
    * [ output_compression  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.output_compression)
    * [ output_format  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.output_format)
    * [ partial_images  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.partial_images)
    * [ quality  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.quality)
    * [ size  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.size)
    * [ aspect_ratio  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.aspect_ratio)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageGenerationTool.kind)
  * [ MemoryTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MemoryTool)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MemoryTool.kind)
  * [ MCPServerTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool)
    * [ id  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.id)
    * [ url  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.url)
    * [ authorization_token  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.authorization_token)
    * [ description  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.description)
    * [ allowed_tools  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.allowed_tools)
    * [ headers  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.MCPServerTool.headers)
  * [ FileSearchTool  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool)
    * [ file_store_ids  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool.file_store_ids)
    * [ kind  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.FileSearchTool.kind)
  * [ DEPRECATED_BUILTIN_TOOLS  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.DEPRECATED_BUILTIN_TOOLS)
  * [ SUPPORTED_BUILTIN_TOOLS  ](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.SUPPORTED_BUILTIN_TOOLS)


  1. [ Pydantic AI  ](https://ai.pydantic.dev/)
  2. [ API Reference  ](https://ai.pydantic.dev/api/ag_ui/)
  3. [ pydantic_ai  ](https://ai.pydantic.dev/api/ag_ui/)


# `pydantic_ai.builtin_tools`
###  BUILTIN_TOOL_TYPES `module-attribute`
```
BUILTIN_TOOL_TYPES: dict[](https://docs.python.org/3/library/stdtypes.html#dict)[str[](https://docs.python.org/3/library/stdtypes.html#str), type[](https://docs.python.org/3/library/functions.html#type)[AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")]] = (
    {}
)

```

Registry of all builtin tool types, keyed by their kind string.
This dict is populated automatically via `__init_subclass__` when tool classes are defined.
###  ImageAspectRatio `module-attribute`
```
ImageAspectRatio = Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")[
    "21:9",
    "16:9",
    "4:3",
    "3:2",
    "1:1",
    "9:16",
    "3:4",
    "2:3",
    "5:4",
    "4:5",
]

```

Supported aspect ratios for image generation tools.
###  AbstractBuiltinTool `dataclass`
Bases: `ABC[](https://docs.python.org/3/library/abc.html#abc.ABC "abc.ABC")`
A builtin tool that can be used by an agent.
This class is abstract and cannot be instantiated directly.
The builtin tools are passed to the model as part of the `ModelRequestParameters`.
Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
```
| ```
@dataclass(kw_only=True)
class AbstractBuiltinTool(ABC):
    """A builtin tool that can be used by an agent.

    This class is abstract and cannot be instantiated directly.

    The builtin tools are passed to the model as part of the `ModelRequestParameters`.
    """

    kind: str = 'unknown_builtin_tool'
    """Built-in tool identifier, this should be available on all built-in tools as a discriminator."""

    @property
    def unique_id(self) -> str:
        """A unique identifier for the builtin tool.

        If multiple instances of the same builtin tool can be passed to the model, subclasses should override this property to allow them to be distinguished.
        """
        return self.kind

    @property
    def label(self) -> str:
        """Human-readable label for UI display.

        Subclasses should override this to provide a meaningful label.
        """
        return self.kind.replace('_', ' ').title()

    def __init_subclass__(cls, **kwargs: Any) -> None:
        super().__init_subclass__(**kwargs)
        BUILTIN_TOOL_TYPES[cls.kind] = cls

    @classmethod
    def __get_pydantic_core_schema__(
        cls, _source_type: Any, handler: pydantic.GetCoreSchemaHandler
    ) -> core_schema.CoreSchema:
        if cls is not AbstractBuiltinTool:
            return handler(cls)

        tools = BUILTIN_TOOL_TYPES.values()
        if len(tools) == 1:  # pragma: no cover
            tools_type = next(iter(tools))
        else:
            tools_annotated = [Annotated[tool, pydantic.Tag(tool.kind)] for tool in tools]
            tools_type = Annotated[Union[tuple(tools_annotated)], pydantic.Discriminator(_tool_discriminator)]  # noqa: UP007

        return handler(tools_type)

```

---|---
####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'unknown_builtin_tool'

```

Built-in tool identifier, this should be available on all built-in tools as a discriminator.
####  unique_id `property`
```
unique_id: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

A unique identifier for the builtin tool.
If multiple instances of the same builtin tool can be passed to the model, subclasses should override this property to allow them to be distinguished.
####  label `property`
```
label: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

Human-readable label for UI display.
Subclasses should override this to provide a meaningful label.
###  WebSearchTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to search the web for information.
The parameters that PydanticAI passes depend on the model, as some parameters may not be supported by certain models.
Supported by:
  * Anthropic
  * OpenAI Responses
  * Groq
  * Google
  * xAI

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
```
| ```
@dataclass(kw_only=True)
class WebSearchTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to search the web for information.

    The parameters that PydanticAI passes depend on the model, as some parameters may not be supported by certain models.

    Supported by:

    * Anthropic
    * OpenAI Responses
    * Groq
    * Google
    * xAI
    """

    search_context_size: Literal['low', 'medium', 'high'] = 'medium'
    """The `search_context_size` parameter controls how much context is retrieved from the web to help the tool formulate a response.

    Supported by:

    * OpenAI Responses
    """

    user_location: WebSearchUserLocation | None = None
    """The `user_location` parameter allows you to localize search results based on a user's location.

    Supported by:

    * Anthropic
    * OpenAI Responses
    """

    blocked_domains: list[str] | None = None
    """If provided, these domains will never appear in results.

    With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.

    Supported by:

    * Anthropic, see <https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool#domain-filtering>
    * Groq, see <https://console.groq.com/docs/agentic-tooling#search-settings>
    * xAI, see <https://docs.x.ai/docs/guides/tools/search-tools#web-search-parameters>
    """

    allowed_domains: list[str] | None = None
    """If provided, only these domains will be included in results.

    With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.

    Supported by:

    * Anthropic, see <https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool#domain-filtering>
    * Groq, see <https://console.groq.com/docs/agentic-tooling#search-settings>
    * OpenAI Responses, see <https://platform.openai.com/docs/guides/tools-web-search>
    * xAI, see <https://docs.x.ai/docs/guides/tools/search-tools#web-search-parameters>
    """

    max_uses: int | None = None
    """If provided, the tool will stop searching the web after the given number of uses.

    Supported by:

    * Anthropic
    """

    kind: str = 'web_search'
    """The kind of tool."""

```

---|---
####  search_context_size `class-attribute` `instance-attribute`
```
search_context_size: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")["low", "medium", "high"] = (
    "medium"
)

```

The `search_context_size` parameter controls how much context is retrieved from the web to help the tool formulate a response.
Supported by:
  * OpenAI Responses


####  user_location `class-attribute` `instance-attribute`
```
user_location: WebSearchUserLocation[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebSearchUserLocation "WebSearchUserLocation \(pydantic_ai.builtin_tools.WebSearchUserLocation\)") | None = None

```

The `user_location` parameter allows you to localize search results based on a user's location.
Supported by:
  * Anthropic
  * OpenAI Responses


####  blocked_domains `class-attribute` `instance-attribute`
```
blocked_domains: list[](https://docs.python.org/3/library/stdtypes.html#list)[str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

If provided, these domains will never appear in results.
With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.
Supported by:
  * Anthropic, see <https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool#domain-filtering>
  * Groq, see <https://console.groq.com/docs/agentic-tooling#search-settings>
  * xAI, see <https://docs.x.ai/docs/guides/tools/search-tools#web-search-parameters>


####  allowed_domains `class-attribute` `instance-attribute`
```
allowed_domains: list[](https://docs.python.org/3/library/stdtypes.html#list)[str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

If provided, only these domains will be included in results.
With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.
Supported by:
  * Anthropic, see <https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool#domain-filtering>
  * Groq, see <https://console.groq.com/docs/agentic-tooling#search-settings>
  * OpenAI Responses, see <https://platform.openai.com/docs/guides/tools-web-search>
  * xAI, see <https://docs.x.ai/docs/guides/tools/search-tools#web-search-parameters>


####  max_uses `class-attribute` `instance-attribute`
```
max_uses: int[](https://docs.python.org/3/library/functions.html#int) | None = None

```

If provided, the tool will stop searching the web after the given number of uses.
Supported by:
  * Anthropic


####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'web_search'

```

The kind of tool.
###  WebSearchUserLocation
Bases: `TypedDict[](https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.TypedDict "typing_extensions.TypedDict")`
Allows you to localize search results based on a user's location.
Supported by:
  * Anthropic
  * OpenAI Responses

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
```
| ```
class WebSearchUserLocation(TypedDict, total=False):
    """Allows you to localize search results based on a user's location.

    Supported by:

    * Anthropic
    * OpenAI Responses
    """

    city: str
    """The city where the user is located."""

    country: str
    """The country where the user is located. For OpenAI, this must be a 2-letter country code (e.g., 'US', 'GB')."""

    region: str
    """The region or state where the user is located."""

    timezone: str
    """The timezone of the user's location."""

```

---|---
####  city `instance-attribute`
```
city: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The city where the user is located.
####  country `instance-attribute`
```
country: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The country where the user is located. For OpenAI, this must be a 2-letter country code (e.g., 'US', 'GB').
####  region `instance-attribute`
```
region: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The region or state where the user is located.
####  timezone `instance-attribute`
```
timezone: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The timezone of the user's location.
###  CodeExecutionTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to execute code.
Supported by:
  * Anthropic
  * OpenAI Responses
  * Google
  * Bedrock (Nova2.0)
  * xAI

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
```
| ```
@dataclass(kw_only=True)
class CodeExecutionTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to execute code.

    Supported by:

    * Anthropic
    * OpenAI Responses
    * Google
    * Bedrock (Nova2.0)
    * xAI
    """

    kind: str = 'code_execution'
    """The kind of tool."""

```

---|---
####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'code_execution'

```

The kind of tool.
###  WebFetchTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
Allows your agent to access contents from URLs.
The parameters that PydanticAI passes depend on the model, as some parameters may not be supported by certain models.
Supported by:
  * Anthropic
  * Google

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
```
| ```
@dataclass(kw_only=True)
class WebFetchTool(AbstractBuiltinTool):
    """Allows your agent to access contents from URLs.

    The parameters that PydanticAI passes depend on the model, as some parameters may not be supported by certain models.

    Supported by:

    * Anthropic
    * Google
    """

    max_uses: int | None = None
    """If provided, the tool will stop fetching URLs after the given number of uses.

    Supported by:

    * Anthropic
    """

    allowed_domains: list[str] | None = None
    """If provided, only these domains will be fetched.

    With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.

    Supported by:

    * Anthropic, see <https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-fetch-tool#domain-filtering>
    """

    blocked_domains: list[str] | None = None
    """If provided, these domains will never be fetched.

    With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.

    Supported by:

    * Anthropic, see <https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-fetch-tool#domain-filtering>
    """

    enable_citations: bool = False
    """If True, enables citations for fetched content.

    Supported by:

    * Anthropic
    """

    max_content_tokens: int | None = None
    """Maximum content length in tokens for fetched content.

    Supported by:

    * Anthropic
    """

    kind: str = 'web_fetch'
    """The kind of tool."""

```

---|---
####  max_uses `class-attribute` `instance-attribute`
```
max_uses: int[](https://docs.python.org/3/library/functions.html#int) | None = None

```

If provided, the tool will stop fetching URLs after the given number of uses.
Supported by:
  * Anthropic


####  allowed_domains `class-attribute` `instance-attribute`
```
allowed_domains: list[](https://docs.python.org/3/library/stdtypes.html#list)[str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

If provided, only these domains will be fetched.
With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.
Supported by:
  * Anthropic, see <https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-fetch-tool#domain-filtering>


####  blocked_domains `class-attribute` `instance-attribute`
```
blocked_domains: list[](https://docs.python.org/3/library/stdtypes.html#list)[str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

If provided, these domains will never be fetched.
With Anthropic, you can only use one of `blocked_domains` or `allowed_domains`, not both.
Supported by:
  * Anthropic, see <https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-fetch-tool#domain-filtering>


####  enable_citations `class-attribute` `instance-attribute`
```
enable_citations: bool[](https://docs.python.org/3/library/functions.html#bool) = False

```

If True, enables citations for fetched content.
Supported by:
  * Anthropic


####  max_content_tokens `class-attribute` `instance-attribute`
```
max_content_tokens: int[](https://docs.python.org/3/library/functions.html#int) | None = None

```

Maximum content length in tokens for fetched content.
Supported by:
  * Anthropic


####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'web_fetch'

```

The kind of tool.
###  UrlContextTool `dataclass` `deprecated`
Bases: `WebFetchTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.WebFetchTool "WebFetchTool



      dataclass
   \(pydantic_ai.builtin_tools.WebFetchTool\)")`
Deprecated
Use `WebFetchTool` instead.
Deprecated alias for WebFetchTool. Use WebFetchTool instead.
Overrides kind to 'url_context' so old serialized payloads with {"kind": "url_context", ...} can be deserialized to UrlContextTool for backward compatibility.
Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
255
256
257
258
259
260
261
262
263
264
265
```
| ```
@deprecated('Use `WebFetchTool` instead.')
@dataclass(kw_only=True)
class UrlContextTool(WebFetchTool):
    """Deprecated alias for WebFetchTool. Use WebFetchTool instead.

    Overrides kind to 'url_context' so old serialized payloads with {"kind": "url_context", ...}
    can be deserialized to UrlContextTool for backward compatibility.
    """

    kind: str = 'url_context'
    """The kind of tool (deprecated value for backward compatibility)."""

```

---|---
####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'url_context'

```

The kind of tool (deprecated value for backward compatibility).
###  ImageGenerationTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to generate images.
Supported by:
  * OpenAI Responses
  * Google

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
```
| ```
@dataclass(kw_only=True)
class ImageGenerationTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to generate images.

    Supported by:

    * OpenAI Responses
    * Google
    """

    background: Literal['transparent', 'opaque', 'auto'] = 'auto'
    """Background type for the generated image.

    Supported by:

    * OpenAI Responses. 'transparent' is only supported for 'png' and 'webp' output formats.
    """

    input_fidelity: Literal['high', 'low'] | None = None
    """
    Control how much effort the model will exert to match the style and features,
    especially facial features, of input images.

    Supported by:

    * OpenAI Responses. Default: 'low'.
    """

    moderation: Literal['auto', 'low'] = 'auto'
    """Moderation level for the generated image.

    Supported by:

    * OpenAI Responses
    """

    output_compression: int | None = None
    """Compression level for the output image.

    Supported by:

    * OpenAI Responses. Only supported for 'jpeg' and 'webp' output formats. Default: 100.
    * Google (Vertex AI only). Only supported for 'jpeg' output format. Default: 75.
      Setting this will default `output_format` to 'jpeg' if not specified.
    """

    output_format: Literal['png', 'webp', 'jpeg'] | None = None
    """The output format of the generated image.

    Supported by:

    * OpenAI Responses. Default: 'png'.
    * Google (Vertex AI only). Default: 'png', or 'jpeg' if `output_compression` is set.
    """

    partial_images: int = 0
    """
    Number of partial images to generate in streaming mode.

    Supported by:

    * OpenAI Responses. Supports 0 to 3.
    """

    quality: Literal['low', 'medium', 'high', 'auto'] = 'auto'
    """The quality of the generated image.

    Supported by:

    * OpenAI Responses
    """

    size: Literal['auto', '1024x1024', '1024x1536', '1536x1024', '1K', '2K', '4K'] | None = None
    """The size of the generated image.

    * OpenAI Responses: 'auto' (default: model selects the size based on the prompt), '1024x1024', '1024x1536', '1536x1024'
    * Google (Gemini 3 Pro Image and later): '1K' (default), '2K', '4K'
    """

    aspect_ratio: ImageAspectRatio | None = None
    """The aspect ratio to use for generated images.

    Supported by:

    * Google image-generation models (Gemini)
    * OpenAI Responses (maps '1:1', '2:3', and '3:2' to supported sizes)
    """

    kind: str = 'image_generation'
    """The kind of tool."""

```

---|---
####  background `class-attribute` `instance-attribute`
```
background: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")["transparent", "opaque", "auto"] = (
    "auto"
)

```

Background type for the generated image.
Supported by:
  * OpenAI Responses. 'transparent' is only supported for 'png' and 'webp' output formats.


####  input_fidelity `class-attribute` `instance-attribute`
```
input_fidelity: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")['high', 'low'] | None = None

```

Control how much effort the model will exert to match the style and features, especially facial features, of input images.
Supported by:
  * OpenAI Responses. Default: 'low'.


####  moderation `class-attribute` `instance-attribute`
```
moderation: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")['auto', 'low'] = 'auto'

```

Moderation level for the generated image.
Supported by:
  * OpenAI Responses


####  output_compression `class-attribute` `instance-attribute`
```
output_compression: int[](https://docs.python.org/3/library/functions.html#int) | None = None

```

Compression level for the output image.
Supported by:
  * OpenAI Responses. Only supported for 'jpeg' and 'webp' output formats. Default: 100.
  * Google (Vertex AI only). Only supported for 'jpeg' output format. Default: 75. Setting this will default `output_format` to 'jpeg' if not specified.


####  output_format `class-attribute` `instance-attribute`
```
output_format: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")['png', 'webp', 'jpeg'] | None = None

```

The output format of the generated image.
Supported by:
  * OpenAI Responses. Default: 'png'.
  * Google (Vertex AI only). Default: 'png', or 'jpeg' if `output_compression` is set.


####  partial_images `class-attribute` `instance-attribute`
```
partial_images: int[](https://docs.python.org/3/library/functions.html#int) = 0

```

Number of partial images to generate in streaming mode.
Supported by:
  * OpenAI Responses. Supports 0 to 3.


####  quality `class-attribute` `instance-attribute`
```
quality: Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")['low', 'medium', 'high', 'auto'] = 'auto'

```

The quality of the generated image.
Supported by:
  * OpenAI Responses


####  size `class-attribute` `instance-attribute`
```
size: (
    Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")[
        "auto",
        "1024x1024",
        "1024x1536",
        "1536x1024",
        "1K",
        "2K",
        "4K",
    ]
    | None
) = None

```

The size of the generated image.
  * OpenAI Responses: 'auto' (default: model selects the size based on the prompt), '1024x1024', '1024x1536', '1536x1024'
  * Google (Gemini 3 Pro Image and later): '1K' (default), '2K', '4K'


####  aspect_ratio `class-attribute` `instance-attribute`
```
aspect_ratio: ImageAspectRatio[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.ImageAspectRatio "ImageAspectRatio



      module-attribute
   \(pydantic_ai.builtin_tools.ImageAspectRatio\)") | None = None

```

The aspect ratio to use for generated images.
Supported by:
  * Google image-generation models (Gemini)
  * OpenAI Responses (maps '1:1', '2:3', and '3:2' to supported sizes)


####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'image_generation'

```

The kind of tool.
###  MemoryTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to use memory.
Supported by:
  * Anthropic

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
360
361
362
363
364
365
366
367
368
369
370
```
| ```
@dataclass(kw_only=True)
class MemoryTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to use memory.

    Supported by:

    * Anthropic
    """

    kind: str = 'memory'
    """The kind of tool."""

```

---|---
####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'memory'

```

The kind of tool.
###  MCPServerTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to use MCP servers.
Supported by:
  * OpenAI Responses
  * Anthropic
  * xAI

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
```
| ```
@dataclass(kw_only=True)
class MCPServerTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to use MCP servers.

    Supported by:

    * OpenAI Responses
    * Anthropic
    * xAI
    """

    id: str
    """A unique identifier for the MCP server."""

    url: str
    """The URL of the MCP server to use.

    For OpenAI Responses, it is possible to use `connector_id` by providing it as `x-openai-connector:<connector_id>`.
    """

    authorization_token: str | None = None
    """Authorization header to use when making requests to the MCP server.

    Supported by:

    * OpenAI Responses
    * Anthropic
    * xAI
    """

    description: str | None = None
    """A description of the MCP server.

    Supported by:

    * OpenAI Responses
    * xAI
    """

    allowed_tools: list[str] | None = None
    """A list of tools that the MCP server can use.

    Supported by:

    * OpenAI Responses
    * Anthropic
    * xAI
    """

    headers: dict[str, str] | None = None
    """Optional HTTP headers to send to the MCP server.

    Use for authentication or other purposes.

    Supported by:

    * OpenAI Responses
    * xAI
    """

    kind: str = 'mcp_server'

    @property
    def unique_id(self) -> str:
        return ':'.join([self.kind, self.id])

    @property
    def label(self) -> str:
        return f'MCP: {self.id}'

```

---|---
####  id `instance-attribute`
```
id: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

A unique identifier for the MCP server.
####  url `instance-attribute`
```
url: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The URL of the MCP server to use.
For OpenAI Responses, it is possible to use `connector_id` by providing it as `x-openai-connector:<connector_id>`.
####  authorization_token `class-attribute` `instance-attribute`
```
authorization_token: str[](https://docs.python.org/3/library/stdtypes.html#str) | None = None

```

Authorization header to use when making requests to the MCP server.
Supported by:
  * OpenAI Responses
  * Anthropic
  * xAI


####  description `class-attribute` `instance-attribute`
```
description: str[](https://docs.python.org/3/library/stdtypes.html#str) | None = None

```

A description of the MCP server.
Supported by:
  * OpenAI Responses
  * xAI


####  allowed_tools `class-attribute` `instance-attribute`
```
allowed_tools: list[](https://docs.python.org/3/library/stdtypes.html#list)[str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

A list of tools that the MCP server can use.
Supported by:
  * OpenAI Responses
  * Anthropic
  * xAI


####  headers `class-attribute` `instance-attribute`
```
headers: dict[](https://docs.python.org/3/library/stdtypes.html#dict)[str[](https://docs.python.org/3/library/stdtypes.html#str), str[](https://docs.python.org/3/library/stdtypes.html#str)] | None = None

```

Optional HTTP headers to send to the MCP server.
Use for authentication or other purposes.
Supported by:
  * OpenAI Responses
  * xAI


###  FileSearchTool `dataclass`
Bases: `AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")`
A builtin tool that allows your agent to search through uploaded files using vector search.
This tool provides a fully managed Retrieval-Augmented Generation (RAG) system that handles file storage, chunking, embedding generation, and context injection into prompts.
Supported by:
  * OpenAI Responses
  * Google (Gemini)

Source code in `pydantic_ai_slim/pydantic_ai/builtin_tools.py`
```
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
```
| ```
@dataclass(kw_only=True)
class FileSearchTool(AbstractBuiltinTool):
    """A builtin tool that allows your agent to search through uploaded files using vector search.

    This tool provides a fully managed Retrieval-Augmented Generation (RAG) system that handles
    file storage, chunking, embedding generation, and context injection into prompts.

    Supported by:

    * OpenAI Responses
    * Google (Gemini)
    """

    file_store_ids: Sequence[str]
    """The file store IDs to search through.

    For OpenAI, these are the IDs of vector stores created via the OpenAI API.
    For Google, these are file search store names that have been uploaded and processed via the Gemini Files API.
    """

    kind: str = 'file_search'
    """The kind of tool."""

```

---|---
####  file_store_ids `instance-attribute`
```
file_store_ids: Sequence[](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "collections.abc.Sequence")[str[](https://docs.python.org/3/library/stdtypes.html#str)]

```

The file store IDs to search through.
For OpenAI, these are the IDs of vector stores created via the OpenAI API. For Google, these are file search store names that have been uploaded and processed via the Gemini Files API.
####  kind `class-attribute` `instance-attribute`
```
kind: str[](https://docs.python.org/3/library/stdtypes.html#str) = 'file_search'

```

The kind of tool.
###  DEPRECATED_BUILTIN_TOOLS `module-attribute`
```
DEPRECATED_BUILTIN_TOOLS: frozenset[](https://docs.python.org/3/library/stdtypes.html#frozenset)[
    type[](https://docs.python.org/3/library/functions.html#type)[AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")]
] = frozenset[](https://docs.python.org/3/library/stdtypes.html#frozenset)({UrlContextTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.UrlContextTool "UrlContextTool



      dataclass
      deprecated
   \(pydantic_ai.builtin_tools.UrlContextTool\)")})

```

Set of deprecated builtin tool IDs that should not be offered in new UIs.
###  SUPPORTED_BUILTIN_TOOLS `module-attribute`
```
SUPPORTED_BUILTIN_TOOLS = frozenset[](https://docs.python.org/3/library/stdtypes.html#frozenset)(
    cls
    for cls in (values())
    if cls not in DEPRECATED_BUILTIN_TOOLS[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.DEPRECATED_BUILTIN_TOOLS "DEPRECATED_BUILTIN_TOOLS



      module-attribute
   \(pydantic_ai.builtin_tools.DEPRECATED_BUILTIN_TOOLS\)")
)

```

Get the set of all builtin tool types (excluding deprecated tools).
© Pydantic Services Inc. 2024 to present
