create_collection
Generate new collections on the AYX-MCP-Wrapper server by specifying a unique name, enabling organized management of workflows and resources in Alteryx environments.
Instructions
Create a new collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools.py:49-56 (handler)The core handler implementation for the 'create_collection' tool. It constructs a CreateCollectionContract with the provided name and invokes the Alteryx Server API's collections_create_collection method to create the collection, handling errors appropriately.def create_collection(self, name: str): """Create a new collection. To add a collection to a user, use the update_collection_name_or_owner function.""" try: contract = server_client.CreateCollectionContract(name=name) api_response = self.collections_api.collections_create_collection(contract) return pprint.pformat(api_response) except ApiException as e: return f"Error: {e}"
- src/mcp_server.py:131-134 (registration)MCP tool registration using FastMCP's @app.tool() decorator. This thin wrapper delegates execution to the AYXMCPTools instance's create_collection method.@self.app.tool() def create_collection(name: str): """Create a new collection""" return self.tools.create_collection(name)
- Pydantic/Swagger-generated schema/model for CreateCollectionContract, defining the input structure (name: str) used by the Alteryx API client to create collections.class CreateCollectionContract(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = {"name": "str"} attribute_map = {"name": "name"} def __init__(self, name=None, _configuration=None): # noqa: E501 """CreateCollectionContract - a model defined in Swagger""" # noqa: E501 if _configuration is None: _configuration = Configuration() self._configuration = _configuration self._name = None self.discriminator = None self.name = name @property def name(self): """Gets the name of this CreateCollectionContract. # noqa: E501 The name of the new collection. # noqa: E501 :return: The name of this CreateCollectionContract. # noqa: E501 :rtype: str """ return self._name @name.setter def name(self, name): """Sets the name of this CreateCollectionContract. The name of the new collection. # noqa: E501 :param name: The name of this CreateCollectionContract. # noqa: E501 :type: str """ if self._configuration.client_side_validation and name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name