Skip to main content
Glama
hoangdn3

OpenRouter MCP Multimodal Server

by hoangdn3

get_model_info

Retrieve detailed specifications and capabilities for any AI model in the OpenRouter ecosystem to determine its suitability for your tasks.

Instructions

Get detailed information about a specific model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesThe model ID to get information for

Implementation Reference

  • The handler function that executes the get_model_info tool logic, retrieving model details from the cache and returning them as JSON or error messages.
    export async function handleGetModelInfo(
      request: { params: { arguments: GetModelInfoToolRequest } },
      modelCache: ModelCache
    ) {
      const args = request.params.arguments;
      
      try {
        if (!modelCache.isCacheValid()) {
          return {
            content: [
              {
                type: 'text',
                text: 'Model cache is empty or expired. Please call search_models first to populate the cache.',
              },
            ],
            isError: true,
          };
        }
        
        const model = modelCache.getModel(args.model);
        if (!model) {
          throw new McpError(ErrorCode.InvalidParams, `Model '${args.model}' not found`);
        }
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(model, null, 2),
            },
          ],
        };
      } catch (error) {
        if (error instanceof Error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving model info: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • TypeScript interface defining the input parameters for the get_model_info tool (model ID string).
    export interface GetModelInfoToolRequest {
      model: string;
    }
  • Registers the get_model_info tool in the ListTools response, including name, description, and input schema.
    {
      name: 'get_model_info',
      description: 'Get detailed information about a specific model',
      inputSchema: {
        type: 'object',
        properties: {
          model: {
            type: 'string',
            description: 'The model ID to get information for',
          },
        },
        required: ['model'],
      },
    },
  • Dispatches calls to the 'get_model_info' tool by invoking the handleGetModelInfo handler with the request arguments and model cache.
    case 'get_model_info':
      return handleGetModelInfo({
        params: {
          arguments: request.params.arguments as unknown as GetModelInfoToolRequest
        }
      }, this.modelCache);

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/hoangdn3/mcp-ocr-fallback'

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