Skip to main content
Glama

get_inspiration

Read-only

Retrieve a gallery entry's full prompt and image URLs to use as visual examples or reference 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

  • Handler function that registers the 'get_inspiration' tool. Fetches full prompt details and images for a gallery entry, checking local curated library first, then falling back to the MeiGen API.
    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 for get_inspiration: requires a single 'imageId' string parameter from search_gallery results.
    export const getInspirationSchema = {
      imageId: z.string().describe('Image/prompt ID from search_gallery results'),
    }
  • src/server.ts:268-268 (registration)
    Registration call in createServer() that wires up the get_inspiration tool with the MCP server instance and API client.
    registerGetInspiration(server, apiClient)
  • Helper function that looks up a prompt by ID in the local curated library of 1300+ trending prompts.
    export function getPromptById(id: string): TrendingPrompt | null {
      const prompts = loadPrompts()
      return prompts.find(p => p.id === id) || null
    }
  • API client method that fetches image details by ID from the MeiGen platform (fallback when not in local library).
    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 indicate readOnlyHint=true, and the description adds context about what data is returned (prompt and image URLs), complementing the safety profile without contradiction.

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?

Two tightly written sentences front-load the core purpose and provide actionable usage guidance without any filler.

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?

For a simple retrieval tool with one parameter and no output schema, the description fully explains what is returned and how to use it, leaving no gaps.

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?

The sole parameter imageId is fully described in the schema, and the tool description does not add new semantics beyond referencing search_gallery, which the schema already does.

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?

The description clearly states the tool retrieves the full prompt and all image URLs for a gallery entry, distinguishing it from siblings like search_gallery (which lists entries) and generate_image (which creates images).

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?

The description advises showing images as visual examples and explains how to use the prompt and image URLs with generate_image() and referenceImages, providing clear guidance on downstream usage.

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/MeiGen-AI-Design-MCP'

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