On this page

save-context

Save nodes and relationships into this project's context graph (Simple/auto mode). The ontology self-organizes: new labels/relationship types are registered automatically. Nodes: [{label,key,properties}]; relationships: [{type,from:{label,key,value},to:{label,key,value},properties}]. Relationship properties ARE persisted. Scalars store as-is; arrays AND nested objects are stored JSON-encoded (so they read back as a string, not a list); a null value is not stored at all. Property names may not start with _ (reserved for graph metadata). Round-trip: a node returned by query-context can be passed straight back here. The server owns project_id, row_pk, updated_at and wx_source and rewrites all four on every write, so leaving them in the payload is harmless — wx_source is dropped rather than stored, and setting it to anything other than "save-context" is refused because delete-context trusts it.

What it is called on each surface

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

SurfaceName
Wexa MCP serversave-context
REST APIPOST /v1/save-context
TypeScript SDKfabric.saveContext()
Python SDKfabric.save_context()

Arguments

Every argument is optional: save-context answers a bare call.

ArgumentTypeRequiredNotes
nodesarrayOptional[{label, key (merge-key property name), properties{}}]
relationshipsarrayOptional[{type, from:{label,key,value}, to:{label,key,value}, properties{}}]

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 save-context:

{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000168\",\"result\":{\"nodes_merged\":1,\"relationships_merged\":0,\"ontology_extended\":true,\"new_labels\":[\"FixtureCustomer\"],\"success\":true}}"
    }
  ],
  "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: they resolve against the project the documentation is written against, so the call runs as written once you point it at your own deployment. Swap them for the ids of your own objects.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "save-context",
    "arguments": {
      "nodes": []
    }
  }
}

Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its HTTP status second. save-context checks the fabric:ontology.write 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 save-context runs through the same ten-stage lifecycle as every other Wexa tool: the credential is resolved to a scope, the fabric:ontology.write 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.

save-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.