Skip to main content
Glama
zzaebok

Wikidata MCP Server

by zzaebok

search_property

Find Wikidata property IDs by entering descriptive queries to identify specific data attributes in the knowledge base.

Instructions

Search for a Wikidata property ID by its query.

Args:
    query (str): The query to search for. The query should be unambiguous enough to uniquely identify the property.

Returns:
    str: The Wikidata property ID corresponding to the given query."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • src/server.py:52-52 (registration)
    Registers the 'search_property' tool using the @server.tool() decorator.
    @server.tool()
  • The handler function for the 'search_property' tool. It calls the shared search_wikidata helper with is_entity=False to find property IDs.
    async def search_property(query: str) -> str:
        """
        Search for a Wikidata property ID by its query.
    
        Args:
            query (str): The query to search for. The query should be unambiguous enough to uniquely identify the property.
    
        Returns:
            str: The Wikidata property ID corresponding to the given query."
        """
        return await search_wikidata(query, is_entity=False)
  • Helper function that performs the Wikidata search API call, used by both search_entity and search_property tools.
    async def search_wikidata(query: str, is_entity: bool = True) -> str:
        """
        Search for a Wikidata item or property ID by its query.
        """
        params = {
            "action": "query",
            "list": "search",
            "srsearch": query,
            "srnamespace": 0 if is_entity else 120,
            "srlimit": 1,  # TODO: add a parameter to limit the number of results?
            "srqiprofile": "classic_noboostlinks" if is_entity else "classic",
            "srwhat": "text",
            "format": "json",
        }
        async with httpx.AsyncClient() as client:
            response = await client.get(WIKIDATA_URL, headers=HEADER, params=params)
        response.raise_for_status()
        try:
            title = response.json()["query"]["search"][0]["title"]
            title = title.split(":")[-1]
            return title
        except KeyError:
            return "No results found. Consider changing the search term."
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 states the tool searches and returns a property ID, but lacks details on error handling, rate limits, authentication needs, or what happens if the query isn't unique. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

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 appropriately sized and front-loaded, with the core purpose stated first, followed by clear sections for Args and Returns. Every sentence adds value: the first defines the tool, the second clarifies the query requirement, and the third specifies the return type. There's no redundant or wasted text.

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 moderate complexity (search operation with one parameter) and lack of annotations or output schema, the description is minimally adequate. It covers the basic purpose, parameter intent, and return value, but doesn't address potential ambiguities, error cases, or how it differs from sibling tools. For a search function, more context on usage and behavior would improve completeness.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema, which has 0% description coverage. It explains that the 'query' parameter should be 'unambiguous enough to uniquely identify the property,' providing guidance on query formulation that isn't in the schema. With only one parameter and no schema descriptions, this compensates well, though it could elaborate on query format or examples.

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 tool's purpose: 'Search for a Wikidata property ID by its query.' It specifies the verb ('search'), resource ('Wikidata property ID'), and mechanism ('by its query'). However, it doesn't explicitly differentiate from sibling tools like 'search_entity' or 'get_properties', which likely have related but distinct functions.

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. It mentions that the query should be 'unambiguous enough to uniquely identify the property,' which hints at a prerequisite but doesn't clarify scenarios where this tool is preferred over siblings like 'search_entity' or 'get_properties.' No explicit when/when-not statements or alternative recommendations are included.

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