Skip to main content
Glama
th3nolo

OpenRouter MCP Server

by th3nolo

get_model_info

Retrieve detailed specifications and pricing information for any AI model available through OpenRouter to evaluate capabilities and costs.

Instructions

Get detailed information about a specific model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel ID to get information about

Implementation Reference

  • The actual implementation of get_model_info tool. This method fetches all models from OpenRouter API, finds the requested model by ID, and returns its detailed information. Throws an error if the model is not found.
    private async getModelInfo(params: { model: string }) {
      const response = await axios.get(`${OPENROUTER_CONFIG.baseURL}/models`, {
        headers: OPENROUTER_CONFIG.headers,
      });
    
      const model = response.data.data.find((m: any) => m.id === params.model);
    
      if (!model) {
        throw new Error(`Model ${params.model} not found`);
      }
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(model, null, 2),
          },
        ],
      };
    }
  • src/server.ts:203-216 (registration)
    Tool registration in ListToolsRequestSchema handler. Defines the tool name 'get_model_info', its description, and the inputSchema specifying a required 'model' string parameter.
    {
      name: "get_model_info",
      description: "Get detailed information about a specific model",
      inputSchema: {
        type: "object",
        properties: {
          model: {
            type: "string",
            description: "Model ID to get information about",
          },
        },
        required: ["model"],
      },
    },
  • src/server.ts:233-234 (registration)
    Tool invocation handler in CallToolRequestSchema switch statement. Routes 'get_model_info' requests to the getModelInfo method with the model parameter.
    case "get_model_info":
      return await this.getModelInfo(args as { model: string });

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/th3nolo/openrouter-mcp'

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