AgentTool

interface AgentTool(source)

A function an agent loop can call: the on-device loops (OpenAI, Anthropic, Gemini, Ollama), and server agents that accept client-side tools (AG-UI frontend tools, AI SDK client tools). parameters is a JSON Schema object, shared verbatim by every API.

name must match ^[a-zA-Z0-9_-]{1,64}$ (the strictest provider rule). Long-running tools can report progress through ToolCallContext.current.

Inheritors

Properties

Link copied to clipboard
abstract val description: String
Link copied to clipboard
abstract val name: String
Link copied to clipboard
abstract val parameters: JsonObject
Link copied to clipboard

Ask the user before running (rendered as a Confirmation).

Link copied to clipboard
open val source: String?

Who provides the tool when it is not the agent itself (e.g. an MCP server), shown next to the title.

Link copied to clipboard
open val title: String?

Human-readable label for the UI (e.g. an MCP tool's title); null shows name.

Functions

Link copied to clipboard
open fun categoryFor(arguments: JsonObject): ToolCategory?

What one call does (ACP ToolKind vocabulary), which picks its step view; none by default.

Link copied to clipboard
abstract suspend fun execute(arguments: JsonObject): String

Run the tool. Throwing reports a tool error back to the model.

Link copied to clipboard
open fun kindFor(arguments: JsonObject): ToolKind

What one call means for the UI (a delegation, a skill load…); an ordinary function by default.

Link copied to clipboard
open fun locationFor(arguments: JsonObject): String?

The file path or URL one call acts on (ACP ToolCallLocation); none by default.

Link copied to clipboard
open fun titleFor(arguments: JsonObject): String?

Label for one call from its arguments (e.g. the skill or agent it names); defaults to title.