Skip to main content
Glama
marksverdhei

DHLAB MCP Server

by marksverdhei

search_images

Search the National Library of Norway's digital collection for historical images using keywords and date filters to find visual resources.

Instructions

Search for images in the National Library's digital collection.

Args: query: Search query string limit: Maximum number of results (default: 10) from_year: Start year (optional) to_year: End year (optional)

Returns: JSON string containing image search results with URLs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo
from_yearNo
to_yearNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'search_images' tool. Decorated with @mcp.tool() for automatic registration in FastMCP. Implements image search logic using the dhlab library's find_urls function, handling parameters like query, limit, and date ranges, and returns JSON-formatted results or error messages.
    @mcp.tool()
    def search_images(
        query: str,
        limit: int = 10,
        from_year: int | None = None,
        to_year: int | None = None,
    ) -> str:
        """Search for images in the National Library's digital collection.
    
        Args:
            query: Search query string
            limit: Maximum number of results (default: 10)
            from_year: Start year (optional)
            to_year: End year (optional)
    
        Returns:
            JSON string containing image search results with URLs
        """
        try:
            from dhlab.images.nbpictures import find_urls
    
            # find_urls returns a list of URLs
            results = find_urls(term=query, number=limit, mediatype="bilder")
    
            if results is not None and len(results) > 0:
                import json
                return json.dumps(results, ensure_ascii=False)
            return "No images found"
        except Exception as e:
            return f"Error searching images: {str(e)}"
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 the tool returns 'JSON string containing image search results with URLs', which adds some context about the output format. However, it doesn't cover important aspects like rate limits, authentication needs, pagination, error handling, or whether it's a read-only operation. For a search tool with no annotations, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It starts with a clear purpose statement, followed by organized sections for Args and Returns. Each sentence serves a specific function without redundancy. However, the 'Returns' section could be slightly more concise by integrating with the purpose statement.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no annotations, but with an output schema), the description is partially complete. It covers parameters well and mentions the output format, but lacks usage guidelines, behavioral details, and differentiation from siblings. The output schema existence reduces the need to fully explain return values, but more context is needed for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for all 4 parameters: 'query' as a search string, 'limit' as maximum results with default, and 'from_year'/'to_year' as optional year filters. This adds meaningful context beyond the bare schema types, though it could elaborate on query syntax or year format constraints.

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 tool's purpose: 'Search for images in the National Library's digital collection.' This specifies the verb ('search'), resource ('images'), and context ('National Library's digital collection'). However, it doesn't explicitly differentiate from sibling tools like 'search_texts', which searches texts rather than images, though this distinction is somewhat implied by 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'search_texts' for text searches or other tools for different types of queries. There's no context on prerequisites, constraints, or typical use cases beyond the basic function.

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/marksverdhei/dhlab-mcp'

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