get_workflow_xml
Retrieve the XML representation of a specific workflow using its unique ID. Enables users to access and manage workflow configurations through the AYX-MCP-Wrapper server.
Instructions
Get the XML representation of a workflow file by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_id | Yes |
Implementation Reference
- src/tools.py:772-816 (handler)Core handler implementation: Downloads the workflow as a .yxzp package using the workflows_api, extracts the zip file to a temporary directory, locates the primary .yxmd or .yxwz XML file, and returns the full path to it.def get_workflow_xml(self, workflow_id: str): """Get the XML representation of a workflow file by its ID""" 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) with open( f"{temp_directory}/{workflow_id}.yxzp", "wb" if not os.path.exists(f"{temp_directory}/{workflow_id}.yxz") else "wb+", ) as f: f.write(api_response) new_directory = f"{temp_directory}/{workflow_id}" if os.path.exists(new_directory): shutil.rmtree(new_directory) os.makedirs(new_directory) with zipfile.ZipFile(f"{temp_directory}/{workflow_id}.yxzp", "r") as zip_ref: zip_ref.extractall(new_directory) yxmd_files = [file for file in os.listdir(new_directory) if file.endswith(".yxmd") or file.endswith(".yxwz")] if len(yxmd_files) == 0: return "Error: No Workflow or Analytics App XML file found after unzipping the downloaded workflow package file" yxmd_file = yxmd_files[0] # Return the path to the XML file return f"Workflow XML file saved to: {new_directory}/{yxmd_file}" except ApiException as e: return f"Error: {e}"
- src/mcp_server.py:187-190 (registration)MCP tool registration using @app.tool decorator. This wrapper function delegates the call to the underlying tools.get_workflow_xml method.@self.app.tool() def get_workflow_xml(workflow_id: str): """Get the XML representation of a workflow file by its ID""" return self.tools.get_workflow_xml(workflow_id)
- src/mcp_server.py:58-58 (registration)Tool description in the system prompt for the MCP server, listing 'get_workflow_xml' as available.- get_workflow_xml: Get workflow XML