Skip to main content
Glama
hoangdn3

OpenRouter MCP Multimodal Server

by hoangdn3

validate_model

Verify if a model ID is compatible with OpenRouter's multimodal AI ecosystem before use.

Instructions

Check if a model ID is valid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesThe model ID to validate

Implementation Reference

  • The core handler function that implements the validate_model tool logic: checks if the model cache is valid, verifies if the specified model exists using modelCache.hasModel, and returns JSON {valid: boolean} or an error response.
    export async function handleValidateModel(
      request: { params: { arguments: ValidateModelToolRequest } },
      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 isValid = modelCache.hasModel(args.model);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ valid: isValid }),
            },
          ],
        };
      } catch (error) {
        if (error instanceof Error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error validating model: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • Tool registration in the ListToolsRequest handler, defining the tool name, description, and input schema for MCP clients.
    {
      name: 'validate_model',
      description: 'Check if a model ID is valid',
      inputSchema: {
        type: 'object',
        properties: {
          model: {
            type: 'string',
            description: 'The model ID to validate',
          },
        },
        required: ['model'],
      },
    },
  • Dispatch logic in the CallToolRequest switch statement that invokes the validate_model handler with the request arguments and modelCache instance.
    case 'validate_model':
      return handleValidateModel({
        params: {
          arguments: request.params.arguments as unknown as ValidateModelToolRequest
        }
      }, this.modelCache);
  • TypeScript type definition for the tool's input parameters, matching the JSON schema in registration.
    export interface ValidateModelToolRequest {
      model: string;
    }
  • JSON Schema for input validation in the MCP tool specification.
    inputSchema: {
      type: 'object',
      properties: {
        model: {
          type: 'string',
          description: 'The model ID to validate',
        },
      },
      required: ['model'],
    },
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 but only states the action without behavioral details. It doesn't disclose traits like whether it's read-only, if it requires authentication, rate limits, or what happens on invalid input (e.g., error handling). This is a significant gap for a tool with zero annotation coverage.

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: 'Check if a model ID is valid'. It's front-loaded with the core purpose, has zero waste, and is appropriately sized for this simple tool.

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 tool's low complexity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks context on behavioral traits, usage guidelines, and output expectations (e.g., boolean result or error details), making it inadequate for effective agent use despite the simple schema.

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 schema description coverage is 100%, with the parameter 'model' documented as 'The model ID to validate'. The description adds no additional meaning beyond this, such as format examples or validation criteria. Baseline 3 is appropriate since the schema does the heavy lifting.

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: 'Check if a model ID is valid' specifies the verb ('check') and resource ('model ID'), making it understandable. However, it doesn't distinguish from sibling tools like 'get_model_info' or 'search_models', which might also involve model IDs but serve different purposes.

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. It doesn't mention scenarios like verifying model existence before operations or contrast with siblings like 'get_model_info' for detailed info or 'search_models' for discovery, leaving usage context 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/hoangdn3/mcp-ocr-fallback'

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