Skip to main content
Glama
zzaebok

Wikidata MCP Server

by zzaebok

get_metadata

Retrieve English labels and descriptions for Wikidata entities by providing their entity ID and optional language code.

Instructions

Retrieve the English label and description for a given Wikidata entity ID.

Args:
    entity_id (str): The entity ID to retrieve metadata for.
    language (str): The language code for the label and description (default is "en"). Use ISO 639-1 codes.

Returns:
    dict: A dictionary containing the label and description of the entity, if available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYes
languageNoen

Implementation Reference

  • The handler function for the 'get_metadata' tool, decorated with @server.tool() for registration. It fetches the label and description of a Wikidata entity using the Wikidata API.
    @server.tool()
    async def get_metadata(entity_id: str, language: str = "en") -> Dict[str, str]:
        """
        Retrieve the English label and description for a given Wikidata entity ID.
    
        Args:
            entity_id (str): The entity ID to retrieve metadata for.
            language (str): The language code for the label and description (default is "en"). Use ISO 639-1 codes.
    
        Returns:
            dict: A dictionary containing the label and description of the entity, if available.
        """
        params = {
            "action": "wbgetentities",
            "ids": entity_id,
            "props": "labels|descriptions",
            "languages": language,  # specify the desired language
            "format": "json",
        }
        async with httpx.AsyncClient() as client:
            response = await client.get(WIKIDATA_URL, params=params)
        response.raise_for_status()
        data = response.json()
        entity_data = data.get("entities", {}).get(entity_id, {})
        label = (
            entity_data.get("labels", {}).get(language, {}).get("value", "No label found")
        )
        descriptions = (
            entity_data.get("descriptions", {})
            .get(language, {})
            .get("value", "No label found")
        )
        return {"Label": label, "Descriptions": descriptions}
Behavior3/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 explains what the tool does (retrieves metadata) and mentions the return format (dictionary with label/description), but does not cover potential errors, rate limits, authentication needs, or what happens if data is unavailable. It adds basic context but lacks depth for a tool with no annotation support.

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 well-structured with a clear purpose statement, parameter details in an 'Args' section, and return information. Every sentence earns its place by providing essential information without redundancy, making it efficient and easy to parse.

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

Completeness4/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 (2 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, parameters, and return format, but lacks details on error handling or edge cases (e.g., unavailable data). With no output schema, it appropriately explains the return value, though could be more comprehensive.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must fully compensate. It provides detailed semantics for both parameters: 'entity_id' is explained as 'the entity ID to retrieve metadata for', and 'language' includes its purpose, default value ('en'), and format specification ('ISO 639-1 codes'). This adds significant value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieve'), resource ('English label and description'), and target ('Wikidata entity ID'). It distinguishes itself from sibling tools like 'search_entity' or 'get_properties' by focusing on metadata retrieval rather than searching or property fetching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to get label/description for a Wikidata entity ID) but does not explicitly mention when not to use it or name specific alternatives among the sibling tools. The context is well-defined but lacks explicit exclusions or comparisons.

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/zzaebok/mcp-wikidata'

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