MCP Commands - Data Tools

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Data Tools - Data analysis operations >

MCP Commands - Data Tools

DataGetLines - Get Lines from Data

PreviousTopNext


MiniRobot Language (MRL) - MCP Data Tools Commands

 

MCP.DataGetLines

Get Lines from Data

 

Purpose

 

The MCP.DataGetLines command retrieves a specific range of lines from data stored in the MCP Data Store. This command is ideal for implementing pagination, processing large files in chunks, or extracting specific sections of data without loading the entire content into memory.

 

This command is particularly useful when:

• Working with large files that should be processed in chunks

• Implementing pagination for data display

• Extracting specific line ranges from log files

• Reading headers or footers from structured data

 

Syntax

 

MCP.DataGetLines|$$DATA_KEY|START_LINE|COUNT|$$RETURN_VAR

 

Parameters

 

$$DATA_KEY - The key identifier of the data in the MCP Data Store.

 

START_LINE - The line number to start from (1-based index).

 

COUNT - The number of lines to retrieve (use 0 for all remaining lines).

 

$$RETURN_VAR - The variable that will receive the requested lines.

 

Return Value

 

The command populates $$RETURN_VAR with the requested lines. Each line is separated by a newline character. If the start line is beyond the end of the data, an empty string is returned. If fewer lines are available than requested, all available lines are returned.

 

Examples

 

' Example 1: Get first 10 lines of data

MCP.DataGetLines|$$LogFile|1|10|$$Header

PRT.Header lines:

PRT.$$Header

 

' Example 2: Paginated data reading

' Display lines 101-150

MCP.DataGetLines|$$Dataset|101|50|$$PageData

PRT.Page 3:

PRT.$$PageData

 

' Example 3: Get remaining lines from a position

' Get all lines from line 1000 onwards

MCP.DataGetLines|$$LargeFile|1000|0|$$Remaining

PRT.Remaining content retrieved

 

Remarks

 

The MCP.DataGetLines command requires the Data Tools feature to be enabled in the MCP server configuration. Line numbers are 1-based, meaning the first line of data is line 1.

 

When COUNT is set to 0, the command retrieves all lines from START_LINE to the end of the data. This is useful when you want to get the remaining content after processing a header section.

 

For binary data, the command treats the content as text and splits on newline characters. The behavior may vary depending on the line ending format (CR, LF, or CRLF).

 

Error Conditions

 

The command will fail with an error if:

• The data key parameter is missing

• The start line parameter is missing or invalid

• The count parameter is missing or invalid

• The return variable parameter is missing

• The specified data key does not exist in the Data Store

• The MCP Data Tools feature is disabled

 

See also:

 

MCP.DataGetInfo - Get Data Information

MCP.DataFindText - Find Text in Data

Data Tools Overview