lookup_word_forms
Retrieve different grammatical forms of Norwegian words from the National Library's digital collections for linguistic analysis and language learning.
Instructions
Look up different forms of a Norwegian word.
Args: word: The word to look up
Returns: JSON string containing different word forms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| word | Yes |
Implementation Reference
- src/dhlab_mcp/server.py:202-219 (handler)The main handler function for the 'lookup_word_forms' tool, decorated with @mcp.tool() for registration. It uses dhlab.WordForm to fetch word forms and returns JSON.@mcp.tool() def lookup_word_forms(word: str) -> str: """Look up different forms of a Norwegian word. Args: word: The word to look up Returns: JSON string containing different word forms """ try: word_form = dhlab.WordForm(word) if hasattr(word_form, 'forms') and word_form.forms is not None: return word_form.forms.to_json(orient='records', force_ascii=False) return f"No forms found for word: {word}" except Exception as e: return f"Error looking up word forms: {str(e)}"