MCP Commands - Server Management

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Server Operations - Server control and execution >

MCP Commands - Server Management

Signal - Send Signal to MCP Server

PreviousTopNext


MiniRobot Language (MRL) - MCP Server Management Commands

 

MCP.Signal

Send Signal to MCP Server

 

Purpose

 

The MCP.Signal command sends a control signal to the MCP server to perform specific management actions. This command provides a way to control server behavior, trigger maintenance operations, or gracefully manage server state without restarting the service.

 

This command is particularly useful when:

• Reloading configuration without restart

• Gracefully shutting down the server

• Triggering log rotation

• Clearing caches or resetting state

 

Syntax

 

MCP.Signal|SIGNAL_TYPE|$$PARAMS|$$RETURN_VAR

 

Parameters

 

SIGNAL_TYPE - The type of signal to send (RELOAD, SHUTDOWN, FLUSH, etc.).

 

$$PARAMS - Optional parameters for the signal (use empty string if none).

 

$$RETURN_VAR - The variable that will receive the signal result.

 

Signal Types

 

RELOAD - Reload configuration from disk

SHUTDOWN - Gracefully stop the server

FLUSH - Flush caches and temporary data

ROTATE_LOGS - Rotate log files

PING - Check server responsiveness

RESET - Reset internal state and connections

 

Return Value

 

The command populates $$RETURN_VAR with a status string:

OK - Signal processed successfully

ERROR: [message] - Signal processing failed

 

Examples

 

' Example 1: Reload configuration

MCP.Signal|RELOAD||$$Result

PRT.Reload result: $$Result

 

' Example 2: Ping server to check status

MCP.Signal|PING||$$PingResult

SCH.Eq|$$PingResult|OK|$$Alive

IVV.$$Alive!0

PRT.Server is responsive

ELS.

PRT.Server not responding: $$PingResult

EIF.

 

' Example 3: Flush caches and rotate logs

MCP.Signal|FLUSH||$$FlushResult

MCP.Signal|ROTATE_LOGS||$$LogResult

PRT.Maintenance completed

 

' Example 4: Graceful shutdown with delay

PRT.Initiating server shutdown...

MCP.Signal|SHUTDOWN|graceful|$$ShutdownResult

 

Remarks

 

The MCP.Signal command provides a controlled way to manage the MCP server state. Signals are processed asynchronously, and the return value indicates whether the signal was accepted for processing, not necessarily the completion status of the action.

 

The SHUTDOWN signal initiates a graceful shutdown sequence, allowing pending operations to complete before the server stops. Use with caution as this will terminate the MCP server.

 

Signal processing may be restricted based on the caller's permissions. Administrative privileges may be required for certain signals like SHUTDOWN or RESET.

 

Error Conditions

 

The command will fail with an error if:

• The signal type parameter is missing

• The signal type is unknown or unsupported

• The return variable parameter is missing

• Insufficient permissions to send the signal

• The server is in a state that cannot process signals

 

See also:

 

MCP.RunCommand - Run Command on MCP Server

MCP.WriteConfig - Write Configuration

Server Management Overview