load_model
Load a pre-trained machine learning model from OpenXAI MCP Server for evaluating AI explanations, specifying dataset and model type for use in benchmarking and analysis.
Instructions
Load a pre-trained model from OpenXAI
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data_name | Yes | Name of the dataset the model was trained on | |
| ml_model | Yes | Type of machine learning model (ann, lr, rf, svm, xgb) | |
| pretrained | No | Whether to load a pretrained model |
Implementation Reference
- index.js:525-562 (handler)The main handler function for the 'load_model' tool. It validates the model type, generates a Python code example using OpenXAI's LoadModel class, and returns a success message with usage instructions.async loadModel(dataName, mlModel, pretrained = true) { const modelInfo = { ann: 'Artificial Neural Network', lr: 'Logistic Regression', rf: 'Random Forest', svm: 'Support Vector Machine', xgb: 'XGBoost' }; const modelName = modelInfo[mlModel]; if (!modelName) { throw new Error(`Model type '${mlModel}' not supported. Available models: ${Object.keys(modelInfo).join(', ')}`); } const codeExample = ` # Example usage with OpenXAI: from openxai import LoadModel # Load the pre-trained model model = LoadModel(data_name='${dataName}', ml_model='${mlModel}', pretrained=${pretrained}) # Use the model for predictions # predictions = model.predict(input_data) `; return { content: [ { type: 'text', text: `Model loaded successfully!\n\n` + `Dataset: ${dataName}\n` + `Model type: ${modelName} (${mlModel})\n` + `Pretrained: ${pretrained}\n\n` + `Python code example:\n\`\`\`python${codeExample}\`\`\`` } ] }; }
- index.js:91-114 (registration)Registration of the 'load_model' tool in the MCP server's list of tools, including name, description, and input schema.{ name: 'load_model', description: 'Load a pre-trained model from OpenXAI', inputSchema: { type: 'object', properties: { data_name: { type: 'string', description: 'Name of the dataset the model was trained on' }, ml_model: { type: 'string', description: 'Type of machine learning model (ann, lr, rf, svm, xgb)', enum: ['ann', 'lr', 'rf', 'svm', 'xgb'] }, pretrained: { type: 'boolean', description: 'Whether to load a pretrained model', default: true } }, required: ['data_name', 'ml_model'] } },
- index.js:94-113 (schema)Input schema definition for the 'load_model' tool, specifying parameters data_name, ml_model (required), and optional pretrained boolean.inputSchema: { type: 'object', properties: { data_name: { type: 'string', description: 'Name of the dataset the model was trained on' }, ml_model: { type: 'string', description: 'Type of machine learning model (ann, lr, rf, svm, xgb)', enum: ['ann', 'lr', 'rf', 'svm', 'xgb'] }, pretrained: { type: 'boolean', description: 'Whether to load a pretrained model', default: true } }, required: ['data_name', 'ml_model'] }
- index.js:264-265 (handler)Dispatch handler in the central CallToolRequestSchema switch statement that routes 'load_model' calls to the loadModel method.case 'load_model': return await this.loadModel(args.data_name, args.ml_model, args.pretrained);