TTMSMCPPrompts.AddPrompt Method
Validates a prompt and appends a copy of it to the collection.
API unit family: TMS.MCP.Prompts
Declaring type: TTMSMCPPrompts
Syntax
function AddPrompt(const APrompt: TTMSMCPPrompt): Integer;
Remarks
The name, description, handler, title, icons and every declared argument are copied one by one, so the new prompt is independent of the one it was copied from.
Parameters
| Name | Description |
|---|---|
APrompt |
Prompt to copy. It is not adopted: the caller keeps it and remains responsible for freeing it unless it came from a builder. |
Returns
Index of the new prompt in the collection.
Exceptions
| Exception | Description |
|---|---|
EJsonRpcException |
Raised with invalid-parameters, error code -32602, when nothing was supplied, when the name is empty, when no handler is assigned, or when a prompt with the same name is already registered. |