execute_sparql
Execute SPARQL queries on Wikidata to retrieve structured data in JSON format, enabling data extraction and analysis from the knowledge base.
Instructions
Execute a SPARQL query on Wikidata.
You may assume the following prefixes:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
Args:
sparql_query (str): The SPARQL query to execute.
Returns:
str: The JSON-formatted result of the SPARQL query execution. If there are no results, an empty JSON object will be returned.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sparql_query": "<sparql_query>"
},
"name": "execute_sparql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sparql_query | Yes |