debug_connection
Analyze and troubleshoot connection settings and environment variables for seamless integration between MCP clients and TrueNAS Core systems.
Instructions
Debug connection settings and environment variables
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "debug_connectionArguments",
"type": "object"
}
Implementation Reference
- truenas_mcp_server/tools/debug.py:22-55 (handler)The main handler function for the 'debug_connection' tool. It returns a dictionary with debug information about environment variables (with masked API key), client connection status, and feature flags.async def debug_connection(self) -> Dict[str, Any]: """ Debug connection settings and environment variables Returns: Dictionary containing debug information """ await self.ensure_initialized() # Mask sensitive data api_key = self.settings.truenas_api_key.get_secret_value() masked_key = f"{api_key[:8]}...{api_key[-4:]}" if len(api_key) > 12 else "***" return { "success": True, "environment": { "TRUENAS_URL": str(self.settings.truenas_url), "TRUENAS_API_KEY": masked_key, "TRUENAS_VERIFY_SSL": self.settings.truenas_verify_ssl, "TRUENAS_ENV": self.settings.environment, "TRUENAS_LOG_LEVEL": self.settings.log_level }, "client": { "connected": self.client._client is not None if self.client else False, "base_url": self.settings.api_base_url, "timeout": self.settings.http_timeout, "max_retries": self.settings.http_max_retries }, "features": { "debug_tools": self.settings.enable_debug_tools, "destructive_operations": self.settings.enable_destructive_operations, "rate_limiting": self.settings.rate_limit_enabled } }
- truenas_mcp_server/tools/debug.py:13-19 (registration)Registers the 'debug_connection' tool (along with test_connection and get_server_stats) in the DebugTools class's tool definitions list, specifying the handler, description, and empty input schema.def get_tool_definitions(self) -> list: """Get tool definitions for debug tools""" return [ ("debug_connection", self.debug_connection, "Debug connection settings and environment variables", {}), ("test_connection", self.test_connection, "Test the connection to TrueNAS API", {}), ("get_server_stats", self.get_server_stats, "Get MCP server statistics", {}), ]