Skip to main content
Glama

Get Wikidata Entity

wikidata_get_entity
Read-only

Fetch a Wikidata entity (item or property) by QID or PID. The fields parameter narrows the upstream fetch, not just the response — asking for labels alone costs a fraction of the whole entity, so name the fields you need. Omit fields for all data; a well-connected item is large enough to overflow, and an oversized entity returns kind: "outline" — the field categories with their byte sizes — instead of the data. Follow its retrieval_notice literally rather than picking from sections yourself — it names a fields set already measured to fit, since category sizes are additive and requesting them all would overflow again; for a category too large to deliver whole (statements or sitelinks on a major item) it names the sibling tool that can narrow it. Q-IDs (e.g. Q76) fetch items; P-IDs (e.g. P31) fetch properties from the correct endpoint automatically. Use wikidata_get_statements for deep claim traversal with label resolution, and whenever an entity's statements are large — its properties parameter selects individual P-IDs, granularity fields does not carry.

Input Schema

NameRequiredDescriptionDefault
idYesQ-ID (e.g., "Q76") or P-ID (e.g., "P31"). Case-insensitive — normalized to uppercase.
fieldsNoFields to include. Options: "labels", "descriptions", "aliases", "statements", "sitelinks". Narrows the upstream fetch as well as the response, so a narrow selection is markedly cheaper. Omit for all fields.
languagesNoWikidata language codes to include in labels, descriptions, and aliases (e.g., ["en", "de"]). Case-insensitive; "_" is read as "-"; blank entries are dropped. A requested language with no label of its own falls back to the entity's multilingual ("mul") value, returned under the requested code. Omit, or send an empty list, to return all available languages.

Output Schema

NameRequiredDescriptionDefault
idNoNormalized entity ID (e.g., "Q76" or "P31").
kindNofull — the requested field categories carry their data. outline — the entity overflowed the inline byte budget, so sections lists the categories with their byte sizes instead, and retrieval_notice names how to fetch each one. The id and type are present either way.
typeNoEntity type: "item" or "property".
errorNoPresent when the call failed. Absent on success.
labelsNoMap of language code to label string (e.g., {"en": "Barack Obama", "de": "Barack Obama"}).
aliasesNoMap of language code to list of alias strings (e.g., {"en": ["Barack H. Obama", "President Obama"]}).
sectionsNoPresent when kind = outline: the entity's field categories, largest first, each with its byte size. Sizes are additive — a set of categories is only retrievable together if their total fits the budget, so follow retrieval_notice rather than requesting every name listed here.
data_typeNoProperty data type (e.g., "wikibase-item", "external-id"). Present on properties only.
sitelinksNoMap of site code (e.g., "enwiki") to sitelink metadata with title, url, and badges fields.
statementsNoMap of property ID to array of raw statement objects. Use wikidata_get_statements for resolved claims with label resolution, and whenever this entity's statements are large — its properties parameter selects individual P-IDs, granularity fields does not carry.
descriptionsNoMap of language code to description string (e.g., {"en": "44th President of the United States"}).
fieldsReturnedNoWhich fields were requested. In outline mode these are the categories the outline covers, not data returned.
retrieval_noticeNoPresent when kind = outline: the next call to make, and the authoritative one to follow. It names a literal fields set already measured to fit the budget, defers any category that would not fit alongside it, and for a category too large for fields to deliver at all names the sibling tool (wikidata_get_statements, wikidata_get_sitelinks) or the languages parameter that can narrow it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / languages / description
      Previous value: -"Language codes to include in labels, descriptions, and aliases (e.g., [\"en\", \"de\"]). A requested language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code. Omit to return all available languages."New value: +"Wikidata language codes to include in labels, descriptions, and aliases (e.g., [\"en\", \"de\"]). Case-insensitive; \"_\" is read as \"-\"; blank entries are dropped. A requested language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code. Omit, or send an empty list, to return all available languages."
    • addedInput schema / properties / languages / items / pattern
      Added value: +"^\\s*(?:[A-Za-z]{2,8}(?:[-_][A-Za-z0-9]{1,9})*\\s*)?$"
  2. 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": [
      +      "id",
      +      "type",
      +      "kind",
      +      "fieldsReturned"
      +    ]
      +  },
      +  {
      +    "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: `entity_not_found`: No entity exists at this ID — either unassigned (resource-not-found) or out of range (invalid-path-parameter). `invalid_id`: ID format is not recognized as a Q-ID or P-ID. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "entity_not_found",
      +            "invalid_id"
      +          ],
      +          "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: -[
      -  "id",
      -  "type",
      -  "kind",
      -  "fieldsReturned"
      -]
  3. Changed7 schema fields changed
    • changedInput schema / properties / fields / description
      Previous value: -"Fields to include in the response. Options: \"labels\", \"descriptions\", \"aliases\", \"statements\", \"sitelinks\". Omit for all fields."New value: +"Fields to include. Options: \"labels\", \"descriptions\", \"aliases\", \"statements\", \"sitelinks\". Narrows the upstream fetch as well as the response, so a narrow selection is markedly cheaper. Omit for all fields."
    • changedOutput schema / properties / fieldsReturned / description
      Previous value: -"Which fields are included in this response."New value: +"Which fields were requested. In outline mode these are the categories the outline covers, not data returned."
    • addedOutput schema / properties / kind
      Added value: +{
      +  "description": "full — the requested field categories carry their data. outline — the entity overflowed the inline byte budget, so sections lists the categories with their byte sizes instead, and retrieval_notice names how to fetch each one. The id and type are present either way.",
      +  "enum": [
      +    "full",
      +    "outline"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / retrieval_notice
      Added value: +{
      +  "description": "Present when kind = outline: the next call to make, and the authoritative one to follow. It names a literal fields set already measured to fit the budget, defers any category that would not fit alongside it, and for a category too large for fields to deliver at all names the sibling tool (wikidata_get_statements, wikidata_get_sitelinks) or the languages parameter that can narrow it.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / sections
      Added value: +{
      +  "description": "Present when kind = outline: the entity's field categories, largest first, each with its byte size. Sizes are additive — a set of categories is only retrievable together if their total fits the budget, so follow retrieval_notice rather than requesting every name listed here.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "An available field category — its name and the serialized byte size of its data.",
      +    "properties": {
      +      "bytes": {
      +        "description": "Serialized byte size of the section",
      +        "maximum": 9007199254740991,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "name": {
      +        "description": "Section identifier — pass in `sections` to retrieve it",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "bytes"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / statements / description
      Previous value: -"Map of property ID to array of raw statement objects. Use wikidata_get_statements for resolved claims with label resolution."New value: +"Map of property ID to array of raw statement objects. Use wikidata_get_statements for resolved claims with label resolution, and whenever this entity's statements are large — its properties parameter selects individual P-IDs, granularity fields does not carry."
    • changedOutput schema / required
      Previous value: -[
      -  "id",
      -  "type",
      -  "fieldsReturned"
      -]New value: +[
      +  "id",
      +  "type",
      +  "kind",
      +  "fieldsReturned"
      +]
  4. Changed1 schema field changed
    • changedInput schema / properties / languages / description
      Previous value: -"Language codes to include in labels, descriptions, and aliases (e.g., [\"en\", \"de\"]). Omit to return all available languages."New value: +"Language codes to include in labels, descriptions, and aliases (e.g., [\"en\", \"de\"]). A requested language with no label of its own falls back to the entity's multilingual (\"mul\") value, returned under the requested code. Omit to return all available languages."
  5. First observed

TDQS

A4.8/5.0
Behavior5/5

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

With readOnlyHint/openWorldHint already covering the safety profile, the description adds substantial behavioral context the annotations cannot: the fields parameter reduces upstream cost, oversized entities return kind: "outline" with byte sizes rather than data, and the retrieval_notice must be followed literally because category sizes are additive. This is exactly the kind of non-obvious failure mode an agent needs disclosed.

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?

Purpose is front-loaded and the paragraph is information-dense rather than padded. The retrieval_notice sentences are somewhat convoluted ('since category sizes are additive and requesting them all would overflow again'), but no sentence is pure 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?

An output schema exists, so return formatting is not the description's burden, yet it still explains the one return shape an agent must recognize (the outline fallback). Cost model, failure mode, recovery path, and sibling routing are all present — nothing needed to call this correctly is missing.

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 genuinely adds semantics: 'fields' narrows the upstream fetch and not just the response, omitting it risks overflow, and Q-ID vs P-ID selects the correct endpoint automatically. The 'languages' parameter is left to the schema, which is the only real gap.

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 concrete verb and resource ('Fetch a Wikidata entity (item or property) by QID or PID') and immediately scopes the Q-ID/P-ID distinction. It also names the sibling it is not for deep claim work, so an agent can separate it from wikidata_get_statements without reading either schema.

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

Usage Guidelines5/5

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

Explicit routing: use wikidata_get_statements 'for deep claim traversal with label resolution, and whenever an entity's statements are large', with the reason (its properties parameter selects individual P-IDs, granularity fields does not carry). It also gives when-to-narrow guidance ('name the fields you need') and when to omit fields.

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.