get_properties
Retrieve property IDs linked to a specific Wikidata entity ID using this tool. Input the entity ID to receive a list of associated property IDs, returning an empty list if none exist.
Instructions
Get the properties associated with a given Wikidata entity ID.
Args:
entity_id (str): The entity ID to retrieve properties for. This should be a valid Wikidata entity ID.
Returns:
list: A list of property IDs associated with the given entity ID. If no properties are found, an empty list is returned.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | Yes |
Implementation Reference
- src/server.py:66-88 (handler)The handler function for the 'get_properties' MCP tool. It retrieves the list of property IDs associated with a given Wikidata entity ID by querying the Wikidata API's wbgetentities endpoint with claims props. The function is registered via @server.tool() decorator.@server.tool() async def get_properties(entity_id: str) -> List[str]: """ Get the properties associated with a given Wikidata entity ID. Args: entity_id (str): The entity ID to retrieve properties for. This should be a valid Wikidata entity ID. Returns: list: A list of property IDs associated with the given entity ID. If no properties are found, an empty list is returned. """ params = { "action": "wbgetentities", "ids": entity_id, "props": "claims", "format": "json", } async with httpx.AsyncClient() as client: response = await client.get(WIKIDATA_URL, headers=HEADER, params=params) response.raise_for_status() data = response.json() return list(data.get("entities", {}).get(entity_id, {}).get("claims", {}).keys())