Skip to main content
Glama

get_image_history

Retrieve previously generated or edited images within a session to maintain visual consistency and reference past creations.

Instructions

Get the list of generated/edited images in a session for reference

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conversation_idYesThe session ID to get image history for

Implementation Reference

  • The implementation of the get_image_history tool handler which retrieves image history from a conversation context.
    case "get_image_history": {
      const { conversation_id } = args as any;
    
      const context = conversations.get(conversation_id);
      if (!context || !context.imageHistory?.length) {
        return {
          content: [
            {
              type: "text",
              text: `No image history found for session: ${conversation_id}`,
            },
          ],
        };
      }
    
      const historyInfo = context.imageHistory.map((img, index) => ({
        index,
        reference: `history:${index}`,
        id: img.id,
        filePath: img.filePath,
        prompt: img.prompt,
        type: img.type,
        timestamp: new Date(img.timestamp).toISOString(),
      }));
    
      return {
        content: [
          {
            type: "text",
            text: `Image History for session "${conversation_id}" (${context.imageHistory.length} images):\n\n` +
                  `Use "last" to reference the most recent image, or "history:N" (e.g., "history:0") to reference by index.\n\n` +
                  JSON.stringify(historyInfo, null, 2),
          },
        ],
      };
    }
  • src/index.ts:394-405 (registration)
    Tool registration for get_image_history with its input schema definition.
    name: "get_image_history",
    description: "Get the list of generated/edited images in a session for reference",
    inputSchema: {
      type: "object",
      properties: {
        conversation_id: {
          type: "string",
          description: "The session ID to get image history for",
        },
      },
      required: ["conversation_id"],
    },

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/pistachiomatt/nanobanana-mcp'

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