Skip to main content
Glama

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);

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