AI agent tool from MCP server
Use an MCPTool object to define an AI agent tool from an MCP
server.
Create an MCPTool object by using the aisdk.LLMTool
function and specifying an mcpHTTPClient object as the input argument.
Read-only: structure
This property is read-only.
Input argument schema, specified as a structure.
The software derives the input argument structure from the input schema provided by the MCP server.
Data Types: struct
Read-only: structure
This property is read-only.
Output argument schema, specified as a structure.
The software derives the output argument structure from the output schema provided by the MCP server.
Data Types: struct
"never"
(default) |
"always"
|
"once"
Option to request human approval, specified as "never",
"always", or "once".
Use this property to specify if the human user must approve the tool before the agent evaluates it.
-
"never"— Tool does not require approval. -
"always"— Always ask for approval before executing the tool. -
"once"— Ask for approval the first time the agent calls the tool. The user can choose to allow tool execution without additional approval requests for the remainder of the agent session.
Data Types: string
string scalar
Tool name, specified as a string scalar.
By default, the tool name is the name provided by the MCP server.
Data Types: string
string scalar
Tool description, specified as a string scalar.
By default, the tool description is the description provided by the MCP server.
Data Types: string
string scalar | character vector
Display title, specified as a string scalar or character vector.
By default, the display title is the title provided by the MCP server.
The agent does not see the display title. Use the display title to create human-readable displays, and for postprocessing and analysis.
Example: "Sine Function"
Data Types: char | string
structure
Tool annotations, specified as a structure.
By default, the software uses the tool annotations provided by the MCP server.
Specify tool annotations to configure the tool behavior in a custom or external application or API.
For example, display a warning message to the end user when the agent calls a tool
that is able to overwrite or delete data. First, add an annotation to the tool:
tool.Annotations.destructiveHint = true. Then, in your application,
verify whether the Annotations property of a called tool has a
field destructiveHint with value false. If it does
not, then display a warning.
Data Types: struct
To create one or more AI tools from the tools provided by an MCP
server, first connect to the MCP server by using the mcpHTTPClient
function. Then, use the client as the input to the aisdk.LLMTool function.
Connect to an MCP server with server endpoint endpoint by using
the mcpHTTPClient function.
client = mcpHTTPClient(endpoint);
Create an AI tool from the MCP server by using the aisdk.LLMTool function.
tool = aisdk.LLMTool(client);
If the MCP server provides more than one tool, then tool is an
array of MCPTool objects.
aisdk.LLMTool | LocalLLMTool | aisdk.AIAgent | select | aisdk.LLMClient
Copyright 2026 The MathWorks, Inc.