get_properties
Retrieve property IDs for a Wikidata entity to access its structured data attributes and relationships.
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' tool. It queries the Wikidata API using wbgetentities to retrieve the claims (properties) for the given entity_id and returns a list of property IDs.@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())
- src/server.py:66-66 (registration)Registration of the 'get_properties' tool using the FastMCP server's tool decorator.@server.tool()
- src/server.py:67-76 (schema)Input schema (entity_id: str) and output type (List[str]) defined in function signature and docstring.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. """