Skip to main content
Glama
marksverdhei

DHLAB MCP Server

by marksverdhei

lookup_word_lemma

Find the base form of Norwegian words using the National Library of Norway's Digital Humanities Lab to support linguistic analysis and text processing.

Instructions

Look up the lemma (base form) of a Norwegian word.

Args: word: The word to look up

Returns: JSON string containing lemma information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wordYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'lookup_word_lemma' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function uses dhlab.WordLemma to fetch the lemma of the input word and returns it as JSON.
    @mcp.tool()
    def lookup_word_lemma(word: str) -> str:
        """Look up the lemma (base form) of a Norwegian word.
    
        Args:
            word: The word to look up
    
        Returns:
            JSON string containing lemma information
        """
        try:
            word_lemma = dhlab.WordLemma(word)
    
            if hasattr(word_lemma, 'lemmas') and word_lemma.lemmas is not None:
                return word_lemma.lemmas.to_json(orient='records', force_ascii=False)
            return f"No lemma found for word: {word}"
        except Exception as e:
            return f"Error looking up word lemma: {str(e)}"
  • The @mcp.tool() decorator registers the lookup_word_lemma function as an MCP tool.
    @mcp.tool()
  • The docstring provides the tool description, input argument 'word: str', and output format as JSON string, serving as the schema.
    """Look up the lemma (base form) of a Norwegian word.
    
    Args:
        word: The word to look up
    
    Returns:
        JSON string containing lemma information
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 the return format ('JSON string') but doesn't describe error handling, rate limits, authentication needs, or what happens with invalid inputs. For a lookup tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 efficiently structured with a clear purpose statement followed by separate Args and Returns sections. It avoids redundancy and wastes no words, though the 'JSON string' return specification could be slightly more informative (e.g., mentioning structure or keys).

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 low complexity (single parameter) and the presence of an output schema (which handles return values), the description is reasonably complete for basic use. However, the lack of annotations and minimal behavioral context means users might not fully understand error cases or operational limits.

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 schema description coverage is 0%, but the description explicitly documents the single parameter 'word' and its purpose ('The word to look up'). This adds meaningful context beyond the bare schema. However, it doesn't specify constraints like word length, character set, or handling of compound words, leaving some ambiguity.

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 verb ('look up') and resource ('lemma of a Norwegian word'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its sibling 'lookup_word_forms', which likely serves a related but distinct function.

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 'lookup_word_forms' or other sibling 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

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