Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

extract_images

Extract all image URLs from web pages to collect visual assets for development projects. Handles both static and dynamic content.

Instructions

Extract all image URLs from a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to scrape
useBrowserNoUse browser for dynamic content

Implementation Reference

  • Registration of the 'extract_images' tool including its name, description, and input schema in the webScrapingTools array.
    {
      name: 'extract_images',
      description: 'Extract all image URLs from a web page',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to scrape',
          },
          useBrowser: {
            type: 'boolean',
            description: 'Use browser for dynamic content',
            default: false,
          },
        },
        required: ['url'],
      },
    },
  • Handler dispatcher in handleWebScrapingTool for 'extract_images', delegating to dynamic or static scraper based on useBrowser flag.
    case 'extract_images': {
      if (config.useBrowser) {
        const data = await dynamicScraper.scrapeDynamicContent(config);
        return data.images;
      } else {
        return await staticScraper.extractImages(config);
      }
    }
  • StaticScraper.extractImages handler that invokes scrapeHTML and returns the extracted images.
    /**
     * Extract images from HTML
     */
    async extractImages(config: ScrapingConfig): Promise<string[]> {
      const data = await this.scrapeHTML(config);
      return data.images || [];
    }
  • Core logic for extracting image URLs using Cheerio within the scrapeHTML method.
    const images: string[] = [];
    $('img[src]').each((_, element) => {
      const src = $(element).attr('src');
      if (src) {
        try {
          const url = new URL(src, config.url);
          images.push(url.href);
        } catch {
          // Invalid URL, skip
        }
      }
    });

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/code-alchemist01/development-tools-mcp-Server'

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