|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Memory Bank - Commands for storing and recalling data > MCP Commands - Memory Bank |
MiniRobot Language (MRL) - MCP Memory Bank
MEM.RCL
Recall/retrieve value from memory
Alias: MEM.Recall, MCP.MemRcl
Syntax
MEM.RCL|$$KEY|$$RETURN_VAR
Parameters
$$KEY
The key name of the value to retrieve. This must match exactly (case-sensitive) the key used with MEM.STO or MEM.S.
$$RETURN_VAR
The variable to receive the stored value. If the key does not exist, this variable will be set to empty string.
Return Value
The stored value is placed in $$RETURN_VAR. If the key does not exist, $$RETURN_VAR will be empty.
Description
MEM.RCL retrieves a value previously stored in the MCP Memory Bank using MEM.STO or MEM.S.
The key name must match exactly (case-sensitive). If no value exists for the specified key, the return variable will be set to an empty string.
Examples
Example 1: Store and recall a value
' Store data in memory
MEM.STO|$$Username|JohnDoe|PERM
' Later in the script, recall it
MEM.RCL|$$Username|$$CurrentUser
' $$CurrentUser now contains "JohnDoe"
Example 2: Check before recalling (recommended)
' Check if key exists before recalling
MEM.EXS|$$Config|$$HasConfig
IVV.$$HasConfig!1
MEM.RCL|$$Config|$$Settings
LBL.|Configuration loaded:
LBL.|$$Settings
EIV.
Example 3: Handle missing keys
' Try to recall a key that may not exist
MEM.RCL|$$OptionalData|$$Data
IVN.$$Data
VAR.$$Data=Default value
LBL.|No data found, using default
EIV.
Remarks
• The key name is case-sensitive. Use the exact same key name as used for storage.
• If the key doesn't exist, the return variable is set to an empty string (not an error).
• Use MEM.EXS to check if a key exists before recalling if you need to distinguish between empty values and missing keys.
• Values stored with PERM persistence will be recalled even after server restarts.
• For simple recall operations, consider using MEM.R as a shorter alternative.
• The Memory Bank feature requires the RESOURCES capability in MCP server configuration.
Related Commands
• MEM.STO - Store a value
• MEM.R - Simple recall (shortcut)
• MEM.EXS - Check if key exists
• MEM.DEL - Delete a key