Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

create_azure_source

Create an Azure source connector to access and integrate Azure Storage data, enabling recursive access to subfolders and specifying remote URLs for efficient data handling.

Instructions

Create an Azure source connector.

Args: name: A unique name for this connector remote_url: The Azure Storage remote URL, with the format az://<container-name>/<path/to/file/or/folder/in/container/as/needed> recursive: Whether to access subfolders within the bucket Returns: String containing the created source connector information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
recursiveNo
remote_urlYes

Implementation Reference

  • The main handler function that implements the creation of an Azure source connector using the Unstructured API client. It prepares the config and calls the create_source endpoint.
    async def create_azure_source( ctx: Context, name: str, remote_url: str, recursive: bool = False, ) -> str: """Create an Azure source connector. Args: name: A unique name for this connector remote_url: The Azure Storage remote URL, with the format az://<container-name>/<path/to/file/or/folder/in/container/as/needed> recursive: Whether to access subfolders within the bucket Returns: String containing the created source connector information """ client = ctx.request_context.lifespan_context.client config = _prepare_azure_source_config(remote_url, recursive) source_connector = CreateSourceConnector( name=name, type=SourceConnectorType.AZURE, config=config, ) try: response: CreateSourceResponse = await client.sources.create_source_async( request=CreateSourceRequest(create_source_connector=source_connector), ) result = create_log_for_created_updated_connector( response, connector_name="Azure", connector_type="Source", created_or_updated="Created", ) return result except Exception as e: return f"Error creating Azure source connector: {str(e)}"
  • Registers the create_azure_source function as the handler for 'azure' source type in the source_functions dictionary used by create_source_connector.
    source_functions = { "azure": create_azure_source, "gdrive": create_gdrive_source, "onedrive": create_onedrive_source, "s3": create_s3_source, "salesforce": create_salesforce_source, "sharepoint": create_sharepoint_source, }
  • Helper function to prepare the AzureSourceConnectorConfigInput based on environment variables for authentication credentials.
    def _prepare_azure_source_config( remote_url: Optional[str], recursive: Optional[bool], ) -> AzureSourceConnectorConfigInput: """Prepare the Azure source connector configuration.""" if os.getenv("AZURE_CONNECTION_STRING") and not ( os.getenv("AZURE_ACCOUNT_NAME") or os.getenv("AZURE_ACCOUNT_KEY") or os.getenv("AZURE_SAS_TOKEN") ): return AzureSourceConnectorConfigInput( remote_url=remote_url, recursive=recursive, connection_string=os.getenv("AZURE_CONNECTION_STRING"), ) elif ( os.getenv("AZURE_ACCOUNT_NAME") and os.getenv("AZURE_ACCOUNT_KEY") and not (os.getenv("AZURE_SAS_TOKEN") or os.getenv("AZURE_CONNECTION_STRING")) ): return AzureSourceConnectorConfigInput( remote_url=remote_url, recursive=recursive, account_name=os.getenv("AZURE_ACCOUNT_NAME"), account_key=os.getenv("AZURE_ACCOUNT_KEY"), ) elif ( os.getenv("AZURE_ACCOUNT_NAME") and os.getenv("AZURE_SAS_TOKEN") and not (os.getenv("AZURE_ACCOUNT_KEY") or os.getenv("AZURE_CONNECTION_STRING")) ): return AzureSourceConnectorConfigInput( remote_url=remote_url, recursive=recursive, account_name=os.getenv("AZURE_ACCOUNT_NAME"), sas_token=os.getenv("AZURE_SAS_TOKEN"), ) else: raise ValueError("No Azure credentials provided")

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/Unstructured-IO/UNS-MCP'

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