Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNoNumber of models to return (default: 20)
periodNoTime period for popularity ranking (default: Week)

Implementation Reference

  • 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 }, }, }, },
  • 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 }); }
  • 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);

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