|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Logging & Security - Logging and access control > MCP Commands - Logging & Security |
MiniRobot Language (MRL) - MCP Logging & Security Commands
MCP.ToolGetState
Retrieve Current State of a Tool
Purpose
The MCP.ToolGetState command retrieves the current state (enabled/disabled status) of a specific MCP tool. This allows scripts to check whether a tool is available for use before attempting to invoke it.
This is useful for conditional logic based on tool availability, error handling, and dynamic script adaptation to the current MCP server configuration.
Syntax
MCP.ToolGetState|$$TOOL_NAME|$$RETURN_VAR
Parameters
$$TOOL_NAME - The name of the tool to check. This should match the tool identifier as registered with the MCP server (e.g., "FileRead", "RegistryWrite", "ExecuteCommand").
$$RETURN_VAR - The variable that will receive the tool state (ENABLED, DISABLED, or UNKNOWN).
Return Value
ENABLED - The tool is enabled and available for use
DISABLED - The tool is disabled and cannot be invoked
UNKNOWN - The tool name was not recognized by the server
Examples
' Example 1: Check if FileRead tool is enabled
MCP.ToolGetState|FileRead|$$State
IVV.$$State!ENABLED
FIL.Read|C:\data.txt|$$Content
ELS.
PRT.FileRead tool is not available
EIF.
' Example 2: Check multiple tools before execution
MCP.ToolGetState|RegistryRead|$$RegState
MCP.ToolGetState|RegistryWrite|$$RegWriteState
PRT.Read: $$RegState, Write: $$RegWriteState
Remarks
Tool names are case-sensitive and must match exactly as registered with the MCP server. Use MCP.ToolGetStatePattern to query multiple tools using wildcards.
The tool state can be modified at runtime using MCP.ToolSetState.
Error Conditions
The command will fail with a parameter error if:
• The tool name parameter is missing
• The return variable parameter is missing
• Too many parameters are provided
See also:
• MCP.ToolSetState - Set Tool State
• MCP.ToolGetStatePattern - Get Tool State Pattern