upload_file
Add files to LimeSurvey surveys by uploading content with a specified name to a designated survey ID.
Instructions
Upload a file to a LimeSurvey survey.
Args:
sid: The survey ID.
file_content: The file content (base64 encoded).
file_name: The file name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sid | Yes | ||
| file_content | Yes | ||
| file_name | Yes |
Implementation Reference
- main.py:669-680 (handler)The core handler function for the 'upload_file' MCP tool. Registered via @mcp.tool() decorator. It takes survey ID, base64-encoded file content, and filename, then uses a LimeSurvey client to perform the upload.@mcp.tool() def upload_file(sid: int, file_content: str, file_name: str) -> dict[str, Any]: """Upload a file to a LimeSurvey survey. Args: sid: The survey ID. file_content: The file content (base64 encoded). file_name: The file name. """ with get_client() as client: return client.upload_file(sid, file_content, file_name)
- main.py:669-669 (registration)The @mcp.tool() decorator registers the upload_file function as an MCP tool.@mcp.tool()
- main.py:670-677 (schema)Type hints and docstring define the input schema (sid: int, file_content: str, file_name: str) and output (dict[str, Any]).def upload_file(sid: int, file_content: str, file_name: str) -> dict[str, Any]: """Upload a file to a LimeSurvey survey. Args: sid: The survey ID. file_content: The file content (base64 encoded). file_name: The file name. """