Skip to main content
Glama
Cicatriiz

Civitai MCP Server

get_model_version_by_hash

Retrieve detailed version information for a model on Civitai MCP Server by providing its file hash (AutoV1, AutoV2, SHA256, CRC32, or Blake3). Streamlines model identification and access.

Instructions

Get model version information by file hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe hash of the model file (AutoV1, AutoV2, SHA256, CRC32, or Blake3)

Implementation Reference

  • Main handler function that executes the tool logic: extracts hash argument, fetches model version via client, formats response as MCP text content.
    private async getModelVersionByHash(args: any) {
      const { hash } = args;
      const version = await this.client.getModelVersionByHash(hash);
      
      return {
        content: [
          {
            type: 'text',
            text: `# Model Found by Hash\\n\\n` +
              `**Model:** ${version.model.name}\\n` +
              `**Version:** ${version.name} (ID: ${version.id})\\n` +
              `**Type:** ${version.model.type}\\n` +
              `**Hash:** ${hash}\\n\\n` +
              `**Created:** ${new Date(version.createdAt).toLocaleDateString()}\\n` +
              `**Downloads:** ${version.stats.downloadCount?.toLocaleString() || 0}\\n` +
              `**Trained Words:** ${version.trainedWords.join(', ') || 'None'}\\n\\n` +
              `**Description:**\\n${version.description}`,
          },
        ],
      };
    }
  • src/index.ts:153-163 (registration)
    Tool registration in getTools() array, including name, description, and input schema definition.
    {
      name: 'get_model_version_by_hash',
      description: 'Get model version information by file hash',
      inputSchema: {
        type: 'object',
        properties: {
          hash: { type: 'string', description: 'The hash of the model file (AutoV1, AutoV2, SHA256, CRC32, or Blake3)' },
        },
        required: ['hash'],
      },
    },
  • Zod schema for validating the Civitai API response of model version data, used in the client makeRequest.
    export const ModelVersionResponseSchema = z.object({
      id: z.number(),
      name: z.string(),
      description: z.string(),
      model: z.object({
        name: z.string(),
        type: ModelType,
        nsfw: z.boolean(),
        poi: z.boolean().optional(),
        mode: ModelMode,
      }),
      modelId: z.number(),
      createdAt: z.string(),
      downloadUrl: z.string(),
      trainedWords: z.array(z.string()),
      files: z.array(ModelFileSchema),
      stats: StatsSchema,
      images: z.array(ImageSchema),
    });
  • Supporting client method that builds the API endpoint URL and performs the HTTP request with response validation.
    async getModelVersionByHash(hash: string): Promise<ModelVersionResponse> {
      const url = this.buildUrl(`/model-versions/by-hash/${hash}`);
      return this.makeRequest<ModelVersionResponse>(url, ModelVersionResponseSchema);
    }
  • Switch case in CallToolRequestSchema handler that routes the tool call to the specific handler method.
    case 'get_model_version_by_hash':
      return await this.getModelVersionByHash(args);
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states it 'gets' information (implying read-only), but doesn't disclose error handling (e.g., invalid hash formats), authentication needs, rate limits, or response format. For a lookup tool with zero annotation coverage, this is inadequate.

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 with zero waste. It front-loads the core purpose ('Get model version information') and specifies the key constraint ('by file hash') directly. Every word earns its place.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'model version information' includes (e.g., metadata, download links, ratings) or behavioral aspects like error cases. For a tool that likely returns structured data, more context is needed to guide the agent effectively.

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%, with the hash parameter fully documented in the schema (including supported hash types). The description adds no parameter details beyond what the schema provides, so it meets the baseline of 3 when 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 verb 'Get' and the resource 'model version information', specifying the lookup method 'by file hash'. It distinguishes from siblings like 'get_model_version' (likely by ID) and 'get_model' (likely by name). However, it doesn't explicitly contrast with all siblings, keeping it at 4 rather than 5.

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 when hash-based lookup is appropriate compared to ID-based ('get_model_version'), name-based ('get_model'), or other search methods. There's no context about prerequisites or limitations.

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

Related 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/Cicatriiz/civitai-mcp-server'

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