|
<< 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 |
MiniRobot Language (MRL) - MCP Data Tools Commands
MCP.DataFindText
Find Text in Data
Purpose
The MCP.DataFindText command searches for specified text patterns within data stored in the MCP Data Store. This command supports both simple text matching and regular expression patterns, making it versatile for locating specific content within large datasets, log files, or structured documents.
This command is particularly useful when:
• Searching for specific keywords in log files
• Locating patterns in structured data
• Validating data content before processing
• Extracting lines containing specific markers
Syntax
MCP.DataFindText|$$DATA_KEY|$$PATTERN|$$RETURN_VAR
Parameters
$$DATA_KEY - The key identifier of the data in the MCP Data Store.
$$PATTERN - The text or regular expression pattern to search for.
$$RETURN_VAR - The variable that will receive the search results.
Return Value
The command populates $$RETURN_VAR with a structured result containing:
FOUND - Number of matches found (0 if none)
LINES - Comma-separated list of line numbers containing matches
MATCHES - The actual matching text segments
Examples
' Example 1: Simple text search
MCP.DataFindText|$$LogFile|ERROR|$$Results
PRT.Search results: $$Results
' Example 2: Regular expression search
' Find email addresses
MCP.DataFindText|$$ContactList|[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|$$Emails
PRT.Found emails: $$Emails
' Example 3: Check if pattern exists and process
MCP.DataFindText|$$Report|CRITICAL|$$CriticalLines
REG.Get|$$CriticalLines|FOUND|(\d+)|$$Count
IVV.$$Count!0
PRT.Critical issues found: $$Count
' Process critical lines...
ELS.
PRT.No critical issues found
EIF.
Remarks
The MCP.DataFindText command requires the Data Tools feature to be enabled in the MCP server configuration. The command performs a line-by-line search and returns all matching lines.
When using regular expressions, standard PCRE syntax is supported. Special regex characters must be properly escaped. The search is case-sensitive by default unless specified otherwise in the pattern.
For large datasets, consider using MCP.DataGetLines to retrieve smaller chunks before searching to improve performance.
Error Conditions
The command will fail with an error if:
• The data key parameter is missing
• The pattern parameter is missing
• The return variable parameter is missing
• The specified data key does not exist in the Data Store
• The regular expression pattern is invalid
• The MCP Data Tools feature is disabled
See also:
• MCP.DataGetInfo - Get Data Information
• MCP.DataGetLines - Get Lines from Data