get_popular_models
Retrieve top popular or downloaded AI models from Civitai’s collection, filtered by time period (AllTime, Year, Month, Week, Day) and customizable limit (up to 100 models).
Instructions
Get the most popular/downloaded models
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of models to return (default: 20) | |
| period | No | Time period for popularity ranking (default: Week) |
Implementation Reference
- src/index.ts:555-572 (handler)MCP tool handler method that calls the client, formats the response, and returns formatted text content listing the most popular models.private async getPopularModels(args: any) { const response = await this.client.getPopularModels(args.period, args.limit); const formatted = this.formatModelsResponse(response); return { content: [ { type: 'text', text: `# Most Popular Models (${args.period || 'Week'})\\n\\n${formatted.models.map((model: any, index: number) => `${index + 1}. **${model.name}** (${model.type})\\n` + ` Creator: ${model.creator}\\n` + ` Downloads: ${model.stats.downloads.toLocaleString()}\\n` + ` Rating: ${model.stats.rating.toFixed(1)} ⭐\\n\\n` ).join('')}`, }, ], }; }
- src/index.ts:219-232 (registration)Tool registration in the list of available MCP tools, including name, description, and input schema definition.name: 'get_popular_models', description: 'Get the most popular/downloaded models', inputSchema: { type: 'object', properties: { period: { type: 'string', enum: ['AllTime', 'Year', 'Month', 'Week', 'Day'], description: 'Time period for popularity ranking (default: Week)' }, limit: { type: 'number', description: 'Number of models to return (default: 20)', minimum: 1, maximum: 100 }, }, }, },
- src/civitai-client.ts:177-184 (helper)Supporting client method that fetches popular models from Civitai API by calling getModels with 'Most Downloaded' sort and specified period/limit.async getPopularModels(period: string = 'Week', limit: number = 20): Promise<ModelsResponse> { return this.getModels({ sort: 'Most Downloaded', period, limit, nsfw: false }); }
- src/types.ts:123-126 (schema)Zod schema for validating the ModelsResponse returned by the Civitai API, used in the client methods.export const ModelsResponseSchema = z.object({ items: z.array(ModelSchema), metadata: MetadataSchema, });
- src/index.ts:63-64 (registration)Dispatch case in the CallToolRequest handler that routes 'get_popular_models' calls to the handler method.case 'get_popular_models': return await this.getPopularModels(args);