Skip to main content
Glama
qpd-v

mcp-image-downloader

by qpd-v

download_image

Download images from a URL and save them to a specified path using the MCP server's image downloader functionality.

Instructions

Download an image from a URL to a specified path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputPathYesPath where to save the image
urlYesURL of the image to download

Implementation Reference

  • The main handler function that downloads the image from the given URL using axios, ensures the output directory exists, saves the image to the specified path, and returns success or error content.
    private async handleDownloadImage(args: DownloadImageArgs) {
      try {
        // Ensure output directory exists
        await fs.ensureDir(path.dirname(args.outputPath));
    
        // Download image
        const response = await axios({
          method: 'GET',
          url: args.url,
          responseType: 'arraybuffer',
          headers: {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
          },
          timeout: 30000,
        });
    
        // Save image
        await fs.writeFile(args.outputPath, response.data);
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully downloaded image to ${args.outputPath}`,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
        console.error('Download error:', errorMessage);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to download image: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • TypeScript interface defining the input arguments for the download_image tool: url (string) and outputPath (string).
    interface DownloadImageArgs {
      url: string;
      outputPath: string;
    }
  • src/index.ts:77-94 (registration)
    Tool registration in the listTools response, including name, description, and JSON input schema.
    {
      name: 'download_image',
      description: 'Download an image from a URL to a specified path',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL of the image to download',
          },
          outputPath: {
            type: 'string',
            description: 'Path where to save the image',
          },
        },
        required: ['url', 'outputPath'],
      },
    },
  • Type guard function to validate if arguments match DownloadImageArgs structure.
    private isDownloadImageArgs(args: unknown): args is DownloadImageArgs {
      if (!args || typeof args !== 'object') return false;
      const a = args as Record<string, unknown>;
      return (
        typeof a.url === 'string' &&
        typeof a.outputPath === 'string'
      );
    }
  • src/index.ts:132-136 (registration)
    Dispatch case in CallToolRequestHandler that validates arguments and calls the download_image handler.
    case 'download_image':
      if (!this.isDownloadImageArgs(request.params.arguments)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for download_image');
      }
      return this.handleDownloadImage(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions downloading to a path but doesn't cover critical aspects like error handling (e.g., invalid URLs, network failures), file overwriting behavior, supported image formats, or authentication needs. This leaves significant gaps for an agent to understand how the tool behaves in practice.

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 directly states the tool's function without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

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 complexity of a download operation (which involves network I/O and file system changes), the description is insufficient. With no annotations, no output schema, and minimal behavioral details, it fails to provide enough context for safe and effective use. Key aspects like error conditions, performance implications, or return values are missing.

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 input schema has 100% description coverage, clearly documenting both parameters ('url' and 'outputPath'). The description adds minimal value beyond this, only reiterating that the URL is for the image and the path is for saving it. This meets the baseline for high schema coverage.

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 clearly states the action ('download') and resource ('image from a URL'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'optimize_image' (which likely processes images rather than downloading them), so it doesn't reach the highest score.

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 like 'optimize_image' or other potential tools. It states what the tool does but offers no context about appropriate use cases, prerequisites, or exclusions.

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/qpd-v/mcp-image-downloader'

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