Skip to main content
Glama
Cappybara12

OpenXAI MCP Server

by Cappybara12

list_models

Retrieve available pre-trained AI models for evaluating explanation methods, with options to filter by dataset or model type.

Instructions

List available pre-trained models in OpenXAI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_nameNoFilter models by dataset they were trained on
model_typeNoFilter by model type (ann, lr, rf, etc.)

Implementation Reference

  • The handler function that implements the list_models tool logic. It defines available models, filters them by dataset_name and model_type, and returns a formatted list.
    async listModels(datasetName, modelType) {
      const models = {
        ann: {
          name: 'Artificial Neural Network',
          description: 'Multi-layer perceptron with configurable architecture',
          supported_datasets: ['german', 'compas', 'adult', 'folktable', 'mnist', 'cifar10'],
          task_types: ['classification', 'regression']
        },
        lr: {
          name: 'Logistic Regression',
          description: 'Linear model for classification with ground truth explanations',
          supported_datasets: ['german', 'compas', 'adult', 'folktable'],
          task_types: ['classification']
        },
        rf: {
          name: 'Random Forest',
          description: 'Ensemble of decision trees',
          supported_datasets: ['german', 'compas', 'adult', 'folktable'],
          task_types: ['classification', 'regression']
        },
        svm: {
          name: 'Support Vector Machine',
          description: 'Kernel-based classification model',
          supported_datasets: ['german', 'compas', 'adult', 'folktable'],
          task_types: ['classification']
        },
        xgb: {
          name: 'XGBoost',
          description: 'Gradient boosting framework',
          supported_datasets: ['german', 'compas', 'adult', 'folktable'],
          task_types: ['classification', 'regression']
        }
      };
    
      let result = [];
      if (modelType === 'all') {
        result = Object.entries(models).map(([key, value]) => ({
          type: key,
          ...value
        }));
      } else {
        result = models[modelType] ? [{ type: modelType, ...models[modelType] }] : [];
      }
    
      if (datasetName) {
        result = result.filter(model => model.supported_datasets.includes(datasetName));
      }
    
      return {
        content: [
          {
            type: 'text',
            text: `Available OpenXAI models${datasetName ? ` for dataset '${datasetName}'` : ''}:\n\n` +
                  JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the list_models tool, specifying optional parameters dataset_name and model_type with enums.
    inputSchema: {
      type: 'object',
      properties: {
        dataset_name: {
          type: 'string',
          description: 'Filter models by dataset they were trained on'
        },
        model_type: {
          type: 'string',
          description: 'Filter by model type (ann, lr, rf, etc.)',
          enum: ['ann', 'lr', 'rf', 'svm', 'xgb', 'all']
        }
      },
      required: []
    }
  • index.js:72-90 (registration)
    Registration of the list_models tool in the MCP server's tools list, including name, description, and schema.
    {
      name: 'list_models',
      description: 'List available pre-trained models in OpenXAI',
      inputSchema: {
        type: 'object',
        properties: {
          dataset_name: {
            type: 'string',
            description: 'Filter models by dataset they were trained on'
          },
          model_type: {
            type: 'string',
            description: 'Filter by model type (ann, lr, rf, etc.)',
            enum: ['ann', 'lr', 'rf', 'svm', 'xgb', 'all']
          }
        },
        required: []
      }
    },
  • index.js:261-263 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes list_models calls to the listModels method.
    case 'list_models':
      return await this.listModels(args.dataset_name, args.model_type || 'all');

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