Skip to main content
Glama
akiojin

Model Hub MCP

by akiojin

list_all_models

Retrieve all available AI models from configured providers like OpenAI, Anthropic, and Google through a unified interface.

Instructions

List all available models from all configured providers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_all_models' tool. It aggregates models from all configured providers (OpenAI, Anthropic, Google) by calling their respective listModels methods, handles errors for each, and returns a JSON string of the results.
    case 'list_all_models': {
      const results: any = {};
      
      if (openaiProvider) {
        try {
          results.openai = await openaiProvider.listModels();
        } catch (error) {
          results.openai = { error: error instanceof Error ? error.message : 'Failed to fetch OpenAI models' };
        }
      }
      
      if (anthropicProvider) {
        try {
          results.anthropic = await anthropicProvider.listModels();
        } catch (error) {
          results.anthropic = { error: error instanceof Error ? error.message : 'Failed to fetch Anthropic models' };
        }
      }
      
      if (googleProvider) {
        try {
          results.google = await googleProvider.listModels();
        } catch (error) {
          results.google = { error: error instanceof Error ? error.message : 'Failed to fetch Google models' };
        }
      }
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • src/index.ts:70-77 (registration)
    Registration of the 'list_all_models' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).
    {
      name: 'list_all_models',
      description: 'List all available models from all configured providers',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Input schema for the 'list_all_models' tool, which is an empty object (no input parameters). Note: this overlaps with registration.
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
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/akiojin/model-hub-mcp'

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