Skip to main content
Glama

Replace a question with a .lsq file

limesurvey_replace_question
Destructive

Replace one main question of an INACTIVE survey by the question in a .lsq file, in the same group and at the same position, using only official RemoteControl methods.

Instructions

Replace one main question of an INACTIVE survey by the question in a .lsq file, in the same group and at the same position, using only official RemoteControl methods. This is how question attributes, answer options and subquestions are changed, because set_question_properties cannot write them. Steps: check that the survey is inactive (get_survey_properties); read the old question (get_question_properties; it must belong to survey_id and have parent_qid 0); read the group (list_questions); parse the file; if the file has the same code, give the old question a temporary code (set_question_properties); import_question (the new question goes to the end of the group; its mandatory flag is taken from the file because import_question always overwrites it); set_question_properties question_order to the old position; read the old question back and delete_question exactly that question; verify the result. The code, type, texts, attributes, answer options and subquestions come from the file (new_question_title is not offered). Any failure after the first write is rolled back (the question this call imported is deleted, the old code is restored); the error says which step failed and, if a rollback step failed too, lists manual_cleanup. The only question that can be deleted is question_id. Requires confirm_destructive_action=true and the write scope content. Question IDs change; references by code (relevance expressions) keep working; legacy conditions that reference the old question ID are not migrated, and delete_question refuses a question that other questions depend on through legacy conditions (the replacement is then rolled back). Exactly one of import_data (small base64 payload) or import_data_path (file inside LIMESURVEY_IMPORT_DIR) must be set.

Input Schema

NameRequiredDescriptionDefault
survey_idYesNumeric LimeSurvey survey ID.
import_dataNoBase64-encoded .lsq file contents for small files; omit when using import_data_path.
question_idYesID of the main question to replace; it must belong to survey_id.
import_data_pathNoPath of the .lsq file inside LIMESURVEY_IMPORT_DIR (or LIMESURVEY_EXPORT_DIR as a fallback).
import_data_typeNoImport type; only lsq.lsq
confirm_destructive_actionYesRequired acknowledgement that the old question is deleted permanently.

Output Schema

NameRequiredDescriptionDefault
resultYes
workflowYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.6.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive/non-idempotent/openWorld, but the description goes far beyond them: it documents rollback semantics ('Any failure after the first write is rolled back'), the manual_cleanup error field, that question IDs change while code references keep working, that legacy conditions are not migrated, and that delete_question refuses dependencies. This is unusually thorough behavioral disclosure.

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?

Front-loaded with purpose, then side effects, then constraints. The 'Steps:' enumeration of internal implementation (temporary code, import to end, reorder) is arguably more than an agent needs to invoke the tool, making it dense, but nearly every sentence carries decision-relevant information.

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 destructive, multi-step replace operation with a rollback path, the description covers preconditions, alternatives, side effects, failure modes, and parameter constraints; with an output schema present, return values need not be restated. Nothing needed to call it correctly 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. The description adds genuine meaning the schema lacks: the mutual exclusivity rule ('Exactly one of import_data or import_data_path must be set'), that new_question_title is deliberately not offered, that question_id must have parent_qid 0 and is the only deletable question. Only the trivial import_data_type/confirm nuances are left to the 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 precise verb+resource+scope: 'Replace one main question of an INACTIVE survey by the question in a .lsq file, in the same group and at the same position'. It also names what it is not — distinguishing itself from set_question_properties and import_question, both of which are siblings.

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?

Explicitly states when to reach for this tool and why: 'This is how question attributes, answer options and subquestions are changed, because set_question_properties cannot write them.' It also states the precondition (survey must be inactive) and the required confirm/write-scope, leaving no routing ambiguity.

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

Deploy Server

Other Tools