add_workflow_to_collection
Add a workflow to an Alteryx collection using workflow and collection IDs to organize and manage analytics processes.
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 handler implementation that checks if collection and workflow exist, creates an AddWorkflowContract, calls the Alteryx API to add the workflow to the collection, and formats the response.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 call to the underlying tools.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)