While GetMessages()
returns a list containing all messages from the last tool run, you can also get individual messages from the string using GetMessage()
.
Up to this point, we have
been returning all messages generated by the tool. However, you can return individual messages to your user through the GetMessage()
method, which takes an integer as a parameter indicating the particular message you'd like to retrieve. Each message generated by the tool is placed into a message list or array. We discussed list objects earlier in the book, so you'll remember that this is just a collection of some type of object. Just as a reminder: lists are zero-based, meaning that the first item in the list is located at position 0
. For example, GetMessage(0)
would return the first message in the list, while GetMessage(1)
would return the second message in the list. The first message will always be the tool being executed along with any parameters...