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.DoToolCall

Previous Top Next


MiniRobotLanguage (MRL)

 

AIG.DoToolCall
Automatic Tool Execution Dispatcher

 

Intention

 

To simplify the handling of Function Calls. This single command checks if the AI requested a tool, identifies which one, finds the corresponding Script Label (mapped via AIG.MapToolHandler), and automatically jumps to it using GOSUB.

 

What is the DoToolCall Command?

 

It acts as an "Event Manager" for AI tools. Instead of writing complex IVV logic to check function names yourself, you place this command after AIG.Ask.

Logic Flow:

1.Checks AIG.IsFuncCall. If 0 (False), it does nothing and returns.

2.Gets the tool name (e.g., "get_weather").

3.Looks up the mapped Label (e.g., ":Sub_Weather").

4.Executes GOSUB :Sub_Weather.

5.When the subroutine returns (via RET.), execution continues after AIG.DoToolCall.

 

Why Do You Need It?

 

Clean Code: Avoids messy "If..Then" blocks for every possible tool.

Modularity: Keeps tool logic in separate subroutines.

Scalability: Easily handle 10 or 20 different tools with a single dispatch command.

 

Example Usage

 

' 1. Register

AIG.MapToolHandler|calc_sum|:Tool_Calc

 

' 2. Run AI

AIG.Ask|Calculate 50 + 25.

 

' 3. Dispatch

AIG.DoToolCall|$$RESULT_STATUS

 

' 4. Check if something happened

IVV.$$RESULT_STATUS="OK"

 DBP.Tool executed successfully.

ELS.

 DBP.No tool was requested by AI.

EIF.

ENR.

 

' --- The Subroutine ---

:Tool_Calc

 ' (Logic to perform calculation)

 RET.

 

Syntax

 

AIG.DoToolCall[|P1]

AIG.dtc[|P1]

 

Parameter Explanation

 

P1 - (Optional) Variable to store the result status.

OK : A tool was called and the GOSUB executed.

NONE : No tool was requested by the AI.

(Empty/Error) : If mapping was missing.

 

See also:

 

? AIG.MapToolHandler

? AIG.GetToolParam