Skip to main content
Glama

lsp-preview_mutation

Preview an in-memory SDK mutation of an ExerisDomain source file and get a unified diff with outcome details before applying changes yourself.

Instructions

Preview how the SDK's canonical writer would change an @ExerisDomain source file for one mutation, applied in memory. Returns { result, sourcePath, diff }: a unified diff and the SDK outcome in result.outcome — SUCCESS, CONFLICT (the source drifted from the baseline; the result carries baseline, current and intended values), VALIDATION_ERROR, or NO_BASELINE. Nothing is written: apply the diff with your own file tools. For a stale-free preview, pass the entity's last-emitted metadata as baselineJson and the sourceDigest from lsp-describe_domain as concurrencyToken.

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": {
      "qualifiedName": "<qualifiedName>",
      "op": "<op>"
    },
    "name": "lsp-preview_mutation"
  }
}

Input Schema

NameRequiredDescriptionDefault
opYesOne SDK MutationOp, discriminated by `op`: addField, removeField, renameField, changeFieldType, addRelationship, removeRelationship, changeRelationshipCardinality, addAction, removeAction. Every op carries a `path`, e.g. {"op":"renameField","path":"/entities/Order/fields/total","newName":"amount"}.
baselineJsonNoThe entity's last-emitted `target/classes/exeris-metadata/<entity>.json` (see `build-get_domain_metadata`), as a string. The base of the three-way drift check.
qualifiedNameYesFully-qualified Java class name of the target domain.
concurrencyTokenNoThe `sourceDigest` returned by `lsp-describe_domain` for this domain.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.9.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it declares the tool is non-mutating ('Nothing is written'), in-memory, and enumerates all four outcomes including CONFLICT with an explanation of the drift condition and what the result carries (baseline, current, intended values). That is exactly the side-effect and failure-mode disclosure an agent needs before calling a mutation-shaped tool.

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?

Front-loaded with the purpose and the no-write guarantee before the outcome enumeration and the optional staleness recipe. Three sentences, each carrying distinct information (what, what returns, how to avoid false conflicts) with no restatement of the schema.

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?

Despite having no output schema, the description documents the return shape and the outcome vocabulary, so an agent knows how to interpret results. Combined with the drift-check explanation for a 9-variant nested mutation op, nothing material is missing for correct invocation.

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 100%, so the baseline is 3, but the description adds real meaning: it identifies baselineJson as the base of a three-way drift check and pins concurrencyToken to the sourceDigest emitted by lsp-describe_domain, linking the two tools. The nested `op` discriminator is left entirely to the schema, which is acceptable given its coverage.

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 (preview) and resource (one mutation against an @ExerisDomain source file), plus the crucial qualifier 'applied in memory' that separates it from an actual write path. An agent can distinguish it from build-preview_generation or the lsp-list_* siblings without opening any schema.

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

Usage Guidelines4/5

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

Explicitly frames the workflow: this produces a diff, and 'apply the diff with your own file tools' tells the agent what to do next rather than expecting the tool to write. It also gives the precise recipe for a stale-free call (baselineJson plus sourceDigest from lsp-describe_domain). It stops short of naming when NOT to use it or an alternative for non-preview edits.

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