updateMCPTool
Syntax
updateMCPTool(name, [func], [argNames], [argTypes], [description],
[extraInfo])
Arguments
name is a STRING scalar indicating the tool name.
func (optional) is a user-defined function.
argNames (optional) is a STRING vector specifying the argument names. Pass
[]
if no parameters are required.
argTypes (optional) is a STRING vector specifying the data types of arguments, which can be DolphinDB data types or JSON data types. Supported types include:
DolphinDB Type | JSON Type |
---|---|
STRING | "string" |
TEMPORAL | "string" |
DOUBLE | "number" |
BOOL | "boolean" |
STRING[] | "array<string>" |
TEMPORAL[] | "array<string>" |
DOUBLE[] | "array<number>" |
BOOL[] | "array<boolean>" |
description (optional) A STRING scalar describing the tool.
extraInfo (optional) A dictionary where keys are strings and values are of type ANY or STRING, used to specify additional metadata. Currently, the key "title" is supported.
Details
Updates an MCP tool.
If a parameter is not specified, the corresponding field remains unchanged. An empty string is treated as unspecified. To clear the field, pass a single space instead.
Return value: A string representing the name of the updated tool.
Examples
// Define a tool
def myTool(x) {
return x * 2 + 1
}
info = {
"title": "DolphinDB Tools"
}
addMCPTool("myTool", myTool, ["a"], ["number"], "This is a tool", info)
// Update the tool
def myNewTool(x, y) {
return x * 2 + y
}
updateMCPTool("myTool", myNewTool, ["a","b"], ["number","number"], " ")
// Update only extra information
newInfo = {
"title": "Updated Tools"
}
updateMCPTool(name="myTool", extraInfo=newInfo)