download_workflow_package_file
Download workflow package files from Alteryx Server by specifying the workflow ID and output directory for local storage.
Instructions
Download a workflow package file by its ID and save it to the local directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_id | Yes | ||
| output_directory | Yes |
Implementation Reference
- src/tools.py:740-771 (handler)The core handler function in AYXMCPTools class that downloads the workflow package (.yxzp) from Alteryx server using the V3 API and saves it to the configured temp directory.
def download_workflow_package_file(self, workflow_id: str): """Download a workflow package file by its ID and save it to the local directory""" try: api_response = self.workflows_api.workflows_get_workflow(workflow_id) if api_response is None: return "Error: Workflow not found" # Download the workflow file api_response = self.workflows_api.workflows_download_workflow(workflow_id) if api_response is None: return "Error: Failed to download workflow" # Create the output directory if it doesn't exist temp_directory = self.configuration.temp_directory # normalize the temp directory temp_directory = os.path.normpath(temp_directory) if not os.path.exists(temp_directory): os.makedirs(temp_directory) # Save the workflow file to the output directory with open( f"{temp_directory}/{workflow_id}.yxzp", "wb" if not os.path.exists(f"{temp_directory}/{workflow_id}.yxzp") else "wb+", ) as f: f.write(api_response) return ( f"Workflow {workflow_id} downloaded successfully. File saved to '{temp_directory}/{workflow_id}.yxzp'" ) except ApiException as e: return f"Error: {e.body}" - src/mcp_server.py:182-185 (registration)The MCP tool registration using @self.app.tool() decorator, which wraps the underlying tools.py handler and delegates to it. Note: wrapper adds output_directory param not used in handler.
@self.app.tool() def download_workflow_package_file(workflow_id: str, output_directory: str): """Download a workflow package file by its ID and save it to the local directory""" return self.tools.download_workflow_package_file(workflow_id, output_directory)