Skip to main content
Glama

browse_images

Explore and filter AI-generated images from Civitai by model, creator, or content level. Customize results with pagination, sorting, and time period filters.

Instructions

Browse AI-generated images from Civitai

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of images to return (1-200, default 100)
modelIdNoFilter images from a specific model
modelVersionIdNoFilter images from a specific model version
nsfwNoNSFW content level filter
pageNoPage number for pagination
periodNoTime period for sorting
postIdNoGet images from a specific post
sortNoSort order for images
usernameNoFilter images by creator username

Implementation Reference

  • The handler function that implements the core logic for the 'browse_images' tool. It invokes the CivitaiClient to fetch images and formats a detailed text response listing image details including IDs, creators, dimensions, NSFW levels, reactions, URLs, and generation info.
    private async browseImages(args: any) { const response = await this.client.getImages(args); return { content: [ { type: 'text', text: `Found ${response.metadata.totalItems || response.items.length} images:\\n\\n${response.items.map(image => `**Image ID:** ${image.id}\\n` + `**Creator:** ${image.username || 'Unknown'}\\n` + `**Dimensions:** ${image.width}x${image.height}\\n` + `**NSFW Level:** ${image.nsfwLevel || 'Unknown'}\\n` + `**Reactions:** ❤️ ${image.stats?.heartCount || 0} | 👍 ${image.stats?.likeCount || 0} | 💬 ${image.stats?.commentCount || 0}\\n` + `**URL:** ${image.url}\\n` + `**Created:** ${image.createdAt ? new Date(image.createdAt).toLocaleDateString() : 'Unknown'}\\n` + (image.meta ? `**Generation Info:** ${JSON.stringify(image.meta, null, 2).substring(0, 200)}...\\n` : '') + '\\n' ).join('---\\n')}\\nPage ${response.metadata.currentPage || 1}`, }, ], }; }
  • Input schema defining the parameters for the 'browse_images' tool, including limits, pagination, filters for models, versions, posts, users, NSFW levels, sorting, and periods.
    inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Number of images to return (1-200, default 100)', minimum: 1, maximum: 200 }, page: { type: 'number', description: 'Page number for pagination', minimum: 1 }, modelId: { type: 'number', description: 'Filter images from a specific model' }, modelVersionId: { type: 'number', description: 'Filter images from a specific model version' }, postId: { type: 'number', description: 'Get images from a specific post' }, username: { type: 'string', description: 'Filter images by creator username' }, nsfw: { type: 'string', enum: ['None', 'Soft', 'Mature', 'X'], description: 'NSFW content level filter' }, sort: { type: 'string', enum: ['Most Reactions', 'Most Comments', 'Newest'], description: 'Sort order for images' }, period: { type: 'string', enum: ['AllTime', 'Year', 'Month', 'Week', 'Day'], description: 'Time period for sorting' } }, },
  • src/index.ts:57-58 (registration)
    Registration of the 'browse_images' handler in the main tool dispatch switch statement within the CallToolRequestSchema handler.
    case 'browse_images': return await this.browseImages(args);
  • src/index.ts:164-193 (registration)
    Tool registration in the getTools() method, which provides the tool list to the MCP ListToolsRequestSchema, including name, description, and input schema.
    { name: 'browse_images', description: 'Browse AI-generated images from Civitai', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Number of images to return (1-200, default 100)', minimum: 1, maximum: 200 }, page: { type: 'number', description: 'Page number for pagination', minimum: 1 }, modelId: { type: 'number', description: 'Filter images from a specific model' }, modelVersionId: { type: 'number', description: 'Filter images from a specific model version' }, postId: { type: 'number', description: 'Get images from a specific post' }, username: { type: 'string', description: 'Filter images by creator username' }, nsfw: { type: 'string', enum: ['None', 'Soft', 'Mature', 'X'], description: 'NSFW content level filter' }, sort: { type: 'string', enum: ['Most Reactions', 'Most Comments', 'Newest'], description: 'Sort order for images' }, period: { type: 'string', enum: ['AllTime', 'Year', 'Month', 'Week', 'Day'], description: 'Time period for sorting' } }, }, },
  • Supporting helper method in CivitaiClient that performs the actual API request to Civitai's /images endpoint using the provided parameters and validates the response with ImagesResponseSchema.
    async getImages(params: ImagesParams = {}): Promise<ImagesResponse> { const url = this.buildUrl('/images', params); return this.makeRequest<ImagesResponse>(url, ImagesResponseSchema); }

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