reload_config
Reload configuration from config.json to update and reinitialize all components with new settings, ensuring the MCP server operates with the latest parameters.
Instructions
Reload configuration from config.json file and reinitialize all components with updated settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/admin/admin_server.py:306-346 (handler)The reload_config tool handler function. Loads configuration from config.json, reinitializes security and Elasticsearch components, and returns a formatted status message with error handling.@app.tool( description="Reload configuration from config.json file and reinitialize all components with updated settings", tags={"admin", "config", "reload", "refresh", "reinitialize"} ) async def reload_config() -> str: """Reload configuration and reinitialize all system components with updated settings.""" try: # Reload configuration from file config = load_config() # Reinitialize security with updated allowed directory init_security(config["security"]["allowed_base_directory"]) # Reinitialize Elasticsearch with updated configuration init_elasticsearch(config) reset_es_client() # Format success message with key configuration details message = "✅ Configuration reloaded successfully!\n\n" message += "🔄 **Components Reinitialized:**\n" message += f" 🔒 Security: {get_allowed_base_dir()}\n" message += f" 🔍 Elasticsearch: {config['elasticsearch']['host']}:{config['elasticsearch']['port']}\n" # Show additional configuration summary if "server" in config: server_config = config["server"] message += f" 🚀 Server: {server_config.get('name', 'AgentKnowledgeMCP')} v{server_config.get('version', '1.0.0')}\n" message += f"\n💡 All system components now use the updated configuration from config.json" return message except KeyError as e: return f"❌ Configuration Error: Missing required configuration key: {str(e)}\n💡 Check config.json structure and ensure all required sections are present" except FileNotFoundError: return f"❌ File Error: config.json not found\n💡 Ensure config.json exists in the source directory" except json.JSONDecodeError as e: return f"❌ JSON Error: Invalid JSON format in config.json\n🔍 Details: {str(e)}\n💡 Check JSON syntax and structure" except Exception as e: return _format_admin_error(e, "reload configuration", "component reinitialization")