|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > MCP Commands - Data Tools |
MiniRobot Language (MRL) - MCP Server Feature
MCP Data Tools
Data Manipulation and Processing Commands
What are Data Tools?
The MCP Data Tools provide a comprehensive set of commands for manipulating, analyzing, and processing data stored in the MCP Data Store. These tools enable robot scripts to perform complex data operations without loading entire datasets into memory, making them ideal for working with large files and structured data.
Key Features
• Data Store Integration: Work with data stored in the MCP Data Store
• Line-Based Operations: Retrieve specific line ranges for pagination and chunking
• Text Search: Find text patterns with support for regular expressions
• Metadata Access: Get information about data size, line count, and properties
• Memory Efficient: Process large files without loading entire content
Available Commands
Core Data Commands:
MCP.DataGetInfo - Retrieve metadata and information about stored data (size, line count, type)
MCP.DataGetLines - Extract specific line ranges from data for pagination or chunk processing
MCP.DataFindText - Search for text patterns and regular expressions within stored data
SLL Implementation
The Data Tools are implemented in the MCP DataTools SLL (Static Link Library). The main implementation file is MCP_Datatools.inc which provides the core functionality for all data manipulation commands.
In addition to the documented commands above, the SLL implementation includes many more DataTools capabilities:
• Data chunking and splitting operations
• CSV to JSON conversion
• JSON selection and querying
• Data joining and merging
• Text normalization (newlines, whitespace)
• Key-value pair parsing
• Regular expression search and replace
• List sorting and manipulation
• Data looping and iteration
• Table to JSON conversion
Note: Additional DataTools commands may be documented and exposed in future releases.
Use Cases
Log File Analysis:
Use DataGetInfo to check log file size, then DataGetLines to retrieve recent entries, and DataFindText to search for error patterns or specific events.
Data Pagination:
Implement pagination for large datasets by using DataGetInfo to determine total lines, then DataGetLines to retrieve specific page ranges.
Content Validation:
Validate data content before processing by using DataFindText to check for required patterns, markers, or data formats.
Selective Processing:
Process large files in manageable chunks by retrieving specific line ranges, reducing memory usage and improving performance.
Data Format Support
Text Data:
Full support for plain text files with automatic line ending detection (CR, LF, CRLF). All Data Tools commands work with text data.
Structured Data:
Support for JSON, CSV, and key-value formatted data. The SLL includes specialized tools for parsing and converting between formats.
Binary Data:
Binary data is treated as text for line-based operations. Behavior may vary depending on content. DataGetInfo provides accurate size information for all data types.
Log Files:
Optimized for common log formats with timestamp prefixes, severity levels, and structured entries. DataFindText supports searching for log level patterns (ERROR, WARN, INFO, DEBUG).
Important Notes
• Data must be stored in the MCP Data Store before using Data Tools commands
• Line numbers are 1-based (first line is line 1)
• The Data Tools feature requires appropriate capabilities in the MCP server configuration
• Regular expression patterns use PCRE syntax
• Data keys are case-sensitive
• For large files, use DataGetLines with appropriate chunk sizes to manage memory usage
See also:
• MCP.DataGetInfo - Get Data Information
• MCP.DataGetLines - Get Lines from Data
• MCP.DataFindText - Find Text in Data