Skip to main content
Glama

wiki_sparql

Read-only

Wikidata SPARQL query — Run a read-only SPARQL query (SELECT or ASK) against the Wikidata knowledge graph (100M+ items) and get clean JSON rows: entity URIs shortened to Q-ids, numbers and booleans typed. A LIMIT is added when missing (limit= 1-1000, default 100); compact=false keeps full URIs. Bad SPARQL returns 422 with the parser message (not charged). Wikidata data is CC0. For agents answering structured questions (largest countries, companies by founder, people by occupation, films by director) or building datasets. Price: $0.005 USDC (Base, via x402).

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": {
      "q": "<q>"
    },
    "name": "wiki_sparql"
  }
}

Input Schema

NameRequiredDescriptionDefault
qYesSELECT ?country ?countryLabel ?population WHERE { ?country wdt:P31 wd:Q6256; wdt:P1082 ?population. SERVICE wikibase:label { bd:serviceParam wikibase:language 'en'. } } ORDER BY DESC(?population) LIMIT 5

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnly/openWorld/non-destructive) by disclosing auto-added LIMIT behavior with its range and default, the compact flag semantics, error handling (422 with parser message, not charged), pricing ($0.005 USDC via x402), and license (CC0). These are exactly the operational facts an agent needs before spending money on a call.

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?

One dense paragraph, front-loaded with the verb and resource, then parameters, then errors, then price. Nearly every clause carries information, though the pricing and licensing tail makes it heavier than strictly necessary for tool selection.

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 no output schema, the description still describes the return value (JSON rows with Q-id-shortened URIs and typed numbers/booleans), the failure mode, and the cost. For a single-parameter query tool this covers everything needed to call it correctly.

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% and already contains a worked query example, so the schema carries most of the burden. The description adds meaning about what q should contain (SELECT or ASK, read-only) and expected result shape, but its mention of 'limit= 1-1000, default 100' and 'compact=false' names knobs that do not appear in the input schema, which can mislead an agent trying to set them.

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 — 'Run a read-only SPARQL query (SELECT or ASK) against the Wikidata knowledge graph' — and the scale (100M+ items). This is clearly distinct from sibling entity/article lookup tools, which an agent can tell apart without opening any 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 concrete when-to-use framing: 'For agents answering structured questions (largest countries, companies by founder, people by occupation, films by director) or building datasets.' No sibling is named as an explicit alternative and no when-not-to-use exclusion is given, which keeps it below a 5.

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.

Resources