Skip to main content
Glama
Cappybara12

OpenXAI MCP Server

by Cappybara12

list_metrics

Discover available evaluation metrics for AI explanation methods, filtering by metric type to assess faithfulness, stability, or fairness.

Instructions

List available evaluation metrics in OpenXAI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metric_typeNoFilter by metric type (faithfulness, stability, fairness)

Implementation Reference

  • The primary handler function `listMetrics(metricType)` that executes the tool logic. It defines metrics grouped by categories (faithfulness, stability, ground_truth) and returns filtered list based on input metric_type or 'all', formatted as MCP content response.
    async listMetrics(metricType) {
      const metrics = {
        faithfulness: {
          PGI: {
            name: 'Prediction Gap on Important feature perturbation',
            description: 'Measures the difference in prediction probability when perturbing important features',
            higher_is_better: true
          },
          PGU: {
            name: 'Prediction Gap on Unimportant feature perturbation',
            description: 'Measures the difference in prediction probability when perturbing unimportant features',
            higher_is_better: false
          }
        },
        stability: {
          RIS: {
            name: 'Relative Input Stability',
            description: 'Measures maximum change in explanation relative to changes in inputs',
            higher_is_better: false
          },
          RRS: {
            name: 'Relative Representation Stability',
            description: 'Measures maximum change in explanation relative to changes in internal representation',
            higher_is_better: false
          },
          ROS: {
            name: 'Relative Output Stability',
            description: 'Measures maximum change in explanation relative to changes in output predictions',
            higher_is_better: false
          }
        },
        ground_truth: {
          FA: {
            name: 'Feature Agreement',
            description: 'Fraction of top-K features common between explanation and ground truth',
            higher_is_better: true
          },
          RA: {
            name: 'Rank Agreement',
            description: 'Fraction of top-K features with same rank in explanation and ground truth',
            higher_is_better: true
          },
          SA: {
            name: 'Sign Agreement',
            description: 'Fraction of top-K features with same sign in explanation and ground truth',
            higher_is_better: true
          },
          SRA: {
            name: 'Signed Rank Agreement',
            description: 'Fraction of top-K features with same sign and rank in explanation and ground truth',
            higher_is_better: true
          },
          RC: {
            name: 'Rank Correlation',
            description: 'Spearman rank correlation between explanation and ground truth rankings',
            higher_is_better: true
          },
          PRA: {
            name: 'Pairwise Rank Agreement',
            description: 'Fraction of feature pairs with same relative ordering in explanation and ground truth',
            higher_is_better: true
          }
        }
      };
    
      let result = [];
      if (metricType === 'all') {
        result = Object.entries(metrics).map(([category, categoryMetrics]) => ({
          category,
          metrics: Object.entries(categoryMetrics).map(([key, value]) => ({
            metric: key,
            ...value
          }))
        }));
      } else {
        const categoryMetrics = metrics[metricType];
        if (categoryMetrics) {
          result = [{
            category: metricType,
            metrics: Object.entries(categoryMetrics).map(([key, value]) => ({
              metric: key,
              ...value
            }))
          }];
        }
      }
    
      return {
        content: [
          {
            type: 'text',
            text: `Available OpenXAI evaluation metrics:\n\n` +
                  JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • index.js:157-171 (registration)
    Registration of the 'list_metrics' tool in the ListToolsRequest handler, including name, description, and inputSchema.
    {
      name: 'list_metrics',
      description: 'List available evaluation metrics in OpenXAI',
      inputSchema: {
        type: 'object',
        properties: {
          metric_type: {
            type: 'string',
            description: 'Filter by metric type (faithfulness, stability, fairness)',
            enum: ['faithfulness', 'stability', 'fairness', 'all']
          }
        },
        required: []
      }
    },
  • The inputSchema for the 'list_metrics' tool, defining optional metric_type parameter with enum ['faithfulness', 'stability', 'fairness', 'all']. Note: enum has 'fairness' but code uses 'ground_truth'; possible discrepancy.
    inputSchema: {
      type: 'object',
      properties: {
        metric_type: {
          type: 'string',
          description: 'Filter by metric type (faithfulness, stability, fairness)',
          enum: ['faithfulness', 'stability', 'fairness', 'all']
        }
      },
      required: []
  • The switch case dispatcher in CallToolRequestHandler that routes 'list_metrics' calls to the listMetrics method.
    case 'list_metrics':
      return await this.listMetrics(args.metric_type || 'all');
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action. It doesn't cover aspects like whether this is a read-only operation, potential rate limits, authentication needs, or what the output format might be (e.g., list structure, pagination).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one well-documented parameter and no output schema, the description is minimally adequate but lacks context about the tool's role in the broader system (e.g., how metrics relate to other tools like 'evaluate_explanation'). It doesn't fully leverage the opportunity to guide usage in this complex domain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage, fully documenting the single optional parameter with its enum values. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline for high schema coverage without compensating further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('available evaluation metrics in OpenXAI'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'list_datasets' or 'list_explainers' beyond the resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, related tools like 'evaluate_explanation' or 'get_leaderboard', or any context for filtering metrics, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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