AIG. - AI Google Gemini Integration

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > A.Tools-Configuration >

AIG. - AI Google Gemini Integration

AIG.GetToolName

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.GetToolName
Identify the Requested Function

 

Intention

 

When the AI decides to call a tool, this command allows you to retrieve the exact name of that tool (e.g., "get_weather"). This is essential for manual dispatching logic if you are not using the automated AIG.DoToolCall workflow.

 

What is the GetToolName Command?

 

It extracts the string value associated with the "name" key from the JSON response generated by the AI.

It only returns a value if AIG.IsFuncCall is true. Otherwise, it returns an empty string.

 

Why Do You Need It?

 

Manual Routing: If you prefer using If..Then blocks instead of mapping labels.

Logging: To record which functions the AI is trying to access during debugging.

Validation: To verify that the AI is calling the function name correctly.

 

Example Usage

 

' 1. Ask AI something that requires a tool

AIG.Ask|Check the weather.

 

' 2. Check if a tool was called

AIG.IsFuncCall|$$IS_TOOL

IVV.$$IS_TOOL=1

 

 ' 3. Get the name

 AIG.GetToolName|$$NAME

 

 ' 4. Manual Dispatch

 IVV.$$NAME="get_weather"

 GOSUB :WeatherSub

 ELS.

 DBP. Unknown tool requested: $$NAME

 EIF.

 

EIF.

 

Syntax

 

AIG.GetToolName[|P1]

AIG.gtn[|P1]

 

Parameter Explanation

 

P1 - (Optional) Variable to store the tool name string (e.g., "calc_sum"). If omitted, result is on Top-Of-Stack.

 

See also:

 

? AIG.IsFuncCall

? AIG.GetToolParam

? AIG.DoToolCall (Automated version)