Skip to main content
Glama

Patch another module's object (XSLT)

xslt_patch
Destructive

Patch vanilla or mod objects by adding module XSLT rules that change attributes, nodes, or child XML without copying files. Preview before/after diffs; repeated calls merge.

Instructions

Changes an object owned by vanilla or another mod without copying it, by adding a rule to your module's XSLT (ModuleData/XSLT/_.xslt, registered automatically — the same mechanism the official DLC uses). One call per target node; repeated calls merge. Operations: set attributes, remove attributes, remove the node, replace it, append child XML, or clear the rule. Shows a before/after diff computed with the game's XSLT engine.

Input Schema

NameRequiredDescriptionDefault
setNoAttributes to set/add, e.g. {"weight": "1.5"}. Values are strings.
pathNoOptional nested element inside the target (mini XPath), e.g. ItemComponent/Weapon or skills/skill[@id='Bow'].
clearNoRemove this module's existing rule for the target instead.
forceNoOverwrite a hand-written rule with the same match.
moduleYesYour writable module.
removeNoDelete the target node entirely.
targetYesObject to patch: Item.x, NPCCharacter.x, Culture.empire, Settlement.town_EN1, Faction.clan_x, …
previewNoShow the before/after diff (default true).
game_typeNoGame type used for the preview (default Campaign).
append_xmlNoAppend this XML as child element(s) of the target node.
replace_xmlNoReplace the target node with this XML.
remove_attributesNoAttribute names to delete.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and readOnlyHint=false, and the description corroborates this by describing removal/clear operations. Beyond annotations it adds real context: the exact file written, automatic registration, that it uses the same mechanism as official DLC, and that repeated calls merge rather than overwrite. It stops short of stating permission/auth requirements or conflict-resolution rules.

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?

Four dense sentences, front-loaded with the core action and its mechanism before enumerating operations and the diff behavior. Nearly every clause earns its place, though the parenthetical about the official DLC is slightly ornamental.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter destructive mutation with no output schema, the description covers mechanism, target file, merge semantics, operation set, and the before/after diff. It omits prerequisites (writable module, permission to patch another mod's object) and conflict behavior, but the essentials for correct invocation are present.

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 schema documents all 12 parameters and the baseline is 3. The description still adds value by grouping the operations (set attributes, remove attributes, remove node, replace, append child XML, clear the rule), which conceptually maps to set/remove_attributes/remove/replace_xml/append_xml/clear, helping an agent understand the tool's modes.

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+resource: it 'changes an object owned by vanilla or another mod without copying it' by adding a rule to the module's XSLT. This clearly distinguishes it from copy-based siblings like clone_object/write_object, which operate on your own objects. The mechanism (ModuleData/XSLT/<mod>_<XmlId>.xslt) is named precisely.

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?

The phrase 'without copying it' implies the copy-then-edit alternative it replaces, giving clear usage context. It also clarifies the merge model ('one call per target node; repeated calls merge'). It does not, however, explicitly name siblings like write_object, set_attributes, or xslt_preview or state when to prefer them, so no hard exclusions are given.

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