A tool set is a component that carries a group of ready-declared function-calling tools. Drop one next to a TTMSMCPCloudAI, point its AI property at that component, and the model can call every tool in the set from the next request onwards — with no tool declaration, no parameter schema, and no handler of your own. TMS AI Studio ships four of them: TTMSMCPCloudAILogger writes results to a dialog, the console, or a file; TTMSMCPCloudAIFileSystem lists, reads, writes, copies, and moves files; TTMSMCPCloudAIDataSet exposes an open dataset through a TDataSource; and TTMSMCPCloudAIEmail sends mail over SMTP and reads it back over POP3. They all derive from TTMSMCPCloudAIToolSet, so your own sets attach the same way.
The component a tool set attaches to, and the one that actually issues the request.
Minimal example
procedure TForm1.FormCreate(Sender: TObject);
begin
{ AI is a TTMSMCPCloudAI on the form. The keys were written once with
AI.APIKeys.SaveToFile, so no secret is present in this source. }
AI.APIKeys.LoadFromFile(KeyStoreFileName, KeyStorePassword);
AI.Service := aiOpenAI;
AI.OnExecuted := AIExecuted;
{ One component, and the model can now list folders, read text files,
write them, copy and move them. No tool declaration of your own. }
FFiles := TTMSMCPCloudAIFileSystem.Create(Self);
FFiles.AI := AI;
end;
procedure TForm1.btnAskClick(Sender: TObject);
begin
if AI.Busy then
Exit;
AI.SystemRole.Text :=
'Answer only from the file system tools. Never invent a file name.';
AI.Context.Text :=
'Which log files are in the reports folder, and what does the newest ' +
'one end with?';
AI.Execute;
end;
procedure TForm1.AIExecuted(Sender: TObject; AResponse: TTMSMCPCloudAIResponse;
AHttpStatusCode: Integer; AHttpResult: string);
begin
if Assigned(AResponse) then
memoAnswer.Lines.Text := AResponse.Content.Text
else
memoAnswer.Lines.Text := Format('Request failed (%d): %s',
[AHttpStatusCode, AHttpResult]);
end;
The AI property and what registration does, how a set's tools reach the model, inspecting and disabling individual tools, moving a set between components, teardown order, and extending a shipped set with a tool of your own.
Every tool in the logger, file system, dataset, and email sets — its arguments, what it returns, the properties it reads, and the ordering each set expects.