Skip to main content
Glama

Search Wikidata Entities

wikidata_search_entities
Read-only

Search Wikidata for items or properties by text query. Returns QIDs or PIDs with labels, descriptions, and match metadata indicating whether the hit was on a label or alias. Use type="item" for real-world concepts (people, places, works) and type="property" to find predicate P-IDs. The endpoint returns no total count: page by sending each page's nextOffset as offset until a page returns no results or no nextOffset. Only the first 10,000 results are reachable.

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": {
      "query": "<query>"
    },
    "name": "wikidata_search_entities"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNoEntity type to search. Use "item" for Q-IDs (people, places, concepts) or "property" for P-IDs (predicates).item
limitNoResults per page. Default 10; a value above 500, the search endpoint's page maximum, returns at most 500 and says so.
queryYesSearch terms to match against entity labels, aliases, and descriptions.
offsetNoPagination offset, 0–9,999: the endpoint serves only the first 10,000 results. Start at 0, then send each page's nextOffset.
languageNoWikidata language code for returned labels and descriptions (e.g., "en", "de", "zh-hant"). Case-insensitive; "_" is read as "-"; blank means "en".en

Output Schema

NameRequiredDescriptionDefault
capNoThe limit in effect for this page, at most 500.
errorNoPresent when the call failed. Absent on success.
shownNoNumber of results returned on this page.
noticeNoGuidance for this page, every case that applies in one notice: no matches at offset 0, results that ended before this offset, a full page and where to continue, the 10,000-result window, or a limit served at the page maximum.
resultsNoRanked list of matching entities. Empty when no results found.
languageNoThe language used for label and description display.
truncatedNoTrue when this page filled the limit. More results may follow at nextOffset.
nextOffsetNoThe offset to send for the next page: offset + limit. Present on every page that returned results while it stays below 10,000. It marks where to continue, not that more results exist — the endpoint returns no total, and a short page can still be followed by more. A walk ends at the first page with no results or no nextOffset.
searchTypeNoThe entity type that was searched ("item" or "property").
effectiveQueryNoThe search query that was executed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of results to return. Range: 1–50."New value: +"Results per page. Default 10; a value above 500, the search endpoint's page maximum, returns at most 500 and says so."
    • changedInput schema / properties / limit / maximum
      Previous value: -50New value: +9007199254740991
    • changedInput schema / properties / offset / description
      Previous value: -"Pagination offset. Start at 0; increment by limit to page through results."New value: +"Pagination offset, 0–9,999: the endpoint serves only the first 10,000 results. Start at 0, then send each page's nextOffset."
    • changedInput schema / properties / offset / maximum
      Previous value: -9007199254740991New value: +9999
    • changedOutput schema / properties / cap / description
      Previous value: -"The limit parameter in effect."New value: +"The limit in effect for this page, at most 500."
    • addedOutput schema / properties / nextOffset
      Added value: +{
      +  "description": "The offset to send for the next page: offset + limit. Present on every page that returned results while it stays below 10,000. It marks where to continue, not that more results exist — the endpoint returns no total, and a short page can still be followed by more. A walk ends at the first page with no results or no nextOffset.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery hint when results are empty — echoes filters and suggests how to broaden. Absent when results are present."New value: +"Guidance for this page, every case that applies in one notice: no matches at offset 0, results that ended before this offset, a full page and where to continue, the 10,000-result window, or a limit served at the page maximum."
    • changedOutput schema / properties / truncated / description
      Previous value: -"True when results were capped at the limit. The Wikidata search API returns no total count — use offset pagination to retrieve more."New value: +"True when this page filled the limit. More results may follow at nextOffset."
  2. Changed4 schema fields changed
    • changedInput schema / properties / language / description
      Previous value: -"BCP 47 language code for returned labels and descriptions (e.g., \"en\", \"de\", \"zh\")."New value: +"Wikidata language code for returned labels and descriptions (e.g., \"en\", \"de\", \"zh-hant\"). Case-insensitive; \"_\" is read as \"-\"; blank means \"en\"."
    • addedInput schema / properties / language / pattern
      Added value: +"^\\s*(?:[A-Za-z]{2,8}(?:[-_][A-Za-z0-9]{1,9})*\\s*)?$"
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_search_parameter`: The search endpoint refused a request parameter, in practice a language it does not search in such as \"mul\". Other values are possible when a failure originates below the handler."
    • addedOutput schema / properties / error / properties / data / properties / reason / examples
      Added value: +[
      +  "invalid_search_parameter"
      +]
  3. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "results",
      +      "effectiveQuery",
      +      "searchType",
      +      "language",
      +      "shown",
      +      "cap"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode.",
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "results",
      -  "effectiveQuery",
      -  "searchType",
      -  "language",
      -  "shown",
      -  "cap"
      -]
  4. Changed5 schema fields changed
    • addedOutput schema / properties / cap
      Added value: +{
      +  "description": "The limit parameter in effect.",
      +  "type": "number"
      +}
    • removedOutput schema / properties / resultCount
      Removed value: -{
      -  "description": "Number of results returned on this page.",
      -  "type": "number"
      -}
    • addedOutput schema / properties / shown
      Added value: +{
      +  "description": "Number of results returned on this page.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "True when results were capped at the limit. The Wikidata search API returns no total count — use offset pagination to retrieve more.",
      +  "type": "boolean"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "results",
      -  "effectiveQuery",
      -  "searchType",
      -  "language",
      -  "resultCount"
      -]New value: +[
      +  "results",
      +  "effectiveQuery",
      +  "searchType",
      +  "language",
      +  "shown",
      +  "cap"
      +]
  5. Changed8 schema fields changed
    • addedOutput schema / properties / effectiveQuery
      Added value: +{
      +  "description": "The search query that was executed.",
      +  "type": "string"
      +}
    • removedOutput schema / properties / message
      Removed value: -{
      -  "description": "Recovery hint when results are empty — suggests how to broaden the query. Absent when results are present.",
      -  "type": "string"
      -}
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Recovery hint when results are empty — echoes filters and suggests how to broaden. Absent when results are present.",
      +  "type": "string"
      +}
    • removedOutput schema / properties / query
      Removed value: -{
      -  "description": "The search query that was executed.",
      -  "type": "string"
      -}
    • addedOutput schema / properties / resultCount
      Added value: +{
      +  "description": "Number of results returned on this page.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / searchType
      Added value: +{
      +  "description": "The entity type that was searched (\"item\" or \"property\").",
      +  "type": "string"
      +}
    • removedOutput schema / properties / type
      Removed value: -{
      -  "description": "The entity type that was searched (\"item\" or \"property\").",
      -  "type": "string"
      -}
    • changedOutput schema / required
      Previous value: -[
      -  "results",
      -  "query",
      -  "type",
      -  "language"
      -]New value: +[
      +  "results",
      +  "effectiveQuery",
      +  "searchType",
      +  "language",
      +  "resultCount"
      +]
  6. First observed

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnly and openWorld, so the description carries real weight here and delivers: no total count is returned, results are capped at the first 10,000, and paging follows a nextOffset chain. It also discloses that match metadata distinguishes label from alias hits. Remaining gaps are minor (no ranking/relevance caveats).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four tight sentences with the highest-value facts (what it returns, type routing, pagination mechanics) front-loaded. Minor redundancy with the schema on type semantics and the 10,000 cap, but no filler.

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

Completeness5/5

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

With an output schema present and full schema description coverage, the description only needs to cover scope and non-obvious behavior, which it does: entity-type routing, alias vs label matching, and the pagination contract. An agent has everything needed to call it correctly on the first attempt.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds protocol-level meaning not in the field docs: the termination condition for the nextOffset/offset loop and the hard reachability ceiling of 10,000 results. It repeats the type semantics already documented in the enum description, which limits the added value somewhat.

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

Purpose5/5

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

The first sentence names a specific verb and resource ("Search Wikidata for items or properties by text query") and the second states exactly what comes back (QIDs/PIDs with labels, descriptions, and label-vs-alias match metadata). This clearly distinguishes it from siblings like wikidata_get_entity or wikidata_sparql_query, which fetch or query rather than free-text search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing guidance is given for the type parameter: "item" for real-world concepts, "property" for predicate P-IDs. The pagination section tells the agent the exact loop to run (send nextOffset as offset until an empty page or missing nextOffset). It stops short of naming a sibling alternative such as sparql_query for complex queries, so it is strong but not complete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.