Skip to main content
Glama
jau123

MeiGen AI Image Generation MCP

get_inspiration

Read-only

Get a full prompt and image URLs from a gallery entry. Use the prompt directly for image generation or pass the images for style transfer.

Instructions

Get the full prompt and all image URLs for a gallery entry. Show the images to the user as visual examples. The prompt can be used directly with generate_image(), and image URLs can be passed as referenceImages for style transfer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageIdYesImage/prompt ID from search_gallery results

Implementation Reference

  • Core handler function `registerGetInspiration` that registers the 'get_inspiration' tool. It first checks the local curated prompt library via `getPromptById(imageId)`, then falls back to the API client's `getImageDetails(imageId)`. Returns full prompt text, image URLs, metadata, and next-step suggestions.
    export function registerGetInspiration(server: McpServer, apiClient: MeiGenApiClient) {
      server.tool(
        'get_inspiration',
        'Get the full prompt and all image URLs for a gallery entry. Show the images to the user as visual examples. The prompt can be used directly with generate_image(), and image URLs can be passed as referenceImages for style transfer.',
        getInspirationSchema,
        { readOnlyHint: true },
        async ({ imageId }) => {
          // 1. Check local curated library first
          const local = getPromptById(imageId)
          if (local) {
            const details = [
              `# Trending Prompt #${local.rank}`,
              '',
              '## Generated Images',
              'Show these images to the user as visual examples of what this prompt produces:',
              ...local.images.map((url, i) => `![Image ${i + 1}](${url})`),
              '',
              '## Full Prompt',
              '```',
              local.prompt,
              '```',
              '',
              '## Metadata',
              `- Author: ${local.author_name} (@${local.author})`,
              `- Model: ${local.model}`,
              `- Categories: ${local.categories.join(', ')}`,
              `- Likes: ${local.likes.toLocaleString()}`,
              `- Views: ${local.views.toLocaleString()}`,
              `- Date: ${local.date}`,
              '',
              '## Next Steps',
              '- Use this prompt directly with generate_image() to create a similar image',
              '- Modify the prompt to create your own variation',
              local.images.length > 0
                ? `- Pass "${local.images[0]}" as a referenceImages URL to generate_image() for style transfer`
                : '',
            ].filter(Boolean).join('\n')
    
            return {
              content: [{
                type: 'text' as const,
                text: details,
              }],
            }
          }
    
          // 2. Fallback to API query
          try {
            const image = await apiClient.getImageDetails(imageId)
    
            if (!image) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Image not found: ${imageId}`,
                }],
                isError: true,
              }
            }
    
            const imageUrls = image.media_urls || []
            const details = [
              `# Image Details (ID: ${image.id})`,
              '',
              '## Generated Images',
              'Show these images to the user:',
              image.thumbnail_url ? `![Thumbnail](${image.thumbnail_url})` : '',
              ...imageUrls.map((url, i) => `![Image ${i + 1}](${url})`),
              '',
              '## Full Prompt',
              '```',
              image.text || '(No prompt available)',
              '```',
              '',
              '## Metadata',
              image.model ? `- Model: ${image.model}` : '',
              image.image_width && image.image_height ? `- Dimensions: ${image.image_width}x${image.image_height}` : '',
              `- Likes: ${image.likes}`,
              `- Views: ${image.views}`,
              image.author_display_name ? `- Author: ${image.author_display_name}` : '',
              '',
              '## Next Steps',
              '- Use this prompt with generate_image() to create a similar image',
              '- Modify the prompt to create your own variation',
              imageUrls.length > 0
                ? `- Pass "${imageUrls[0]}" as a referenceImages URL to generate_image() for style transfer`
                : '',
            ].filter(Boolean).join('\n')
    
            return {
              content: [{
                type: 'text' as const,
                text: details,
              }],
            }
          } catch {
            return {
              content: [{
                type: 'text' as const,
                text: `Image not found: ${imageId}. This ID is not in the curated library and the online gallery is unavailable.`,
              }],
              isError: true,
            }
          }
        }
      )
    }
  • Input schema `getInspirationSchema` defining the single required parameter `imageId` (string) which comes from search_gallery results.
    export const getInspirationSchema = {
      imageId: z.string().describe('Image/prompt ID from search_gallery results'),
    }
  • src/server.ts:264-270 (registration)
    Registration of the 'get_inspiration' tool in the MCP server, called via `registerGetInspiration(server, apiClient)` at line 268, listed as a free feature (no auth required).
    // Free features (no configuration required)
    registerEnhancePrompt(server)
    registerSearchGallery(server, config)
    registerListModels(server, apiClient, config)
    registerGetInspiration(server, apiClient)
    registerManagePreferences(server)
  • Helper function `getPromptById(id)` used to look up a prompt from the local curated library (1300+ trending prompts) before falling back to the API.
    export function getPromptById(id: string): TrendingPrompt | null {
      const prompts = loadPrompts()
      return prompts.find(p => p.id === id) || null
    }
  • API helper method `getImageDetails(imageId)` on MeiGenApiClient that fetches image details from the MeiGen API (no auth required), used as fallback when the local library doesn't have the ID.
    async getImageDetails(imageId: string): Promise<MeiGenSearchResult | null> {
      const res = await fetch(`${this.baseUrl}/api/images/${encodeURIComponent(imageId)}`)
      if (!res.ok) {
        if (res.status === 404) return null
        throw new Error(`Failed to fetch image: ${res.status} ${res.statusText}`)
      }
    
      const json = await res.json() as { success: boolean; data?: MeiGenSearchResult; error?: string }
      if (!json.success) return null
    
      return json.data || null
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark readOnlyHint=true; description adds value by detailing returned content (prompt, image URLs) and suggesting usage, without contradicting annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each adds value: purpose, usage, integration. No fluff, front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given simple tool with one parameter and no output schema, description fully explains what the tool returns and how to use it, making it self-contained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameter; description repeats schema description but adds no new semantic detail about the parameter itself.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it retrieves full prompt and all image URLs for a gallery entry, and distinguishes from siblings by specifying how output integrates with generate_image() and style transfer.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implied usage after search_gallery; provides concrete guidance on how to use output (show images, use prompt and referenceImages). No explicit when-not-to-use, but context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/jau123/mei-gen-ai-design-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server