Skip to main content
Glama
jupiterbak

AYX-MCP-Wrapper

by jupiterbak

get_workflow_xml

Retrieve the XML representation of a workflow file using its unique identifier to access and analyze workflow structure and configuration.

Instructions

Get the XML representation of a workflow file by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_idYes

Implementation Reference

  • The core handler function for the 'get_workflow_xml' tool. It retrieves a workflow by ID, downloads its package, extracts the ZIP, identifies the primary XML file (.yxmd or .yxwz), and returns the local file path.
    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}"
  • MCP tool registration using @app.tool() decorator. This wrapper function delegates execution to the underlying tools instance's 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jupiterbak/AYX-MCP-Wrapper'

If you have feedback or need assistance with the MCP directory API, please join our Discord server