Skip to main content
Glama

get_model

Retrieve detailed information about a specific AI model using its unique ID. Enables users to access model details through the Civitai MCP Server for informed AI assistant interactions.

Instructions

Get detailed information about a specific model by ID

Input Schema

NameRequiredDescriptionDefault
modelIdYesThe ID of the model to retrieve

Input Schema (JSON Schema)

{ "properties": { "modelId": { "description": "The ID of the model to retrieve", "type": "number" } }, "required": [ "modelId" ], "type": "object" }

Implementation Reference

  • The primary handler function for the 'get_model' MCP tool. Extracts modelId, fetches data via CivitaiClient, formats with formatSingleModel, and returns MCP-formatted text response.
    private async getModel(args: any) { const { modelId } = args; const model = await this.client.getModel(modelId); const formatted = this.formatSingleModel(model); return { content: [ { type: 'text', text: `# ${formatted.name}\\n\\n` + `**Type:** ${formatted.type}\\n` + `**Creator:** ${formatted.creator.username}\\n` + `**Downloads:** ${formatted.stats.downloadCount?.toLocaleString() || 0}\\n` + `**Rating:** ${formatted.stats.rating?.toFixed(1) || 'N/A'} (${formatted.stats.ratingCount || 0} ratings)\\n` + `**NSFW:** ${formatted.nsfw ? 'Yes' : 'No'}\\n\\n` + `**Tags:** ${formatted.tags.join(', ')}\\n\\n` + `**Description:**\\n${formatted.description}\\n\\n` + `**Versions (${formatted.versions.length}):**\\n${formatted.versions.map((v: any) => `- **${v.name}** (ID: ${v.id})\\n ` + `Created: ${new Date(v.createdAt).toLocaleDateString()}\\n ` + `Downloads: ${v.stats.downloadCount?.toLocaleString() || 0}\\n ` + `Trained words: ${v.trainedWords.join(', ') || 'None'}\\n ` + `Files: ${v.files.length} file(s)\\n` ).join('\\n')}`, }, ], }; }
  • Input schema definition for the 'get_model' tool in the tools list returned by ListToolsRequest.
    { name: 'get_model', description: 'Get detailed information about a specific model by ID', inputSchema: { type: 'object', properties: { modelId: { type: 'number', description: 'The ID of the model to retrieve' }, }, required: ['modelId'], }, },
  • src/index.ts:51-52 (registration)
    Dispatch registration mapping tool name 'get_model' to its handler in CallToolRequestSchema handler.
    case 'get_model': return await this.getModel(args);
  • Helper function to format raw model data into structured object used by get_model handler.
    private formatSingleModel(model: any) { return { id: model.id, name: model.name, description: model.description, type: model.type, creator: { username: model.creator.username, avatar: model.creator.image, }, tags: model.tags, nsfw: model.nsfw, stats: model.stats, versions: model.modelVersions.map((version: any) => ({ id: version.id, name: version.name, description: version.description, createdAt: version.createdAt, trainedWords: version.trainedWords, downloadUrl: version.downloadUrl, stats: version.stats, files: version.files.map((file: any) => ({ sizeKb: file.sizeKb, format: file.metadata?.format, fp: file.metadata?.fp, primary: file.primary, scanStatus: { pickle: file.pickleScanResult, virus: file.virusScanResult, }, })), imageCount: version.images.length, })), }; }
  • CivitaiClient.getModel method: constructs API URL and makes validated fetch request to retrieve model data.
    async getModel(modelId: number): Promise<Model> { const url = this.buildUrl(`/models/${modelId}`); return this.makeRequest<Model>(url, ModelSchema); }

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