Skip to main content
Glama
orjahren

Nettskjema MCP Server

by orjahren

update_form_element

Destructive

Update a single form element by ID, merging changes shallowly. Since the API lacks single-element updates, it rewrites the entire element list, risking overwrites if others edit concurrently.

Instructions

Change one element, by rewriting the form's ENTIRE element list.

The API has no single-element update, so this tool reads every element, applies changes to the one whose elementId matches, and writes all of them back through the same whole-list PUT that replace_form_elements uses. The other elements are sent back exactly as they were read — but they are sent, so an edit someone else makes between the read and the write is silently overwritten. The operation is NOT atomic, and the endpoint offers no version field, ETag or conditional header that would detect the conflict.

changes is merged shallowly, one level deep: each key replaces that key's value on the element outright. Nested lists are NOT merged item by item — passing answerOptions replaces the element's whole answer-option list, so to edit one option you must send all of them, each keeping its answerOptionId, in the order you want. The same goes for subElements and validationScripts. Fetch the element with get_form_elements first if you do not already have them.

If no element in the form has the given element_id, nothing is written: a PUT of the unchanged list would report success while changing nothing. For the same reason changes may not be empty, and may not carry elementId — changing an element's own id does not move the edit to another element, it asks the API to replace this one with a different element.

Input Schema

NameRequiredDescriptionDefault
changesYesThe fields to set on that element, as a partial element object. Must not be empty and must not contain elementId. Field types, enums and ranges are checked against the vendored ElementDTO schema before anything is read or written; a field the schema does not declare is passed through to the API, which has the final say.
form_idYesThe form's numeric ID.
element_idYesThe elementId of the element to change. It must already exist in the form; this tool cannot create one.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With only destructiveHint=true available, the description carries the rest: it discloses that the operation is NOT atomic, that concurrent edits are silently overwritten, that no version/ETag/conditional header exists to detect conflicts, and that `changes` merges only one level deep (whole answerOptions/subElements/validationScripts lists are replaced). This is exactly the beyond-annotations context an agent needs.

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?

The key scoping insight is front-loaded in the first sentence, and the remaining paragraphs each carry a distinct, non-redundant warning (atomicity, merge depth, no-op behavior). It is long, but nearly every sentence earns its place; density is the trade-off for a genuinely subtle tool.

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 mutation tool with an output schema, all the dangerous, non-obvious behavior — read-modify-write mechanics, race conditions, shallow merge, list-replacement, and no-op cases — is covered. Nothing an agent needs to invoke it safely 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 the baseline is 3, and the description goes further by explaining the shallow one-level merge semantics, the empty-changes prohibition, and why elementId must not appear in `changes`. Field-type validation against the vendored ElementDTO is mentioned too, adding meaning beyond the raw schema.

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 ('Change one element') and immediately explains the non-obvious mechanism (rewriting the form's entire element list). It distinguishes itself from replace_form_elements (same whole-list PUT) and get_form_elements (the read prerequisite), so an agent can tell the three apart without opening a schema.

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

Usage Guidelines5/5

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

Gives explicit prerequisites ('Fetch the element with get_form_elements first'), names the sibling that shares the write path (replace_form_elements), and states the failure/no-op conditions (unknown elementId → nothing written; empty or elementId-bearing changes rejected). When-to-use versus the alternative is clear.

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