Skip to main content
Glama
pitchmuc

Knowledge Graph MCP Server

by pitchmuc

run_sparql_query

Read-only

Run read-only SPARQL SELECT or ASK queries against the CRM knowledge graph for custom joins, aggregations, and filters. Use when account/contact tools cannot answer.

Instructions

Run a read-only SPARQL SELECT or ASK query directly against the knowledge graph.

Use this for questions the higher-level account/contact tools can't answer, e.g. joins, aggregations, or custom filters. The graph uses the crm: prefix (http://example.org/crm#) for all classes and properties — call get_graph_schema() first to see available classes and properties.

Only SELECT and ASK queries are permitted; INSERT/DELETE/DROP/LOAD/CREATE are rejected. PREFIX crm: <http://example.org/crm#> is available automatically but may also be declared explicitly.

Args: query: The SPARQL query text, e.g. "SELECT ?name ?arrUsd WHERE { ?a a crm:Account ; crm:name ?name ; crm:arrUsd ?arrUsd . } ORDER BY DESC(?arrUsd) LIMIT 5"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint/destructiveHint, but the description adds substantive behavioral detail beyond them: only SELECT and ASK are permitted while INSERT/DELETE/DROP/LOAD/CREATE are rejected, and the crm: prefix is auto-injected but may be re-declared. This is exactly the extra context annotations cannot convey.

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?

Front-loaded purpose followed by usage routing, constraints, prefix rules, and an example — each block earns its place. The multi-line example is long but directly teaches the allowed query shape, so it is not waste.

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 values need not be explained; the description instead covers what matters for correct invocation — permitted query types, prefix handling, and the schema-discovery prerequisite. Nothing an agent needs 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 0% and the single parameter has no schema description, so the description must carry the burden — and it does, defining `query` as SPARQL text and supplying a concrete SELECT example with the crm: prefix. Only minor preconditions on parameter formatting remain unstated.

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 SELECT or ASK query directly against the knowledge graph'), and explicitly positions itself against the higher-level account/contact siblings. An agent can distinguish it from search_accounts or get_contact without opening 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?

Gives explicit when-to-use criteria ('questions the higher-level account/contact tools can't answer, e.g. joins, aggregations, or custom filters') and a prerequisite workflow step ('call get_graph_schema() first'). No inference required.

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