download_workflow_package_file
Download a workflow package file by its ID to a specified local directory using the AYX-MCP-Wrapper server.
Instructions
Download a workflow package file by its ID and save it to the local directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_directory | Yes | ||
| workflow_id | Yes |
Implementation Reference
- src/tools.py:740-770 (handler)The core handler function that downloads the workflow package using the Alteryx 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)MCP tool registration using @app.tool(), defining the tool interface with workflow_id and output_directory parameters, delegating to the tools instance method.@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)