MCP Commands - Execution

<< 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 - Execution

MCP.Exec - Execute Action on MCP Server

PreviousTopNext


MiniRobot Language (MRL) - MCP Execution Commands

 

MCP.Exec / MCP.Execute

Execute an Action on the MCP Server

 

Purpose

 

The MCP.Exec command executes an action or command on the MCP server. This provides a generic interface for invoking MCP tools, utilities, and server functions from within MiniRobot scripts.

 

This command is used when:

• Invoking MCP tools and utilities

• Executing server-side functions

• Running diagnostic or maintenance actions

• Accessing MCP server capabilities not exposed through other commands

 

Syntax

 

MCP.Exec|$$ACTION_NAME|$$PARAMETERS|$$RETURN_VAR

 

MCP.Execute|$$ACTION_NAME|$$PARAMETERS|$$RETURN_VAR

 

Parameters

 

$$ACTION_NAME - The name of the MCP action or tool to execute. This must be a valid action registered with the MCP server.

 

$$PARAMETERS - Parameters for the action in the format required by the specific action. Use empty string for actions that require no parameters.

 

$$RETURN_VAR - The variable that will receive the action result or output.

 

Return Value

 

The return value depends on the specific action being executed. Common patterns include:

 

0 - Action executed successfully

1 - Unknown action (action not found)

2 - MCP server not running

3 - Invalid parameters for the action

4 - Action execution failed

 

Examples

 

' Example 1: Execute a system information action

MCP.Exec|GetSystemInfo||$$Result

PRT.System info: $$Result

 

' Example 2: Execute action with parameters

$$Params={"path":"C:\\Temp","recursive":true}

MCP.Exec|ListDirectory|$$Params|$$Files

PRT.Files: $$Files

 

' Example 3: Execute with error handling

MCP.Execute|RunDiagnostics||$$DiagResult

IVV.$$DiagResult!0

PRT.Diagnostics failed with code: $$DiagResult

ELS.

PRT.Diagnostics completed successfully

EIF.

 

' Example 4: Check if MCP server is running

MCP.Exec|Ping||$$PingResult

IVV.$$PingResult!0

PRT.MCP server is not responding

ELS.

PRT.MCP server is running: $$PingResult

EIF.

 

Remarks

 

The MCP.Exec command provides a generic interface to the MCP server's capabilities. Available actions depend on the MCP server configuration and loaded tool sets. Refer to the MCP server documentation for a list of available actions and their required parameters.

 

Parameters can be passed as simple strings, pipe-separated values, or JSON objects depending on what the action expects. When in doubt, consult the documentation for the specific action you are invoking.

 

MCP.Exec and MCP.Execute are aliases for the same command.

 

Error Conditions

 

The command will fail with a parameter error if:

• The action name parameter is missing

• The return variable parameter is missing

• Too many parameters are provided

 

See also:

 

MCP.Simulate - Simulate MCP Script Event

MCP.IsRunning - Check if MCP Server is Running

MCP Tool Categories Overview