download_files
Retrieve survey files from LimeSurvey by specifying a survey ID and optional file ID. Use this tool to download specific files or all files associated with a survey.
Instructions
Download files from a LimeSurvey survey.
Args:
sid: The survey ID.
file_id: The file ID. If None, download all files.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | No | ||
| sid | Yes |
Implementation Reference
- main.py:682-692 (handler)The primary handler for the 'download_files' MCP tool. This function is decorated with @mcp.tool(), registering it as a tool, and implements the logic by calling the underlying LimeSurvey client's download_files method via a context-managed client instance.@mcp.tool() def download_files(sid: int, file_id: int = None) -> dict[str, Any]: """Download files from a LimeSurvey survey. Args: sid: The survey ID. file_id: The file ID. If None, download all files. """ with get_client() as client: return client.download_files(sid, file_id)
- main.py:682-682 (registration)The @mcp.tool() decorator registers the download_files function as an MCP tool in the FastMCP server.@mcp.tool()
- main.py:683-689 (schema)The function signature and docstring define the input schema (sid: int required, file_id: int optional) and output (dict[str, Any]), serving as the tool's schema for MCP.def download_files(sid: int, file_id: int = None) -> dict[str, Any]: """Download files from a LimeSurvey survey. Args: sid: The survey ID. file_id: The file ID. If None, download all files. """
- main.py:15-20 (helper)Helper function to create and return a context-managed LimeSurvey Client instance, used by the download_files handler.def get_client() -> Client: return Client( url=os.getenv("LIMESURVEY_URL"), username=os.getenv("LIMESURVEY_USERNAME"), password=os.getenv("LIMESURVEY_PASSWORD"), )