Skip to main content
Glama

recommend_models

Get ranked AI model recommendations with cost estimates by describing your use case in plain English. Covers 62 models across 29 providers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
use_caseYesNatural language description of what you want to build or do with an AI model

Implementation Reference

  • Tool registration and handler definition for 'recommend_models'. Validates input, fetches model data, and calls the core recommendation function.
    server.tool(
      "recommend_models",
      {
        use_case: z
          .string()
          .describe(
            "Natural language description of what you want to build or do with an AI model",
          ),
      },
      async ({ use_case }) => {
        const apiKey = process.env.ANTHROPIC_API_KEY;
        if (!apiKey) {
          return {
            content: [
              {
                type: "text" as const,
                text: "Error: ANTHROPIC_API_KEY environment variable is required.",
              },
            ],
          };
        }
    
        try {
          const validation = await validateQuery(use_case, apiKey);
          if (!validation.valid) {
            return {
              content: [
                {
                  type: "text" as const,
                  text:
                    validation.message ??
                    "Please describe an AI use case you want to build.",
                },
              ],
            };
          }
    
          const { models, ageHours } = await getModels();
          const recs = await recommend(use_case, models, apiKey);
    
          const result = recs.map((r) => ({
            model_id: r.model_id,
            rank: r.rank,
            rank_label: r.rank_label,
            reasoning: r.reasoning,
            cost_estimate: r.estimated_cost_example,
            tradeoffs: r.tradeoffs,
            dataset_age_hours: ageHours,
          }));
    
          return {
            content: [
              { type: "text" as const, text: JSON.stringify(result, null, 2) },
            ],
          };
        } catch (err) {
          const msg = err instanceof Error ? err.message : "Unknown error";
          return {
            content: [{ type: "text" as const, text: `Error: ${msg}` }],
          };
        }
      },
    );
  • The core recommendation logic that orchestrates calling Claude and parsing the response.
    export async function recommend(
      userQuery: string,
      models: Model[],
      apiKey?: string,
    ): Promise<Recommendation[]> {
      if (!userQuery.trim()) throw new Error("Query cannot be empty");
      if (!models.length) throw new Error("Models array cannot be empty");
    
      const raw = await callClaude(userQuery, models, apiKey);
      return parseRecommendations(raw);
    }
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

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

Completeness1/5

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

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

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/kalraakshit042/ai-compass'

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