wikidata_sparql_query
ActiveTool of io.github.cyanheads/wikidata-mcp-server
Execute a SPARQL SELECT query against the Wikidata Query Service. Full graph power: multi-hop traversals, aggregations, subqueries, OPTIONAL, FILTER, UNION, BIND. Standard Wikidata prefixes (wd:, wdt:, p:, ps:, pq:, wikibase:, bd:) are auto-injected. The wikibase:label SERVICE is also auto-injected when language is set and the query includes ?<var>Label variables — so you can use ?itemLabel without writing the boilerplate. Hard server timeout is 60s; use LIMIT to keep queries fast. Bindings use the SPARQL 1.1 JSON format: each value is { type, value, "xml:lang"? }. Use wikidata_get_labels to humanize QID results from this tool.
Parameters schema
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"query"
],
"properties": {
"query": {
"type": "string",
"minLength": 1,
"description": "SPARQL SELECT query. Must be a SELECT query (not CONSTRUCT/DESCRIBE/ASK). Standard prefixes (wd:, wdt:, p:, ps:, pq:, wikibase:, bd:) are injected automatically. Example: SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146. } LIMIT 10"
},
"timeout": {
"type": "integer",
"default": 30,
"maximum": 55,
"minimum": 1,
"description": "Client-side timeout in seconds (1–55). Capped at 55s — the Wikidata server hard limit is 60s."
},
"language": {
"type": "string",
"default": "en",
"description": "Language for the wikibase:label SERVICE (e.g., \"en\", \"de\"). Controls the language of ?<var>Label variables. Set to \"\" to suppress label SERVICE injection."
}
}
}Parent server
io.github.cyanheads/wikidata-mcp-server
https://github.com/cyanheads/wikidata-mcp-server
1/7 registries