Skip to main content
Glama
misanthropic-ai

DuckDuckGo MCP Server

ddg-image-search

Search for images on the web using DuckDuckGo with filters for size, color, type, license, and time limits.

Instructions

Search the web for images using DuckDuckGo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYesSearch query keywords
regionNoRegion code (e.g., wt-wt, us-en, uk-en)wt-wt
safesearchNoSafe search levelmoderate
timelimitNoTime limit (d=day, w=week, m=month, y=year)
sizeNoImage size
colorNoImage color
type_imageNoImage type
layoutNoImage layout
license_imageNoImage license type
max_resultsNoMaximum number of results to return

Implementation Reference

  • The handler logic for the 'ddg-image-search' tool within the @server.call_tool() function. It parses input arguments, performs an image search using DuckDuckGo's DDGS.images(), processes the results, and returns interleaved text descriptions and image contents.
    elif name == "ddg-image-search":
        keywords = arguments.get("keywords")
        if not keywords:
            raise ValueError("Missing keywords")
        
        region = arguments.get("region", "wt-wt")
        safesearch = arguments.get("safesearch", "moderate")
        timelimit = arguments.get("timelimit")
        size = arguments.get("size")
        color = arguments.get("color")
        type_image = arguments.get("type_image")
        layout = arguments.get("layout")
        license_image = arguments.get("license_image")
        max_results = arguments.get("max_results", 10)
        
        # Perform search
        ddgs = DDGS()
        results = ddgs.images(
            keywords=keywords,
            region=region,
            safesearch=safesearch,
            timelimit=timelimit,
            size=size,
            color=color,
            type_image=type_image,
            layout=layout,
            license_image=license_image,
            max_results=max_results
        )
        
        # Format results
        formatted_results = f"Image search results for '{keywords}':\n\n"
        
        text_results = []
        image_results = []
        
        for i, result in enumerate(results, 1):
            text_results.append(
                types.TextContent(
                    type="text",
                    text=f"{i}. {result.get('title', 'No title')}\n"
                         f"   Source: {result.get('source', 'Unknown')}\n"
                         f"   URL: {result.get('url', 'No URL')}\n"
                         f"   Size: {result.get('width', 'N/A')}x{result.get('height', 'N/A')}\n"
                )
            )
            
            image_url = result.get('image')
            if image_url:
                image_results.append(
                    types.ImageContent(
                        type="image",
                        url=image_url,
                        alt_text=result.get('title', 'Image search result')
                    )
                )
        
        # Interleave text and image results
        combined_results = []
        for text, image in zip(text_results, image_results):
            combined_results.extend([text, image])
        
        return combined_results
  • Registration of the 'ddg-image-search' tool in the @server.list_tools() function, including its name, description, and detailed JSON schema for input parameters.
    types.Tool(
        name="ddg-image-search",
        description="Search the web for images using DuckDuckGo",
        inputSchema={
            "type": "object",
            "properties": {
                "keywords": {"type": "string", "description": "Search query keywords"},
                "region": {"type": "string", "description": "Region code (e.g., wt-wt, us-en, uk-en)", "default": "wt-wt"},
                "safesearch": {"type": "string", "enum": ["on", "moderate", "off"], "description": "Safe search level", "default": "moderate"},
                "timelimit": {"type": "string", "enum": ["d", "w", "m", "y"], "description": "Time limit (d=day, w=week, m=month, y=year)"},
                "size": {"type": "string", "enum": ["Small", "Medium", "Large", "Wallpaper"], "description": "Image size"},
                "color": {"type": "string", "enum": ["color", "Monochrome", "Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "Brown", "Black", "Gray", "Teal", "White"], "description": "Image color"},
                "type_image": {"type": "string", "enum": ["photo", "clipart", "gif", "transparent", "line"], "description": "Image type"},
                "layout": {"type": "string", "enum": ["Square", "Tall", "Wide"], "description": "Image layout"},
                "license_image": {"type": "string", "enum": ["any", "Public", "Share", "ShareCommercially", "Modify", "ModifyCommercially"], "description": "Image license type"},
                "max_results": {"type": "integer", "description": "Maximum number of results to return", "default": 10},
            },
            "required": ["keywords"],
        },
    ),
  • JSON schema defining the input parameters for the 'ddg-image-search' tool, including required 'keywords' and various optional filters.
    inputSchema={
        "type": "object",
        "properties": {
            "keywords": {"type": "string", "description": "Search query keywords"},
            "region": {"type": "string", "description": "Region code (e.g., wt-wt, us-en, uk-en)", "default": "wt-wt"},
            "safesearch": {"type": "string", "enum": ["on", "moderate", "off"], "description": "Safe search level", "default": "moderate"},
            "timelimit": {"type": "string", "enum": ["d", "w", "m", "y"], "description": "Time limit (d=day, w=week, m=month, y=year)"},
            "size": {"type": "string", "enum": ["Small", "Medium", "Large", "Wallpaper"], "description": "Image size"},
            "color": {"type": "string", "enum": ["color", "Monochrome", "Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "Brown", "Black", "Gray", "Teal", "White"], "description": "Image color"},
            "type_image": {"type": "string", "enum": ["photo", "clipart", "gif", "transparent", "line"], "description": "Image type"},
            "layout": {"type": "string", "enum": ["Square", "Tall", "Wide"], "description": "Image layout"},
            "license_image": {"type": "string", "enum": ["any", "Public", "Share", "ShareCommercially", "Modify", "ModifyCommercially"], "description": "Image license type"},
            "max_results": {"type": "integer", "description": "Maximum number of results to return", "default": 10},
        },
        "required": ["keywords"],
    },
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 states the action ('Search') but doesn't describe what the tool returns (e.g., image URLs, metadata, pagination), potential rate limits, authentication needs, or error conditions. For a search tool with 10 parameters and no annotations, this leaves significant behavioral gaps.

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 purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence earns its place by specifying the service and resource type.

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 (10 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain return values, behavioral traits like rate limits or errors, or usage context relative to siblings. For a search tool with rich parameters but no structured output or annotations, more descriptive context is needed to guide effective use.

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?

Schema description coverage is 100%, so the schema already documents all 10 parameters thoroughly with descriptions and enums. The description adds no additional parameter information beyond what the schema provides. According to guidelines, when coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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 ('Search') and resource ('the web for images') with the specific service ('using DuckDuckGo'), making the purpose immediately understandable. It distinguishes from siblings by specifying 'images' versus text, news, video, or AI chat searches. However, it doesn't explicitly contrast with sibling tools beyond the resource type.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention sibling tools or suggest scenarios where image search is preferable over text, news, video, or AI chat searches. Usage is implied by the resource type but not explicitly stated.

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/misanthropic-ai/ddg-mcp'

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