Skip to main content
Glama

query_sparql

Run read-only SPARQL SELECT or ASK queries against a local Wikidata endpoint with automatic prefixes, row limits, and optional label hydration.

Instructions

Execute an arbitrary read-only SPARQL SELECT or ASK query against the local QLever Wikidata endpoint. Auto-declares standard prefixes (wd:, wdt:, rdfs:, xsd:) and enforces query limits.

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": "query_sparql"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum rows to return (clamped between 1 and 500, default: 100).
queryYesRead-only SPARQL query (SELECT or ASK).
hydrate_labelsNoWhether to automatically resolve entity QID and property PID labels in results (default: true).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations supplied, the description carries the burden and does meaningful work: it declares the operation read-only, states that standard prefixes (wd:, wdt:, rdfs:, xsd:) are auto-declared, and warns that query limits are enforced. It stops short of saying what happens on non-SELECT/ASK input, timeouts, or errors, which for an arbitrary-query tool is a real but secondary gap.

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

Conciseness5/5

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

Two sentences, zero filler, with the operation and its read-only constraint front-loaded. Every clause conveys something operationally relevant.

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

Completeness3/5

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

There is no output schema, so the description is the only place an agent could learn what comes back — result format (bindings/rows), error shape, and how ASK differs from SELECT in the response are all unstated. Combined with no annotations, this leaves a moderate gap for a tool whose whole purpose is producing query results.

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%, so parameter documentation is already handled and a 3 is the baseline. The description adds one genuinely useful fact beyond the schema — prefixes are auto-injected, so the agent need not write PREFIX lines — but 'enforces query limits' is vague about whether that refers to the row limit parameter, a timeout, or a server-side cap.

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

Purpose4/5

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

States a specific verb and resource: execute an arbitrary read-only SPARQL SELECT or ASK query against a named endpoint (local QLever Wikidata). The scope (read-only, SELECT/ASK only) is precise enough to distinguish it from the structured siblings, but the description never explicitly contrasts itself with helpers like get_entity_triples.

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

Usage Guidelines3/5

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

Usage is only implied: the word 'arbitrary' and the query-language framing suggest reaching for this when the convenience tools (get_entity_triples, find_cross_links) can't express the question. There is no explicit when-to-use statement, no exclusion of alternatives, and no note on prerequisites such as endpoint availability.

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