Skip to main content
Glama
Cappybara12

OpenXAI MCP Server

by Cappybara12

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
NameRequiredDescriptionDefault
data_nameYesName of the dataset the model was trained on
ml_modelYesType of machine learning model (ann, lr, rf, svm, xgb)
pretrainedNoWhether to load a pretrained model

Implementation Reference

  • 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'] } },
  • 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'] }
  • 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);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cappybara12/mcpopenxAI'

If you have feedback or need assistance with the MCP directory API, please join our Discord server