On this page

query-context

Run a read-only Cypher query against this project's Wexa context graph. Queries must filter on project_id = $project_id (bound server-side). Write clauses are rejected. For CODE TEXT search (symbols, strings, file contents), use search-code then fetch-code — do NOT invent Cypher for that. query-context is for structural graph queries (callers, imports, ontology). For other large string properties (diffs, notes), prefer CALL db.index.fulltext.queryNodes('idx_codetext_fulltext', '\<terms\>') YIELD node, score over CONTAINS/regex.

What it is called on each surface

The wire name is query-context everywhere: it is what the Wexa MCP server advertises, the REST path is POST /v1/query-context, and each SDK exposes it under its own language's naming convention.

SurfaceName
Wexa MCP serverquery-context
REST APIPOST /v1/query-context
TypeScript SDKfabric.queryContext()
Python SDKfabric.query_context()

Arguments

1 of the 5 arguments is required. Omitting a required one is refused before the tool runs, at the validation stage, so it costs nothing and changes nothing.

ArgumentTypeRequiredNotes
explainbooleanOptionalReturn the query plan instead of rows
limitintegerOptionalMax rows (clamped to 1000)
parametersobjectOptionalQuery parameters
querystringRequiredRead-only Cypher; must filter on project_id = $project_id
timeout_msintegerOptionalQuery timeout (clamped to 30000)

project_id, projectID, organization_id and executed_by are not arguments you pass: the platform binds all four from the credential you authenticated with, and both SDKs refuse them before the request leaves your process — see server-bound arguments.

What it returns

The three surfaces wrap this differently, and code written against one will not read another correctly — see return shape.

A real response, captured from a live call to query-context:

rows came back populated and is shown as … here, because the real value runs to thousands of characters. Read it from your own call rather than from this page.

{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000167\",\"result\":{\"columns\":[\"n\"],\"row_count\":1,\"rows\":\"\\u2026\",\"stats\":{\"elapsed_ms\":240},\"truncated\":false}}"
    }
  ],
  "isError": false
}

Keeping the lifecycle_id is what lets you ask later why a call was allowed, refused or held.

Calling it

The same call on all four surfaces. Pick a tab once and every code block in the documentation follows it.

The ids in this example are real, and resolve against the project the documentation is written against. Swap them for your own. A value in angle brackets is one only you can supply, and the platform refuses a literal <...>.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "query-context",
    "arguments": {
      "query": "<query>"
    }
  }
}

Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its HTTP status second. query-context checks the fabric:query.read grant, and reaches the seven classes every tool reaches — listed under the common set. These are the ones specific to it:

ErrorStatusRaised when
ApprovalRequired202A policy held this call for a person to approve. The error carries the approval id; see below.

Governance

Every call to query-context runs through the same ten-stage lifecycle as every other Wexa tool: the credential is resolved to a scope, the fabric:query.read grant is checked, quota is drawn down, the arguments are validated, policy rules are evaluated, the call is executed, the result is shaped and redacted, and an audit record is written. The lifecycle_id in the response is the handle to that record.

query-context is marked consequential, which means it changes something rather than only reading. Two things follow. It is audited in full rather than lightly, and a policy rule may hold it for human approval — in which case the call returns 202 and an ApprovalRequired error carrying the approval id, and the SDKs can wait for the decision and resume rather than making you call again.

See also

The tool index and errors.