add_workflow_to_collection
Associate a workflow with a specific collection using its ID. Ideal for organizing and managing workflows within Alteryx Server via the AYX-MCP-Wrapper.
Instructions
Add a workflow to a collection by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | Yes | ||
| workflow_id | Yes |
Implementation Reference
- src/tools.py:83-96 (handler)Core implementation of the add_workflow_to_collection tool. Validates the existence of the collection and workflow, creates an AddWorkflowContract, calls the collections API to add the workflow, and returns the formatted API response or error.def add_workflow_to_collection(self, collection_id: str, workflow_id: str): """Add a workflow to a collection by its ID""" try: collection = self.collections_api.collections_get_collection(collection_id) if not collection: return "Error: Collection not found" workflow = self.workflows_api.workflows_get_workflow(workflow_id) if not workflow: return "Error: Workflow not found" contract = server_client.AddWorkflowContract(workflow_id=workflow_id) api_response = self.collections_api.collections_add_workflow_to_collection(collection_id, contract) return pprint.pformat(api_response) except ApiException as e: return f"Error: {e}"
- src/mcp_server.py:146-149 (registration)MCP tool registration using @self.app.tool() decorator. This wrapper function delegates the execution to the AlteryxTools instance's add_workflow_to_collection method.@self.app.tool() def add_workflow_to_collection(collection_id: str, workflow_id: str): """Add a workflow to a collection by its ID""" return self.tools.add_workflow_to_collection(collection_id, workflow_id)
- src/mcp_server.py:146-149 (handler)MCP handler function for the tool, decorated and registered, which calls the core implementation in tools.py.@self.app.tool() def add_workflow_to_collection(collection_id: str, workflow_id: str): """Add a workflow to a collection by its ID""" return self.tools.add_workflow_to_collection(collection_id, workflow_id)