Semogram Docs
MCPTools reference

sparql_query

Run a read-only SPARQL query (SELECT, ASK, CONSTRUCT or DESCRIBE) over the project ontology dataset. Requires Consumer SPARQL access to be enabled. Denied and masked terms are excluded. SPARQL Update is not available over MCP.

When to use it

Use sparql_query to run a SPARQL query. On the workspace endpoint, pass projectId from project_list. On a project-scoped endpoint, the project is already bound: omit that argument and use the schema discovered from that endpoint.

Plugin requirements

Plugin requirements depend on the read route. Reads routed through a data endpoint use its installed connector or fact-store capability; they require a configured installation supporting that operation. This does not make every ontology read plugin-dependent. Use the plugin setup guides for configuration. Inspect the workspace’s plugin installations and check the installation before executing it.

Consumer SPARQL access must be enabled. Only read queries are supported. The query is limited to 1 MB in UTF-8 bytes. Delegated execution also requires dataEndpointId; policies and masking still apply.

Arguments

NameTypeRequiredDefaultConstraints
ontologyPackageIdstringYes—Format: uuid; Pattern constraint; see full schema
querystringYes—Minimum length: 1
inferencestringNo—Must equal "rdfs-owl-relations-v1"
executionstringNo"bounded"Allowed: "bounded", "delegated"
dataEndpointIdstringNo—Format: uuid; Pattern constraint; see full schema
projectIdstringYes—Format: uuid; Pattern constraint; see full schema

View the complete input schema, including nested contracts and alternative shapes. The schema is extracted from the workspace server’s Zod definitions. Runtime validation also enforces custom checks that JSON Schema cannot express.

Response shape

The implementation constructs payloads using these fields: type, result, execution, sourceSnapshots. The returned fields depend on the execution path.

MCP returns a text block containing the JSON operation result and a structuredContent copy. The envelope includes data, completeness, truncated, freshness, and warnings. Depending on the operation it can also include nextCursor, evidence, job, or receipt.

Check those fields before treating a conversational summary as the result. When a job is returned, inspect its status with the appropriate execution tool; a queued response is not confirmation that work finished. Follow evidence links when checking the underlying records.

Input methods

This request illustrates the argument structure. Replace every angle-bracket placeholder with a real value and supply any applicable optional fields from the schema. Nested business contracts must match your actual configuration. Send it through an authenticated, initialized MCP client; this JSON alone does not establish a session or sign you in.

Use Semogram’s sparql_query tool to run a SPARQL query. Confirm the workspace and use records I can access. Do not change anything.

Choose the project explicitly before making this request. Use real resource IDs returned by earlier reads; a resource name is not a UUID. Do not fill missing business inputs with invented values.

This is an MCP tools/call request, not a form to paste into Semogram. Send it through an authenticated, initialized MCP client.

MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "sparql_query",
    "arguments": {
      "ontologyPackageId": "<ONTOLOGY_PACKAGE_ID_UUID>",
      "query": "<QUERY>",
      "projectId": "<PROJECT_ID_UUID>"
    }
  }
}

FAQ

What access and approvals are required?

Required permission scopes: sparql:query. OAuth uses current workspace membership; API keys use their assigned scopes and grants. Discovery can exclude tools the caller cannot use.

Read-only annotation: Yes. Destructive annotation: No. Follow the operation’s declared contract and any applicable server-side approval policy.

How should I handle retries?

Do not assume repeated calls are safe merely because the client offers Retry. Inspect the result or existing request before repeating work that changes state. For 429 responses, honor Retry-After rather than retrying immediately.

Why is this tool missing or returning an error?

Consumer SPARQL access must be enabled. Only read queries are supported. The query is limited to 1 MB in UTF-8 bytes. Delegated execution also requires dataEndpointId; policies and masking still apply. See connection, authentication and troubleshooting for sign-in, scope, resource access, and rate-limit errors.