Skip to main content
Glama
joelgombin

MCP Wikidata Server

by joelgombin

find_by_property

Search Wikidata entities using specific property-value pairs to locate relevant data entries based on defined criteria.

Instructions

Find entities by property and value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
propertyYesProperty ID (P123)
valueYesProperty value to search for
languageNoLanguage code (default: en)en
limitNoMaximum number of results

Implementation Reference

  • The core handler function that implements the find_by_property tool logic by constructing and executing a SPARQL query to find Wikidata entities matching the specified property and value.
    async def find_by_property(
        self,
        property: str,
        value: str,
        language: str = "en",
        limit: int = 10
    ) -> Dict[str, Any]:
        query = f"""
        SELECT ?item ?itemLabel WHERE {{
          ?item wdt:{property} "{value}" .
          SERVICE wikibase:label {{ bd:serviceParam wikibase:language "{language}" . }}
        }}
        LIMIT {limit}
        """
    
        result = await self.sparql_query(query)
        
        entities = []
        for binding in result.get("results", {}).get("bindings", []):
            entities.append({
                "id": binding.get("item", {}).get("value", "").split("/")[-1],
                "label": binding.get("itemLabel", {}).get("value", "")
            })
    
        return {"entities": entities}
  • The JSON schema defining the input parameters for the find_by_property tool, including property, value (required), language, and limit.
    inputSchema={
        "type": "object",
        "properties": {
            "property": {
                "type": "string",
                "description": "Property ID (P123)"
            },
            "value": {
                "type": "string",
                "description": "Property value to search for"
            },
            "language": {
                "type": "string",
                "description": "Language code (default: en)",
                "default": "en"
            },
            "limit": {
                "type": "integer",
                "description": "Maximum number of results",
                "default": 10,
                "maximum": 100
            }
        },
        "required": ["property", "value"]
    }
  • Registers the find_by_property tool in the MCP tool definitions list, specifying its name, description, and input schema.
    Tool(
        name="find_by_property",
        description="Find entities by property and value",
        inputSchema={
            "type": "object",
            "properties": {
                "property": {
                    "type": "string",
                    "description": "Property ID (P123)"
                },
                "value": {
                    "type": "string",
                    "description": "Property value to search for"
                },
                "language": {
                    "type": "string",
                    "description": "Language code (default: en)",
                    "default": "en"
                },
                "limit": {
                    "type": "integer",
                    "description": "Maximum number of results",
                    "default": 10,
                    "maximum": 100
                }
            },
            "required": ["property", "value"]
        }
    )
  • Dispatches the tool call to the client handler in the WikidataTools.call_tool method.
    elif name == "find_by_property":
        result = await self.client.find_by_property(**arguments)
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 action ('Find') but doesn't describe whether this is a read-only operation, what permissions might be needed, how results are returned (e.g., pagination, format), or any rate limits. This leaves significant gaps for a tool with 4 parameters and no output schema.

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 a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the core functionality without unnecessary elaboration, making it easy for an agent to parse quickly.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, result handling, and differentiation from siblings, leaving the agent under-informed about how to effectively invoke and interpret this tool.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters (property, value, language, limit) with descriptions and defaults. The description adds no additional meaning beyond what's in the schema, such as examples of property IDs or value formats, but doesn't need to compensate for gaps, meeting the baseline for high coverage.

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

Purpose3/5

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

The description 'Find entities by property and value' states a clear verb ('Find') and resource ('entities'), but it's vague about what 'entities' refers to and doesn't distinguish from sibling tools like 'search_entities' or 'get_entity'. It provides a basic purpose but lacks specificity about scope or domain.

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?

No guidance is provided on when to use this tool versus alternatives like 'search_entities' or 'get_entity'. The description implies a property-value search but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

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

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