Edit a model
editChange 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
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | The edits, in order. | |
| text | Yes | The 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. | |
| force | No | Keep an edit that adds errors (to fix them in a later edit). |