Skip to main content
Glama

llm_compare_models

Compare performance of multiple AI models using the same prompt to evaluate responses and select the optimal model for your needs.

Instructions

Compara el rendimiento de múltiples modelos con el mismo prompt

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseURLNoURL del servidor OpenAI-compatible (ej: http://localhost:1234/v1, http://localhost:11434/v1)
apiKeyNoAPI Key (requerida para OpenAI/Azure, opcional para servidores locales)
promptYesPrompt para comparar
modelsNoLista de modelos a comparar
maxTokensNoMax tokens (default: 256)

Implementation Reference

  • The core handler function implementing llm_compare_models tool: fetches available models if not specified, generates responses for each model using the provided prompt, calculates performance metrics (latency, tokens/s), and returns a markdown table with comparison and detailed responses.
    async llm_compare_models(args: z.infer<typeof CompareModelsSchema>) {
      const client = getClient(args);
      let models = args.models;
      
      if (!models || models.length === 0) {
        const available = await client.listModels();
        models = available.map(m => m.id);
      }
    
      if (models.length === 0) {
        return {
          content: [
            {
              type: "text" as const,
              text: "❌ No hay modelos disponibles para comparar",
            },
          ],
        };
      }
    
      let output = `# ⚖️ Comparación de Modelos\n\n`;
      output += `**Prompt:** ${args.prompt}\n\n`;
      output += `| Modelo | Latencia (ms) | Tokens/s | Tokens |\n`;
      output += `|--------|---------------|----------|--------|\n`;
    
      const results: BenchmarkResult[] = [];
    
      for (const model of models) {
        try {
          const result = await client.chat(args.prompt, {
            model,
            maxTokens: args.maxTokens,
          });
          results.push(result);
          output += `| ${model} | ${result.latencyMs} | ${result.tokensPerSecond.toFixed(2)} | ${result.completionTokens} |\n`;
        } catch (error) {
          output += `| ${model} | ERROR | - | - |\n`;
        }
      }
    
      output += `\n## Respuestas Detalladas\n\n`;
      for (const r of results) {
        output += `### ${r.model}\n${r.response}\n\n---\n\n`;
      }
    
      return { content: [{ type: "text" as const, text: output }] };
    },
  • Zod input schema used for type validation in the llm_compare_models handler.
    export const CompareModelsSchema = ConnectionConfigSchema.extend({
      prompt: z.string().describe("Prompt para comparar modelos"),
      models: z.array(z.string()).optional().describe("Lista de modelos a comparar (usa todos si no se especifica)"),
      maxTokens: z.number().optional().default(256),
    });
  • src/tools.ts:164-181 (registration)
    MCP tool registration entry in the tools array exported for server.setRequestHandler(ListToolsRequestSchema), defining the tool name, description, and JSON Schema for inputs.
    {
      name: "llm_compare_models",
      description: "Compara el rendimiento de múltiples modelos con el mismo prompt",
      inputSchema: {
        type: "object" as const,
        properties: {
          ...connectionProperties,
          prompt: { type: "string", description: "Prompt para comparar" },
          models: {
            type: "array",
            items: { type: "string" },
            description: "Lista de modelos a comparar",
          },
          maxTokens: { type: "number", description: "Max tokens (default: 256)" },
        },
        required: ["prompt"],
      },
    },
  • src/index.ts:73-74 (registration)
    Dispatch logic in the main CallToolRequestSchema handler that routes execution to the llm_compare_models tool handler.
    case "llm_compare_models":
      return await toolHandlers.llm_compare_models(args as any);
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions comparing performance but doesn't disclose key behavioral traits such as what 'rendimiento' (performance) entails (e.g., speed, accuracy, cost), whether it's a read-only operation, if it requires authentication, or any rate limits. This leaves significant gaps for an agent to understand the tool's behavior.

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 in Spanish that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for its function, making it easy to parse quickly.

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 LLM models and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'performance' means, how results are returned, or any prerequisites like authentication needs. For a tool with 5 parameters and no structured output, more context is needed to guide effective use.

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?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no additional meaning beyond the schema, such as explaining how 'models' are selected or what 'maxTokens' affects in the comparison. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 tool's purpose: 'Compara el rendimiento de múltiples modelos con el mismo prompt' (Compares the performance of multiple models with the same prompt). It specifies the verb 'compara' (compares) and the resource 'múltiples modelos' (multiple models), but doesn't explicitly differentiate it from sibling tools like llm_benchmark or llm_evaluate_coherence, which might have overlapping functionality.

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. With siblings like llm_benchmark, llm_evaluate_coherence, and llm_test_capabilities, there's no indication of how this tool differs in context or when it's preferred over others, 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/ramgeart/llm-mcp-bridge'

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