|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Task Management - Execute code and scripts > MCP Commands - Task Management |
MiniRobot Language (MRL) - MCP Task Management Commands
MCP.GetJobIdList
Retrieve List of All Active and Completed Jobs
Purpose
The MCP.GetJobIdList command retrieves a list of all job IDs currently tracked by the MCP server, including running, completed, and failed jobs. This is useful for monitoring, management, and cleanup operations.
This command is particularly useful when:
• Monitoring all active background tasks
• Implementing job management and cleanup routines
• Checking for orphaned jobs
• Building job status dashboards
Syntax
MCP.GetJobIdList|$$RETURN_VAR
Parameters
$$RETURN_VAR - The variable that will receive the list of job IDs.
Return Value
The command returns a list of job IDs, typically as a comma-separated string or in an array format. Each ID represents a background job that has been started and not yet cleaned up. Returns empty if no jobs exist.
Examples
' Example 1: Basic job list retrieval
MCP.GetJobIdList|$$AllJobs
PRT.Active jobs: $$AllJobs
' Example 2: Check job count before cleanup
MCP.GetJobIdList|$$JobList
LEN.$$JobList|$$JobCount
IVG.$$JobCount|0
PRT.There are $$JobCount jobs to clean up
MCP.CleanupJobs
ELS.
PRT.No jobs to clean up
EIF.
' Example 3: Monitor specific job status
' Start some jobs
MCP.RunCodeAsync|task_a()|python|$$JobA
MCP.RunCodeAsync|task_b()|python|$$JobB
' Check what jobs exist
MCP.GetJobIdList|$$CurrentJobs
PRT.Current jobs: $$CurrentJobs
' Example 4: Check if a specific job still exists
MCP.RunCodeAsync|long_task()|python|$$MyJob
' ... later in the script ...
MCP.GetJobIdList|$$ActiveJobs
FND.$$ActiveJobs|$$MyJob|$$JobExists
IVV.$$JobExists!0
PRT.My job is still active
ELS.
PRT.My job has completed or been cleaned up
EIF.
Remarks
GetJobIdList returns all jobs currently tracked by the MCP server, regardless of their status. This includes:
• Running jobs (still executing)
• Completed jobs (finished successfully)
• Failed jobs (terminated with error)
Jobs remain in the list until explicitly cleaned up using MCP.CleanupJobs. This allows you to retrieve results from completed jobs even after they finish.
The format of the returned list depends on the MCP implementation. It may be a comma-separated string, JSON array, or other format. Check your specific MCP server documentation for details.
Error Conditions
The command will fail with a parameter error if:
• The return variable parameter is missing
See also:
• MCP.CleanupJobs - Clean Up Jobs
• MCP.CheckJobResult - Check Job Result
• MCP.RunCodeAsync - Execute Code Asynchronously