|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Queue Management - Listener queue operations > MCP Commands - Queue Management |
MiniRobot Language (MRL) - MCP Queue Management Commands
MCP.ResetQueue
Reset the Command Queue
Purpose
The MCP.ResetQueue command clears all pending commands from the MCP server's command queue and resets the queue state to its initial configuration. This is useful for recovering from error conditions, clearing stale commands, or preparing the queue for a new processing session.
This command is particularly useful when:
• Clearing stuck or hung commands from the queue
• Recovering from error conditions that left commands in an undefined state
• Preparing the server for a new batch of commands
• Canceling all pending operations without stopping the server
Syntax
MCP.ResetQueue|$$RETURN_VAR
Parameters
$$RETURN_VAR - The variable that will receive the result code (0 for success, non-zero for error).
Return Value
0 - Queue reset successfully
1 - MCP server not running
2 - Reset failed (queue locked by active operation)
Examples
' Example 1: Reset queue before starting new batch
MCP.ResetQueue|$$Status
IVV.$$Status!0
PRT.Queue cleared, ready for new commands
ELS.
PRT.Failed to reset queue: $$Status
EIF.
' Example 2: Emergency queue cleanup on error
LBL.ErrorHandler
PRT.Error detected, clearing queue...
MCP.ResetQueue|$$ResetStatus
' Continue with error recovery...
' Example 3: Check queue count and reset if full
MCP.GetQueueCount|$$Count
IVV.$$Count>100
PRT.Queue full, resetting...
MCP.ResetQueue|$$Result
EIF.
Remarks
When the queue is reset, all pending commands are discarded without being executed. Any commands currently in progress will complete normally unless they depend on queued commands. The queue configuration (size, mode, timeout) set by MCP.ConfigQueue is preserved during a reset.
If the queue is locked by an active operation that cannot be interrupted, the reset may fail with return code 2. In this case, wait for the operation to complete and retry the reset.
This command requires the MCP server to be running. If the server is not running, the command will return error code 1.
Error Conditions
The command will fail with a parameter error if:
• The return variable parameter is missing
• Too many parameters are provided
See also:
• MCP.ConfigQueue - Configure Listener Queue
• MCP.GetQueueCount - Get Queue Count