Skip to main content
Glama

Get Wikidata Labels

wikidata_get_labels
Read-only

Resolve QIDs or PIDs to their human-readable labels and descriptions, with no claim data. Resolves up to 500 distinct IDs per call, batched automatically; distinct IDs past the first 500 come back in deferredIds to send in a follow-up call. Accepts bare IDs (Q76), entity URIs (http://www.wikidata.org/entity/Q76), and wd:Q76 — the forms wikidata_sparql_query returns — so its results can be humanized as they are.

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": {
      "ids": "<ids>"
    },
    "name": "wikidata_get_labels"
  }
}

Input Schema

NameRequiredDescriptionDefault
idsYesQ-IDs (e.g., "Q76") or P-IDs (e.g., "P31") to resolve, bare or as an entity URI or wd: form (e.g., "http://www.wikidata.org/entity/Q76", "wd:Q76"). Up to 10,000 entries; duplicates count once, the first 500 distinct IDs resolve, and the rest come back in deferredIds. A malformed entry is returned in invalid without failing the call.
languagesNoWikidata language codes for returned labels and descriptions (e.g., ["en", "de", "fr"]), up to 50. Case-insensitive; "_" is read as "-"; blank entries are dropped, and an empty list means ["en"]. A language with no label of its own falls back to the entity's multilingual ("mul") value, returned under the requested code.

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
foundNoCount of IDs that returned data.
noticeNoExplains deferred IDs or which requested language codes Wikidata did not recognize.
invalidNoEntries that are not a Q-ID or P-ID in any accepted form, echoed as sent and never looked up. Absent when every entry is well-formed.
entitiesNoMap of entity ID to labels and descriptions. IDs that were not found are absent.
notFoundNoWell-formed IDs that were looked up and returned no entity (unassigned or out of range), each once.
languagesNoThe language codes that were requested.
deferredIdsNoDistinct IDs past the first 500, in input order, not looked up in this call — send them in another call. Absent when every ID fit.
unrecognizedLanguagesNoRequested codes Wikidata does not recognize for labels and descriptions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedOutput schema / properties / notice / description
      Previous value: -"Present when IDs were deferred: how many resolved, and how many to send again from deferredIds."New value: +"Explains deferred IDs or which requested language codes Wikidata did not recognize."
    • addedOutput schema / properties / unrecognizedLanguages
      Added value: +{
      +  "description": "Requested codes Wikidata does not recognize for labels and descriptions.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Changed9 schema fields changed
    • changedInput schema / properties / ids / description
      Previous value: -"Q-IDs (e.g., \"Q76\") or P-IDs (e.g., \"P31\") to resolve. 1–50 IDs per call."New value: +"Q-IDs (e.g., \"Q76\") or P-IDs (e.g., \"P31\") to resolve, bare or as an entity URI or wd: form (e.g., \"http://www.wikidata.org/entity/Q76\", \"wd:Q76\"). Up to 10,000 entries; duplicates count once, the first 500 distinct IDs resolve, and the rest come back in deferredIds. A malformed entry is returned in invalid without failing the call."
    • changedInput schema / properties / ids / maxItems
      Previous value: -50New value: +10000
    • changedInput schema / properties / languages / description
      Previous value: -"Wikidata language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"]). Case-insensitive; \"_\" is read as \"-\"; blank entries are dropped, and an empty list means [\"en\"]. A language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code."New value: +"Wikidata language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"]), up to 50. Case-insensitive; \"_\" is read as \"-\"; blank entries are dropped, and an empty list means [\"en\"]. A language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code."
    • addedInput schema / properties / languages / maxItems
      Added value: +50
    • addedOutput schema / properties / deferredIds
      Added value: +{
      +  "description": "Distinct IDs past the first 500, in input order, not looked up in this call — send them in another call. Absent when every ID fit.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `invalid_ids`: One or more IDs in the array are not valid Q-IDs or P-IDs. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_ids`: No entry in the array is a Q-ID or P-ID, bare or as an entity URI or wd: form. Other values are possible when a failure originates below the handler."
    • addedOutput schema / properties / invalid
      Added value: +{
      +  "description": "Entries that are not a Q-ID or P-ID in any accepted form, echoed as sent and never looked up. Absent when every entry is well-formed.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / notFound / description
      Previous value: -"IDs from the request that did not return data (not found or invalid)."New value: +"Well-formed IDs that were looked up and returned no entity (unassigned or out of range), each once."
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Present when IDs were deferred: how many resolved, and how many to send again from deferredIds.",
      +  "type": "string"
      +}
  3. Changed4 schema fields changed
    • changedInput schema / properties / languages / description
      Previous value: -"BCP 47 language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"]). A language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code."New value: +"Wikidata language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"]). Case-insensitive; \"_\" is read as \"-\"; blank entries are dropped, and an empty list means [\"en\"]. A language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code."
    • removedInput schema / properties / languages / items / minLength
      Removed value: -1
    • addedInput schema / properties / languages / items / pattern
      Added value: +"^\\s*(?:[A-Za-z]{2,8}(?:[-_][A-Za-z0-9]{1,9})*\\s*)?$"
    • removedInput schema / properties / languages / minItems
      Removed value: -1
  4. 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": [
      +      "entities",
      +      "found",
      +      "notFound",
      +      "languages"
      +    ]
      +  },
      +  {
      +    "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. Declared by this tool: `invalid_ids`: One or more IDs in the array are not valid Q-IDs or P-IDs. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "invalid_ids"
      +          ],
      +          "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: -[
      -  "entities",
      -  "found",
      -  "notFound",
      -  "languages"
      -]
  5. Changed1 schema field changed
    • changedInput schema / properties / languages / description
      Previous value: -"BCP 47 language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"])."New value: +"BCP 47 language codes for returned labels and descriptions (e.g., [\"en\", \"de\", \"fr\"]). A language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code."
  6. First observed

TDQS

A3.9/5.0
Behavior3/5

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

Annotations already declare readOnlyHint and openWorldHint, so safety is covered; the description nonetheless adds real behavioral detail: automatic batching, a 500-distinct-ID ceiling, deferredIds for the overflow, and tolerance of malformed entries. The remaining gap is per-entry failure semantics and whether unresolved-but-valid IDs are silently dropped or reported, which matters for a resolver.

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?

Three sentences, front-loaded with the purpose, then limits, then input formats in a logical order. The enumeration of accepted ID forms duplicates the ids schema description verbatim, so there is slight redundancy, but nothing is wasted overall.

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

Completeness4/5

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

An output schema exists, so return shape needn't be explained, and the description still flags the key output concept (deferredIds) plus the invalid-entry path. For a two-parameter read tool the coverage is close to complete, with only edge-case resolution outcomes left implicit.

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

Parameters3/5

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

Schema coverage is 100% and both parameters are fully documented in the schema, including accepted ID forms, the 500-distinct limit, invalid handling, and language fallback to "mul". The description restates the ID forms but adds nothing about the languages parameter, so baseline 3 is appropriate.

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?

States a specific verb and resource ("Resolve QIDs or PIDs to their human-readable labels and descriptions") and immediately scopes out claim data, which is exactly what separates it from wikidata_get_entity and wikidata_get_statements. It also names the producer of its inputs (wikidata_sparql_query), so an agent can place it in a pipeline without opening another schema.

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?

Gives a clear use context: humanizing raw IDs returned by wikidata_sparql_query, plus an explicit operational rule for over-limit calls (send deferredIds in a follow-up call). It stops short of naming an alternative for the case where claim data is actually wanted, leaving that inference to the sibling list.

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.