copy_survey
Duplicate a LimeSurvey survey by specifying the source survey ID and assigning a new name for the copied survey. Simplifies survey replication for efficient management.
Instructions
Copy a LimeSurvey survey.
Args:
sid: The source survey ID.
new_name: The name for the new survey.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new_name | Yes | ||
| sid | Yes |
Implementation Reference
- main.py:379-389 (handler)The main handler function for the 'copy_survey' MCP tool. It takes survey ID and new name, uses a context-managed client from get_client(), and delegates to the citric library's Client.copy_survey method to perform the copy operation and return the new survey ID.@mcp.tool() def copy_survey(sid: int, new_name: str) -> int: """Copy a LimeSurvey survey. Args: sid: The source survey ID. new_name: The name for the new survey. """ with get_client() as client: return client.copy_survey(sid, new_name)
- main.py:15-20 (helper)Helper function that creates and returns a citric.Client instance configured with environment variables, used as a context manager by the copy_survey handler and other tools.def get_client() -> Client: return Client( url=os.getenv("LIMESURVEY_URL"), username=os.getenv("LIMESURVEY_USERNAME"), password=os.getenv("LIMESURVEY_PASSWORD"), )
- main.py:380-386 (schema)Input schema defined by type annotations (sid: int, new_name: str) and return type (int), along with docstring describing parameters.def copy_survey(sid: int, new_name: str) -> int: """Copy a LimeSurvey survey. Args: sid: The source survey ID. new_name: The name for the new survey. """
- main.py:379-379 (registration)The @mcp.tool() decorator registers the copy_survey function as an MCP tool.@mcp.tool()