Skip to main content
Glama
stabgan

OpenRouter MCP Multimodal Server

validate_model

Read-onlyIdempotent

Check whether a specified model ID exists in the OpenRouter model list.

Instructions

Check if a model ID exists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYes

Implementation Reference

  • The handler function that validates whether a model ID exists. It checks for required input, refreshes the model cache if an API client is available, and returns { valid: boolean }.
    export async function handleValidateModel(
      request: { params: { arguments: { model: string } } },
      modelCache: ModelCache,
      apiClient?: OpenRouterAPIClient,
    ) {
      const { model } = request.params.arguments ?? { model: '' };
    
      if (!model || typeof model !== 'string') {
        return toolError(ErrorCode.INVALID_INPUT, 'model is required.');
      }
    
      if (apiClient) {
        try {
          await modelCache.ensureFresh(() => apiClient.getModels());
        } catch (error: unknown) {
          return classifyUpstreamError(error, 'validate_model');
        }
      }
    
      if (!modelCache.isValid()) {
        return toolError(ErrorCode.INTERNAL, 'No model data available.');
      }
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify({ valid: modelCache.has(model) }),
          },
        ],
      };
    }
  • Input schema definition for the validate_model tool. Requires a single 'model' string parameter.
    {
      name: 'validate_model',
      description: 'Check if a model ID exists',
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
      },
      inputSchema: {
        type: 'object',
        properties: { model: { type: 'string' } },
        required: ['model'],
      },
  • Registration: the switch-case in the tool dispatch that maps the 'validate_model' tool name to the handleValidateModel handler.
    case 'validate_model':
      return handleValidateModel(
        wrapToolArgs(args as { model: string } | undefined),
        this.modelCache,
        this.apiClient,
      );
  • Error classification helper called when fetching models fails during validation.
    return classifyUpstreamError(error, 'validate_model');
Behavior3/5

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

Annotations already declare readOnly and idempotent, so description adds no extra behavioral context (e.g., return type for non-existence, error handling). Adequate but no added value beyond annotations.

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?

Single concise sentence, front-loaded with verb and purpose. No redundant words.

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

Completeness3/5

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

Simple tool but absence of output schema means description should clarify return type (e.g., boolean). It doesn't, leaving ambiguity about the response for non-existent models.

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

Parameters4/5

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

With 0% schema description coverage, description adds crucial context that the 'model' parameter is an ID. Still lacks format or validation hints, but compensates partially.

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

Purpose5/5

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

Description clearly states the tool checks existence of a model ID, which is a distinct purpose from siblings like get_model_info (retrieves details) and search_models (lists models).

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?

No guidance on when to use this vs alternatives (e.g., get_model_info for details, search_models for browsing). Does not specify prerequisites or context.

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

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