tools

An optional list of tools that are available to the language model. These could be registered tools available via lm.tools, or private tools that are just implemented within the calling extension.

If the LLM requests to call one of these tools, it will return a LanguageModelToolCallPart in LanguageModelChatResponse.stream. It's the caller's responsibility to invoke the tool. If it's a tool registered in lm.tools, that means calling lm.invokeTool.

Then, the tool result can be provided to the LLM by creating an Assistant-type LanguageModelChatMessage with a LanguageModelToolCallPart, followed by a User-type message with a LanguageModelToolResultPart.

Online Documentation