get_config
Retrieve and display the complete configuration from the config.json file to manage settings and operations within the Agent Knowledge MCP server.
Instructions
Get the complete configuration from config.json file with formatted display
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/admin/admin_server.py:69-83 (handler)The primary handler for the 'get_config' MCP tool. Decorated with @app.tool, it loads the configuration using load_config(), formats it as a pretty-printed JSON string in a markdown code block, and handles errors with a formatted error message.@app.tool( description="Get the complete configuration from config.json file with formatted display", tags={"admin", "config", "get", "view", "settings"} ) async def get_config() -> str: """Get the complete configuration from config.json file.""" try: config = load_config() config_str = json.dumps(config, indent=2, ensure_ascii=False) return f"📄 Current configuration:\n\n```json\n{config_str}\n```" except Exception as e: return _format_admin_error(e, "get configuration", "config.json loading")
- src/config/config.py:9-32 (helper)Supporting utility function load_config() called by the get_config tool to load configuration from config.json, with fallback to config.default.json or minimal defaults.def load_config() -> Dict[str, Any]: """Load configuration from config.json with fallback to config.default.json.""" config_path = Path(__file__).parent.parent / "config.json" default_config_path = Path(__file__).parent.parent / "config.default.json" # Try to load config.json first try: with open(config_path, 'r', encoding='utf-8') as f: return json.load(f) except FileNotFoundError: # If config.json not found, try config.default.json try: print("⚠️ Configuration file config.json not found, using config.default.json") with open(default_config_path, 'r', encoding='utf-8') as f: return json.load(f) except FileNotFoundError: # Both files missing - return minimal default configuration print("⚠️ Both config.json and config.default.json not found, using minimal default configuration") return { "elasticsearch": {"host": "localhost", "port": 9200}, "security": {"allowed_base_directory": "/tmp/knowledge_base_secure"}, "server": {"name": "elasticsearch-mcp", "version": "0.1.0"} }
- src/main_server.py:78-81 (registration)Registration of the admin server (containing get_config tool) by mounting the admin_server_app into the main FastMCP app, making the tool available.# Mount Administrative operations server with 'admin' prefix # This provides: admin_get_config, admin_update_config, admin_server_status, etc. app.mount(admin_server_app)