# Wikidata SPARQL query

Run a read-only SPARQL query on the Wikidata Query Service and get SPARQL JSON results (head.vars, results.bindings): lists such as companies by country. Needs query.

Run a read-only SPARQL query on the Wikidata Query Service and get SPARQL JSON results (head.vars, results.bindings): lists such as companies by country and industry with founding dates, subsidiaries, headquarters, official websites or identifiers (LEI, ISIN, ticker), people by role, products by maker. Always add a LIMIT (e.g. 50) and use SERVICE wikibase:label for labels; the server stops queries after 60 seconds. Scholarly articles live in a separate graph and are not in this endpoint.

- Tool ID: `wikidata/sparql`
- Provider: [Wikidata](/providers/wikidata.md)
- Capability: [Wikipedia, books & web archives](/tools/knowledge/reference.md)
- Price: no charge per call
- Authentication: an authorised Agentik workspace is required for execution, including zero-price tools.

## Pricing contract

No charge per call. A workspace is still needed so your agent can call it.


```json
{
  "model": "per_call",
  "amountUsd": 0
}
```

## Complete input schema


```json
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 10,
      "maxLength": 6000,
      "description": "SPARQL SELECT or ASK query with a LIMIT, e.g. 'SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q4830453; wdt:P17 wd:Q142. SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". } } LIMIT 20'"
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}
```

## Published example

This is the provider tool’s published example. Replace example values with the user’s requested inputs, respecting the schema; do not execute an example merely to test a connection.


```json
{
  "tool_id": "wikidata/sparql",
  "input": {
    "query": "SELECT ?item ?itemLabel ?inception WHERE { ?item wdt:P31 wd:Q4830453; wdt:P17 wd:Q142; wdt:P452 wd:Q11661. OPTIONAL { ?item wdt:P571 ?inception } SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". } } LIMIT 5"
  }
}
```

## Execute and retrieve

Inspect again before execution, explain the price and obtain the required authority. Use MCP run_tool or POST /v1/run with this tool ID, valid input and an idempotency key. Save the returned run ID and follow the actual state. If Agentik answers that the tool is temporarily unavailable, do not retry it blindly; use discovery to propose an alternative.

A partial or uncertain result can still have consumed provider resources. Consult [billing](/docs/billing.md), [idempotency](/docs/idempotency.md) and [asynchronous results](/docs/async.md).

Licence: CC0 1.0 (Wikidata structured data).

Attribution: Data from Wikidata (CC0).

[Provider documentation](https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/Wikidata_Query_Help)

[REST inspection](https://api.agentik.cc/v1/tools/wikidata/sparql) · [OpenAPI](/openapi.json) · [Connection guide](/connect.md)

---

[HTML page](/providers/wikidata/sparql) · [Agent index](/llms.txt)
