MCP Commands - Functional Memory

<< 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 Commands - Functional Memory

MCP.ReadLines / MCP.FM.ReadLines

PreviousTop


MiniRobot Language (MRL) - Functional Memory (SPR only - not in public MCP-Server)

 

⚡ SPR only - not in public MCP-Server FEATURE

This command is only available when using the MCP server as an SLL (Server-Side Library). It cannot be called via HTTP/MCP protocol.

 

MCP.ReadLines / MCP.FM.ReadLines

Read specific lines without deleting

 

Syntax

 

MCP.ReadLines|$$KEY|$$LINES_JSON|$$RETURN_VAR

MCP.FM.ReadLines|$$KEY|$$LINES_JSON|$$RETURN_VAR

 

Parameters

 

$$KEY

The Functional Memory key to read from, in the format Category::Function.

 

$$LINES_JSON

A JSON array of 1-based line numbers to retrieve (e.g., "[1, 5, 10]"). The line numbers specify which lines from the text-based result should be returned.

 

$$RETURN_VAR

The variable to receive a JSON object containing the requested lines, keyed by their line numbers.

 

Return Value

 

Returns a JSON object where keys are line numbers (as strings) and values are the corresponding line content. Returns a JSON error object if the key doesn't exist or the line numbers JSON is invalid.

Example: {"1": "First line", "5": "Fifth line", "10": "Tenth line"}

 

Description

 

MCP.ReadLines reads specific lines from a text-based result stored in Functional Memory without deleting the result. This is useful for "peeking" at large text results when you only need to examine specific portions.

 

Unlike MCP.Read, this command does not remove the result from Functional Memory, allowing multiple selective reads of the same data.

 

Examples

 

Example 1: Read first and last lines of a file

' Read lines 1 and 50 from a text file result

MCP.ReadLines|FileTools::ReadFile|[1,50]|$$Lines

DSP.First line:§§$$Lines.1

DSP.Line 50:§§$$Lines.50

 

Example 2: Preview header lines

' Get first 3 lines of a query result for preview

MCP.ReadLines|DataTools::Query|[1,2,3]|$$Preview

DSP.Preview of results:§§$$Preview

 

Example 3: Extract specific lines

' Get lines 5, 10, and 15 from log output

MCP.ReadLines|SystemTools::GetLog|[5,10,15]|$$LogLines

 

SLL Implementation

 

SLL Function: MCP_FM_ReadLines

Source File: MCP_FuncMem_Subs.inc

 

Remarks

 

• This command is SPR only - not in public MCP-Server and cannot be called via the MCP HTTP protocol

• The result is not deleted after reading (non-destructive)

• Line numbers are 1-based (first line is 1, not 0)

• Invalid line numbers are silently ignored

• Lines are split by CRLF (Windows-style line endings)

• The return value is a JSON object, not plain text

• Use for large text results where you only need specific portions

 

See also:

 

MCP.Read - Read full result (destructive)

MCP.Move - Move result to permanent memory

MCP.DataGetLines - Get lines from data