Skip to main content
Glama

Edit a model

edit
Idempotent

Change the model with structured edits and get the new text back. The text is patched in place (comments and layout survive) and compiled again; an edit that would add an error is refused with the errors, unless force is true. Output: { ok, message, errors, affected, select, text }.

Structured edits, applied in order. Each is an object with "op":

  • {"op":"add_feature","owner":T,"keyword":"part"|"port"|"attribute"|"item"|"state"|"requirement"|"constraint","name":N,"type"?:D,"value"?:"12 [kg]","multiplicity"?:"4","body"?:"members as SysML"}

  • {"op":"add_definition","keyword":"part def"|"port def"|"interface def"|...,"name":N,"owner"?:package,"specializes"?:D,"body"?:SysML}

  • {"op":"add_member","owner"?:T,"text":"any SysML declaration"}

  • {"op":"add_requirement","name":N,"id"?:"R-1","doc"?:"The system shall ...","subject":instancePath,"check"?:"sys.mass <= 20 [kg]"} (the subject part is called sys in the check)

  • {"op":"delete","target":T} (also removes connections, satisfy lines and transitions that only existed for it, and its terms in sums)

  • {"op":"rename","target":T,"name":N} (updates every reference)

  • {"op":"set_value","target":T,"value":"15 [kg]","local"?:true}

  • {"op":"set_type","target":T,"type":D}

  • {"op":"set_metadata","target":T,"metadata":"Placement","fields":{"xM":"1.5","yM":null}} (null removes a field)

  • {"op":"set_expression","target":T,"expr":"sys.mass <= 25 [kg]"}

  • {"op":"set_doc","target":T,"doc":"text"}, {"op":"set_short_name","target":T,"short_name":"R-2"}

  • {"op":"connect","from":instancePath,"to":instancePath,"type"?:interfaceOrConnectionDef,"name"?:N}

  • {"op":"add_transition","machine":stateDef,"from":S,"to":S,"trigger"?:"after 5 [s]","name"?:N}

  • {"op":"move","target":T,"owner"?:T,"before"?:T,"after"?:T} (moves the declaration, text and all, into owner or its own owner, before or after a sibling there or last; qualified references follow, and a type's users outside its new owner are rewritten to its new qualified name)

  • {"op":"duplicate","target":T,"owner"?:T,"name"?:N} (a copy right after the original, or last in owner; the name defaults to Copy)

  • {"op":"set_multiplicity","target":T,"multiplicity":"4"|"0..1"|"1..*"|""} (empty removes it)

  • {"op":"replace","target":T,"text":"a whole new declaration"} Targets (T) are instance paths as evaluate and query show them (airliner.leftEngine), qualified names (MidsizeAircraft::Engine), or a unique simple name.

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": {
      "text": "<text>",
      "ops": "<ops>"
    },
    "name": "edit"
  }
}

Input Schema

NameRequiredDescriptionDefault
opsYesThe edits, in order.
textYesThe complete SysML v2 model text. The server keeps no state: pass the whole current text on every call, and after an edit use the text the edit returned.
forceNoKeep an edit that adds errors (to fix them in a later edit).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Well beyond the annotations, it discloses that text is patched in place so comments and layout survive, that a failed edit returns the compiler errors, and that delete cascades into connections, satisfy lines, transitions, and sum terms. The stateless re-submission contract is also surfaced via the text parameter and reinforced by the description's framing.

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?

It is long, but the length is justified by roughly eighteen distinct op shapes, and it is front-loaded with purpose, error semantics, and output shape before the op catalog. The op list is dense but scannable; the one structural weakness is that similar ops are listed without a hint of when each is preferred.

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?

For a stateless, high-complexity mutation tool with no output schema, the description covers the return shape inline ({ ok, message, errors, affected, select, text }), the error/force tradeoff, cascading effects of destructive ops, and target addressing. Nothing an agent needs to construct a valid call 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 100%, so ops/text/force are already documented, but the schema leaves ops as untyped objects, making the description's per-op field breakdown the only real specification of edit syntax. Target resolution rules (instance path, qualified name, unique simple name) and the null-removes-a-field and empty-multiplicity-removes-it notes add genuine meaning; minor gap is no guidance on choosing add_feature vs add_member vs replace.

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?

The first sentence gives a specific verb and resource ("Change the model with structured edits and get the new text back") and the body enumerates the exact edit operations, immediately distinguishing it from read-only siblings like evaluate, query, and validate.

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?

It states the operational contract clearly: edits are applied in order, recompiled, and refused if they would introduce errors unless force is true, which tells the agent when to use force. It also points at evaluate and query for discovering valid targets (T). It stops short of an explicit "use validate instead when you only want to check" routing statement.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources