Skip to main content
Glama
ssv445

Lorem Ipsum MCP Server

by ssv445

image

Generate or retrieve customizable images from picsum.photos using parameters like dimensions, filters, and output formats. Supports URLs, file downloads, and metadata retrieval.

Instructions

Generate or fetch images from picsum.photos with various options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blurNoApply blur filter (1-10)
formatNoImage format
grayscaleNoApply grayscale filter to the image
heightNoThe height of the image in pixels
idNoThe ID of a specific image to retrieve
infoNoFetch metadata for a specific image
limitNoNumber of results per page for list
listNoFetch list of available images
outputNoOutput type: url returns string URL, file returns binary dataurl
pageNoPage number for list results
seedNoA seed for generating a static random image
widthNoThe width of the image in pixels

Implementation Reference

  • Core handler function that implements the image tool logic: constructs image URLs from picsum.photos based on parameters, handles special modes (list, info), applies filters, and returns URL string, ImageContent, or TextContent.
    public static async generateImage(params: {
      width?: number;
      height?: number;
      id?: string;
      seed?: string;
      grayscale?: boolean;
      blur?: number;
      format?: 'jpg' | 'webp';
      output?: 'url' | 'file';
      list?: boolean;
      page?: number;
      limit?: number;
      info?: boolean;
    }): Promise<string | ImageContent | TextContent> {
      const {
        width,
        height,
        id,
        seed,
        grayscale,
        blur,
        format,
        output = 'url',
        list,
        page,
        limit,
        info
      } = params;
    
      // Handle list operation
      if (list) {
        const result = await this.fetchImageList(page, limit);
        return {
          type: "text",
          text: JSON.stringify(result, null, 2)
        } as TextContent;
      }
    
      // Handle info operation
      if (info) {
        let result: object;
        if (id) {
          result = await this.fetchImageInfo(id);
        } else if (seed) {
          result = await this.fetchSeedInfo(seed, width, height);
        } else {
          throw new Error('Info operation requires either --id or --seed parameter');
        }
        return {
          type: "text",
          text: JSON.stringify(result, null, 2)
        } as TextContent;
      }
    
      // Validate blur parameter
      if (blur !== undefined && (blur < 1 || blur > 10)) {
        throw new Error('Blur value must be between 1 and 10');
      }
    
      // Generate image URL
      const url = this.constructImageUrl({
        width,
        height,
        id,
        seed,
        grayscale,
        blur,
        format
      });
    
      // Return URL or fetch file data
      if (output === 'url') {
        return url;
      } else {
        // Use the imageContent helper to return proper ImageContent
        return await imageContent({ url });
      }
    }
  • Registers the 'image' tool with the FastMCP server, including name, description, Zod input schema, and thin execute handler delegating to ImageService.generateImage.
    server.addTool({
      name: "image",
      description: "Generate or fetch images from picsum.photos with various options",
      parameters: z.object({
        width: z.number().int().positive().optional().describe("The width of the image in pixels"),
        height: z.number().int().positive().optional().describe("The height of the image in pixels"),
        id: z.string().optional().describe("The ID of a specific image to retrieve"),
        seed: z.string().optional().describe("A seed for generating a static random image"),
        grayscale: z.boolean().optional().describe("Apply grayscale filter to the image"),
        blur: z.number().int().min(1).max(10).optional().describe("Apply blur filter (1-10)"),
        format: z.enum(["jpg", "webp"]).optional().describe("Image format"),
        output: z.enum(["url", "file"]).default("url").describe("Output type: url returns string URL, file returns binary data"),
        list: z.boolean().optional().describe("Fetch list of available images"),
        page: z.number().int().positive().optional().describe("Page number for list results"),
        limit: z.number().int().positive().optional().describe("Number of results per page for list"),
        info: z.boolean().optional().describe("Fetch metadata for a specific image")
      }),
      execute: async (params) => {
        return await services.ImageService.generateImage(params);
      }
    });
  • Zod schema defining all input parameters for the 'image' tool, including dimensions, IDs, seeds, filters, output format, and special operations like list and info.
    parameters: z.object({
      width: z.number().int().positive().optional().describe("The width of the image in pixels"),
      height: z.number().int().positive().optional().describe("The height of the image in pixels"),
      id: z.string().optional().describe("The ID of a specific image to retrieve"),
      seed: z.string().optional().describe("A seed for generating a static random image"),
      grayscale: z.boolean().optional().describe("Apply grayscale filter to the image"),
      blur: z.number().int().min(1).max(10).optional().describe("Apply blur filter (1-10)"),
      format: z.enum(["jpg", "webp"]).optional().describe("Image format"),
      output: z.enum(["url", "file"]).default("url").describe("Output type: url returns string URL, file returns binary data"),
      list: z.boolean().optional().describe("Fetch list of available images"),
      page: z.number().int().positive().optional().describe("Page number for list results"),
      limit: z.number().int().positive().optional().describe("Number of results per page for list"),
      info: z.boolean().optional().describe("Fetch metadata for a specific image")
    }),
  • Helper method to construct the picsum.photos image URL based on provided parameters, handling path construction and query parameters for filters and format.
    private static constructImageUrl(params: {
      width?: number;
      height?: number;
      id?: string;
      seed?: string;
      grayscale?: boolean;
      blur?: number;
      format?: 'jpg' | 'webp';
    }): string {
      const { width, height, id, seed, grayscale, blur, format } = params;
    
      let url: string;
    
      // Construct base URL path
      if (id) {
        if (width && height) {
          url = `${this.BASE_URL}/id/${id}/${width}/${height}`;
        } else if (width) {
          url = `${this.BASE_URL}/id/${id}/${width}`;
        } else {
          url = `${this.BASE_URL}/id/${id}`;
        }
      } else {
        if (width && height) {
          url = `${this.BASE_URL}/${width}/${height}`;
        } else if (width) {
          url = `${this.BASE_URL}/${width}`;
        } else {
          // Default size if no dimensions specified
          url = `${this.BASE_URL}/200`;
        }
      }
    
      // Add query parameters
      const queryParams: string[] = [];
    
      if (seed) {
        queryParams.push(`seed=${encodeURIComponent(seed)}`);
      }
    
      if (grayscale) {
        queryParams.push('grayscale');
      }
    
      if (blur) {
        queryParams.push(`blur=${blur}`);
      }
    
      if (format) {
        queryParams.push(`fmt=${format}`);
      }
    
      if (queryParams.length > 0) {
        url += '?' + queryParams.join('&');
      }
    
      return url;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Generate or fetch' and 'various options', but doesn't explain key behaviors like whether it's read-only or mutative, rate limits, authentication needs, or what happens with conflicting parameters (e.g., 'id' vs 'list'). This leaves significant gaps for an agent.

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?

The description is a single, efficient sentence that front-loads the core purpose without waste. It's appropriately sized for a tool with many parameters but clear schema coverage, earning its place by summarizing the tool's scope concisely.

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

Completeness2/5

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

Given the tool's complexity (12 parameters, no output schema, no annotations), the description is incomplete. It doesn't address behavioral aspects like mutability, error handling, or output format details, which are crucial for an agent to use it correctly. The schema covers parameters well, but the description fails to compensate for other 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 description adds minimal meaning beyond the input schema, which has 100% coverage with detailed parameter descriptions. It implies parameters exist ('various options') but doesn't clarify semantics like how 'id', 'list', and 'info' interact. With high schema coverage, the baseline is 3, as the schema does most of the work.

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

Purpose4/5

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

The description states the tool's purpose clearly: 'Generate or fetch images from picsum.photos with various options'. It specifies the verb ('Generate or fetch'), resource ('images'), and source ('picsum.photos'), which is specific and informative. However, it doesn't distinguish from siblings (none provided), so it's not a perfect 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions 'various options' but doesn't specify contexts, exclusions, or prerequisites. Without siblings, it could imply this is the only image tool, but it lacks explicit usage instructions.

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

Related 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/ssv445/lorem-ipsum-mcp'

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