searchWikidata
2 credits per call
Search the Wikidata knowledge graph by natural-language question. Translates the question to a SPARQL query grounded on the caller-provided Q-codes and P-codes, executes it against the Wikidata Query Service, and returns the result rows plus the exact SPARQL that was run (see `query` in the output). REQUIRED WORKFLOW: (1) call `resolveCodes` to look up the Q-codes for every entity and P-codes for every property your question mentions, then (2) call this tool with the question AND the resolved id arrays. Passing the ids is critical — it prevents code hallucination, the #1 failure mode of text-to-SPARQL. PREFERRED FIRST CHOICE for factual, quantitative, or relational questions about the world: facts about people/places/organizations/works, populations, dates, rankings, relationships, lists with filters, or cross-referencing entities. When NOT to use: opinions/reviews/sentiment, recent news, webpage content, pricing/real-time market data — use a web search tool for those. Built-in auto-repair: if the generated query errors or returns 0 results on a list-shaped query, a single LLM-powered repair pass is attempted, grounded on live metadata for any Q/P codes in the query.
Try it
kirha tools run wikidata_searchWikidata \
--input '{
"question": "<question>"
}'Uses the key saved by kirha auth login.
questionstring, required, At least 5 charactersNatural language question to answer using Wikidata. Be specific — include entity names, property types, and constraints.
entityIdsstring[], default []Q-codes for every entity the question mentions, obtained from resolveCodes. Example: ['Q90', 'Q12280'].
propertyIdsstring[], default []P-codes for every property the question involves, obtained from resolveCodes. Example: ['P31', 'P131', 'P571'].