Skip to main content
Glama
th3nolo

OpenRouter MCP Server

by th3nolo

compare_models

Compare AI model responses side-by-side by sending the same prompt to multiple models for evaluation and analysis.

Instructions

Compare responses from multiple models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelsYesArray of model IDs to compare
messageYesMessage to send to all models
max_tokensNoMaximum tokens per response

Implementation Reference

  • The main implementation of compareModels tool that sends the same message to multiple models in parallel and formats the comparison results
    private async compareModels(params: z.infer<typeof CompareModelsSchema>) {
      const { models, message, max_tokens } = params;
    
      const promises = models.map(async (model) => {
        try {
          const response = await axios.post(
            `${OPENROUTER_CONFIG.baseURL}/chat/completions`,
            {
              model,
              messages: [{ role: "user", content: message }],
              max_tokens,
            },
            { headers: OPENROUTER_CONFIG.headers }
          );
    
          return {
            model,
            response: response.data.choices[0].message.content,
            usage: response.data.usage,
            success: true,
          };
        } catch (error) {
          return {
            model,
            error: error instanceof Error ? error.message : "Unknown error",
            success: false,
          };
        }
      });
    
      const results = await Promise.all(promises);
    
      const formattedResults = results
        .map((result) => {
          if (result.success) {
            return `**${result.model}:**\n${result.response}\n*Tokens: ${result.usage.total_tokens}*`;
          } else {
            return `**${result.model}:** ❌ Error - ${result.error}`;
          }
        })
        .join("\n\n---\n\n");
    
      return {
        content: [
          {
            type: "text" as const,
            text: `Comparison of ${models.length} models:\n\n${formattedResults}`,
          },
        ],
      };
    }
  • Zod schema defining the input validation for compare_models tool (models array, message, and optional max_tokens)
    const CompareModelsSchema = z.object({
      models: z.array(z.string()).describe("Array of model IDs to compare"),
      message: z.string().describe("Message to send to all models"),
      max_tokens: z.number().optional().default(500).describe("Maximum tokens per response"),
    });
  • src/server.ts:177-202 (registration)
    Tool registration in the MCP tools list with name 'compare_models', description, and input schema
    {
      name: "compare_models",
      description: "Compare responses from multiple models",
      inputSchema: {
        type: "object",
        properties: {
          models: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of model IDs to compare",
          },
          message: {
            type: "string",
            description: "Message to send to all models",
          },
          max_tokens: {
            type: "number",
            description: "Maximum tokens per response",
            default: 500,
          },
        },
        required: ["models", "message"],
      },
    },
  • src/server.ts:231-232 (registration)
    Switch case handler that routes compare_models tool calls to the compareModels method
    case "compare_models":
      return await this.compareModels(CompareModelsSchema.parse(args));
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 offers minimal insight. It states what the tool does (compare responses) but doesn't describe how the comparison is performed, what the output format looks like, whether it's a read-only operation, or any performance considerations like rate limits or latency.

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 extremely concise at just four words, front-loading the core purpose without any wasted text. Every word earns its place by directly conveying the tool's function, making it efficient and easy to parse.

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

Completeness2/5

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

Given the complexity of comparing multiple model responses and the lack of annotations or output schema, the description is insufficient. It doesn't explain what 'compare' entails (e.g., side-by-side display, metrics, or qualitative analysis), the return format, or error handling, leaving significant gaps for the agent to navigate.

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 description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage with clear descriptions for 'models', 'message', and 'max_tokens'. Since the schema fully documents the parameters, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 'Compare responses from multiple models' clearly states the verb (compare) and resource (responses from multiple models), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'chat_with_model' or 'get_model_info' beyond the comparative nature implied by 'compare'.

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 like 'chat_with_model' (for single-model interaction) or 'list_models' (for enumeration). There's no mention of prerequisites, typical use cases, or exclusions, leaving the agent to infer usage from the tool name alone.

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

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