You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add creation from struct or cell array of struct
This is for interaction with MCP tool definitions
---------
Co-authored-by: Miriam Scharnke <[email protected]>
Copy file name to clipboardExpand all lines: +llms/+utils/errorMessageCatalog.m
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,8 @@
44
44
catalog = dictionary("string", "string");
45
45
catalog("llms:mustBeUnique") ="Values must be unique.";
46
46
catalog("llms:mustBeVarName") ="Parameter name must begin with a letter and contain not more than 'namelengthmax' characters.";
47
+
catalog("llms:mustBeNonzeroLengthTextOrStruct") ="Value must be a character vector, string scalar, scalar cell array of character vectors, struct, or cell array of structs.";
48
+
catalog("llms:mustOnlyBeStruct") ="When creating an openAIFunction object from tools provided by MCP servers, additional parameters are not supported.";
47
49
catalog("llms:parameterMustBeUnique") ="A parameter name equivalent to '{1}' already exists in Parameters. Redefining a parameter is not allowed.";
48
50
catalog("llms:mustBeAssistantCall") ="Input struct must contain field 'role' with value 'assistant', and field 'content'.";
49
51
catalog("llms:mustBeAssistantWithContent") ="Input struct must contain field 'content' containing text with one or more characters.";
Copy file name to clipboardExpand all lines: doc/functions/openAIFunction.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,14 @@ Use Function Calls from MATLAB®
8
8
9
9
`f = openAIFunction(name,description)`
10
10
11
+
`f = openAIFunction(mcpTool)`
12
+
11
13
## Description
12
14
13
15
An `openAIFunction` object represents a tool that you have, such as a MATLAB function. It includes information about the name, syntax, and behavior of the tool. If you pass an `openAIFunction` object to a large language model (LLM), then the LLM can suggest calls to the tool in its generated output. The LLM does not execute the tool itself. However, you can write scripts that automate the tool calls suggested by the LLM.
14
16
17
+
If you have the MATLAB MCP HTTP Client add\-on installed, then you can also use tools provided by external MCP servers.
18
+
15
19
Use `openAIFunction` objects to call tools using OpenAI® or Ollama™.
16
20
17
21
@@ -21,7 +25,9 @@ For example:
21
25

22
26
23
27
24
-
`f = openAIFunction(name,description)` creates an `openAIFunction` object.
28
+
`f = openAIFunction(name,description)` creates an `openAIFunction` object with a name `name` and description `description`.
29
+
30
+
`f = openAIFunction(mcpTool)` creates an `openAIFunction` object from one or more tools provided by an MCP server specified as a cell array of struct. For example, `mcpTool = client.Tools` for an `mcpHTTPClient` object `client` (requires the MATLAB MCP HTTP Client add\-on).
25
31
26
32
# Input Arguments
27
33
### `name` — Function name
@@ -38,6 +44,13 @@ Specify the function name and set the `FunctionName` property.
38
44
39
45
Describe the function using natural language and set the `Description` property.
40
46
47
+
### `mcpTool` — Tool provided by MCP server
48
+
cell array of struct
49
+
50
+
Tool provided by an external MCP server, specified as a cell array of struct (requires the MATLAB MCP HTTP Client add\-on).
51
+
52
+
For example, if you have an `mcpHTTPClient` (MATLAB MCP HTTP Client) object `client`, then you can specify `mcpTool` as `client.Tools`.
0 commit comments