McpAgentTool

class McpAgentTool(client: McpClient, val tool: McpTool, val server: McpServerConfig) : AgentTool(source)

One MCP tool as an AgentTool. The model sees <server>__<tool> (unique across servers, within the 64-character limit), the UI the tool's title and server name. Progress notifications stream as preliminary output; results the server flags isError become tool errors; questions the server asks the user (elicitation) go to the chat's dev.ai.elements.core.chat.ToolApprover.input.

Constructors

Link copied to clipboard
constructor(client: McpClient, tool: McpTool, server: McpServerConfig)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val parameters: JsonObject
Link copied to clipboard
open override val requiresApproval: Boolean

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

Link copied to clipboard
Link copied to clipboard
open override 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 override val title: String

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

Link copied to clipboard

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
open suspend override 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.