Skip to main content

Module tool

Module tool 

Source
Available on crate feature tools only.
Expand description

Tool system and built-in tools.

Give agents capabilities beyond conversation:

  • FunctionTool - Wrap async functions as tools
  • GoogleSearchTool - Web search
  • ExitLoopTool - Control loop agents
  • McpToolset - MCP server integration with the mcp feature
  • CodeTool / PythonCodeTool / JavaScriptCodeTool / MontyPythonCodeTool - Code execution with the code-tools feature (included in full); the embedded live paths need code-embedded-js / code-embedded-python

Available with feature: tools

Modules§

builtin
Built-in tool wrappers for Gemini, OpenAI, and Anthropic hosted tools.
code_executioncode
Code execution tools for ADK agents.
mcpmcp
Model Context Protocol (MCP) clients, server SDK re-export, catalog APIs, elicitation, tasks, HTTP transport, and dynamic local-server management.
toolset
Toolset combinators: basic, filtered, merged, and prefixed toolsets.

Structs§

AdkError
Unified structured error type for all ADK-Rust operations.
AgentTool
AgentTool wraps an Agent to make it callable as a Tool.
AgentToolConfig
Configuration options for AgentTool behavior.
AnthropicBashTool20241022
Anthropic native bash tool declaration for the bash_20241022 version.
AnthropicBashTool20250124
Anthropic native bash tool declaration for the bash_20250124 version.
AnthropicTextEditorTool20250124
Anthropic native text editor declaration for text_editor_20250124.
AnthropicTextEditorTool20250429
Anthropic native text editor declaration for text_editor_20250429.
AnthropicTextEditorTool20250728
Anthropic native text editor declaration for text_editor_20250728.
AutoDeclineElicitationHandler
Default handler that declines all elicitation requests.
BasicToolset
A simple toolset that wraps a static list of tools with optional filtering.
BypassBuiltinTool
A built-in tool converted into a function-calling tool so it can coexist with custom function tools under the Gemini Interactions API.
CodeTool
A tool that executes code through language-specific pipelines.
ExitLoopTool
A control-flow tool that signals a loop agent to exit its iteration cycle.
FilteredToolset
A toolset wrapper that filters tools from an inner toolset using a predicate.
FrontendCodeTool
Container-backed frontend code execution tool.
FunctionTool
A tool created from an async Rust function.
GeminiCodeExecutionTool
Gemini built-in code execution tool.
GeminiComputerUseTool
Gemini built-in computer use tool declaration.
GeminiFileSearchTool
Gemini built-in file search tool.
GoogleMapsContext
Contextual Google Maps location used by Gemini retrieval config.
GoogleMapsTool
Gemini built-in Google Maps grounding tool.
GoogleSearchTool
GoogleSearch is a built-in tool that is automatically invoked by Gemini models to retrieve search results from Google Search. The tool operates internally within the model and does not require or perform local code execution.
JavaScriptCodeTool
Embedded JavaScript code execution tool.
LoadArtifactsTool
A tool that loads binary artifacts by name and returns their content.
McpHttpClientBuilder
Builder for HTTP-based MCP connections.
McpServerManager
Manages the full lifecycle of multiple local MCP server child processes.
McpTaskConfig
Configuration for MCP task-based execution
McpToolset
MCP Toolset - connects to an MCP server and exposes its tools as ADK tools.
MergedToolset
A toolset that merges tools from multiple inner toolsets into one.
MontyPythonCodeTool
Embedded Python code execution tool backed by the Monty interpreter.
MontyPythonCodeToolBuilder
Configures a MontyPythonCodeTool: OS-access grants, host functions, and limits are forwarded to MontyExecutorBuilder; the terminal methods select the mode.
OAuth2Config
OAuth2 configuration for MCP authentication
OpenAIApplyPatchTool
OpenAI apply_patch tool declaration.
OpenAIApproximateLocation
Approximate user location for OpenAI web search.
OpenAICodeInterpreterTool
OpenAI hosted code interpreter tool.
OpenAIComputerUseTool
OpenAI computer use tool declaration.
OpenAIFileSearchTool
OpenAI hosted file search tool.
OpenAIImageGenerationTool
OpenAI hosted image generation tool.
OpenAILocalShellTool
OpenAI local shell tool declaration.
OpenAIMcpTool
OpenAI remote MCP tool declaration.
OpenAIShellTool
OpenAI managed shell tool declaration.
OpenAIWebSearchTool
OpenAI hosted web search tool.
PrefixedToolset
A toolset wrapper that prefixes all tool names from an inner toolset.
PythonCodeTool
Container-backed Python code execution tool.
Resource
A known resource that the server is capable of reading (spec Resource).
ResourceTemplate
A template description for resources available on the server (spec ResourceTemplate).
SimpleToolContext
A lightweight ToolContext with sensible defaults for non-agent callers.
StatefulTool
A generic tool wrapper that manages shared state for stateful closures.
UrlContextTool
UrlContext is a built-in tool that is automatically invoked by Gemini models to fetch and analyze content from URLs. The tool operates internally within the model and does not require or perform local code execution.
WebSearchTool
WebSearch is a built-in tool for Anthropic Claude models that enables server-side web search. The model searches the web internally and returns results as ServerToolUse / WebSearchToolResult content blocks.
WebSearchUserLocation
Approximate user location for Anthropic’s web search tool.

Enums§

GeminiComputerEnvironment
Target environment for Gemini computer use.
McpAuth
Authentication configuration for MCP connections
OpenAIComputerEnvironment
OpenAI computer use environment.
ResourceContents
The contents of a specific resource or sub-resource.

Traits§

BypassMultiToolsLimit
Generalizes the bypass_multi_tools_limit conversion so any built-in tool can adopt it ergonomically.
ElicitationHandler
Trait for handling MCP elicitation requests from servers.
ResourceNotificationHandler
Receives resource update notifications from an MCP server.
Tool
The core trait for all tools that agents can invoke.
ToolContext
Context available to tools during execution.
Toolset
A collection of tools that can be resolved dynamically from context.

Functions§

string_predicate
Creates a predicate that allows only tools with names in the provided list.

Type Aliases§

Result
Convenience alias used throughout ADK crates.

Attribute Macros§

async_trait
tool
Attribute macro that generates a Tool implementation from an async function.