MCP.FMExec - Execute Functional Memory Command

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Functional Memory - Tool execution and security management (SLL-ONLY) >

MCP.FMExec - Execute Functional Memory Command

MCP.FMExec executes a Functional Memory command through the SLL engine and returns the result as JSON.

Syntax:

MCP.FMExec|$$KEY[|$$PARAMS]|$$RET_JSON

Parameters:

$$KEY (String, required) - The function key/tool to execute. Can be a tool category::name (e.g., "FileTools::ReadFile") or a configured Functional Memory key.

$$PARAMS (String, optional) - JSON string containing the parameters for the function. If omitted, the function is called with no parameters.

$$RET_JSON (Variable, required) - Variable to receive the JSON result string from the function execution.

Return Value:

Returns a JSON object in $$RET_JSON containing the result of the function execution. The structure depends on the specific function called.

Result Field

Description

success

Boolean indicating if the operation succeeded (true/false)

content

The actual result content (varies by function)

error

Error message if success is false

Examples:

Execute FileTools::ReadFile

; Set up parameters for reading a file

SET params = {"path":"C:\\Data\\config.json"}

 

; Execute the read file command

MCP.FMExec|FileTools::ReadFile|%params%|result

 

; Check result

PSJ.Parse|%result%|parsed

PSJ.GetValue|parsed|success|didSucceed

PSJ.GetValue|parsed|content|fileContent

Execute without parameters

; Get server status (no parameters needed)

MCP.FMExec|ServerTools::GetStatus|statusResult

 

; Parse and display

PSJ.Parse|%statusResult%|status

PSJ.GetValue|status|content.running|isRunning

Notes:

This command requires the MCP SLL library to be loaded (via MCP.Init)The robot command is MCP.FMExec (no dot between FM and Exec)The function key format is typically Category::ToolName (e.g., "FileTools::ReadFile", "DataTools::GetLines")Parameters must be a valid JSON object stringUse MCP.FM.GetSecurityState to check if a function is enabled before calling

See Also:

MCP.FMGetSecurityState - Check if a function is enabledMCP.FMRead - Read results from Functional MemoryMCP.Data.GetInfo - Direct DataTools wrapperFunctional Memory Overview