Class MCPServerTools
java.lang.Object
org.machanism.machai.mcp.maven.tools.MCPServerTools
- All Implemented Interfaces:
org.machanism.machai.ai.tools.FunctionTools
Provides utility functions for managing the MCP server lifecycle. Implements
FunctionTools to expose server control operations as callable
functions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intDelay in milliseconds before the server process exits after shutdown is initiated.private final org.slf4j.LoggerLogger instance for server events and diagnostics. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstopMcpServer(int exitCode) Stops the MCP server by initiating a delayed shutdown.
-
Field Details
-
EXIT_DELAY
private static final int EXIT_DELAYDelay in milliseconds before the server process exits after shutdown is initiated.- See Also:
-
log
private final org.slf4j.Logger logLogger instance for server events and diagnostics.
-
-
Constructor Details
-
MCPServerTools
public MCPServerTools()
-
-
Method Details
-
stopMcpServer
Stops the MCP server by initiating a delayed shutdown.This method logs the shutdown event, waits for a predefined delay, and then exits the JVM with the specified exit code.
- Parameters:
exitCode- the exit code to use when shutting down the server (default is 0)- Returns:
- a message indicating that the shutdown has been initiated
-