create_source_connector
Create connectors to extract data from cloud platforms like Azure, Google Drive, OneDrive, Salesforce, S3, and SharePoint for processing with the Unstructured API.
Instructions
Create a source connector based on type. Args: ctx: Context object with the request and lifespan context name: A unique name for this connector source_type: The type of source being created (e.g., 'azure', 'onedrive', 'salesforce', 'gdrive', 's3', 'sharepoint')
type_specific_config:
azure:
remote_url: The Azure Storage remote URL with the format
az://<container-name>/<path/to/file/or/folder/in/container/as/needed>
recursive: (Optional[bool]) Whether to access subfolders
gdrive:
drive_id: The Drive ID for the Google Drive source
recursive: (Optional[bool]) Whether to access subfolders
extensions: (Optional[list[str]]) File extensions to filter
onedrive:
path: The path to the target folder in the OneDrive account
user_pname: The User Principal Name (UPN) for the OneDrive user account
recursive: (Optional[bool]) Whether to access subfolders
authority_url: (Optional[str]) The authentication token provider URL
s3:
remote_url: The S3 URI to the bucket or folder (e.g., s3://my-bucket/)
recursive: (Optional[bool]) Whether to access subfolders
salesforce:
username: The Salesforce username
categories: (Optional[list[str]]) Optional Salesforce domain,the names of the
Salesforce categories (objects) that you want to access, specified as
a comma-separated list. Available categories include Account, Campaign,
Case, EmailMessage, and Lead.
sharepoint:
site: The SharePoint site to connect to
user_pname: The username for the SharePoint site
path: (Optional) The path within the SharePoint site
recursive: (Optional[bool]) Whether to access subfolders
authority_url: (Optional[str]) The authority URL for authentication
Returns:
String containing the created source connector information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| source_type | Yes | ||
| type_specific_config | Yes |
Implementation Reference
- The handler function that implements the logic for the 'create_source_connector' tool. It routes to specific connector creation functions based on the source_type.async def create_source_connector( ctx: Context, name: str, source_type: Literal["azure", "onedrive", "salesforce", "gdrive", "s3", "sharepoint"], type_specific_config: dict[str, Any], ) -> str: """Create a source connector based on type. Args: ctx: Context object with the request and lifespan context name: A unique name for this connector source_type: The type of source being created (e.g., 'azure', 'onedrive', 'salesforce', 'gdrive', 's3', 'sharepoint') type_specific_config: azure: remote_url: The Azure Storage remote URL with the format az://<container-name>/<path/to/file/or/folder/in/container/as/needed> recursive: (Optional[bool]) Whether to access subfolders gdrive: drive_id: The Drive ID for the Google Drive source recursive: (Optional[bool]) Whether to access subfolders extensions: (Optional[list[str]]) File extensions to filter onedrive: path: The path to the target folder in the OneDrive account user_pname: The User Principal Name (UPN) for the OneDrive user account recursive: (Optional[bool]) Whether to access subfolders authority_url: (Optional[str]) The authentication token provider URL s3: remote_url: The S3 URI to the bucket or folder (e.g., s3://my-bucket/) recursive: (Optional[bool]) Whether to access subfolders salesforce: username: The Salesforce username categories: (Optional[list[str]]) Optional Salesforce domain,the names of the Salesforce categories (objects) that you want to access, specified as a comma-separated list. Available categories include Account, Campaign, Case, EmailMessage, and Lead. sharepoint: site: The SharePoint site to connect to user_pname: The username for the SharePoint site path: (Optional) The path within the SharePoint site recursive: (Optional[bool]) Whether to access subfolders authority_url: (Optional[str]) The authority URL for authentication Returns: String containing the created source connector information """ 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, } if source_type in source_functions: source_function = source_functions[source_type] return await source_function(ctx=ctx, name=name, **type_specific_config) return ( f"Unsupported source type: {source_type}. " f"Please use a supported source type: {list(source_functions.keys())}." )
- uns_mcp/connectors/source/__init__.py:10-16 (registration)Registration of the 'create_source_connector' tool (along with related tools) using the mcp.tool() decorator in the register_source_connectors function.def register_source_connectors(mcp: FastMCP): """Register all source connector tools with the MCP server.""" mcp.tool()(create_source_connector) mcp.tool()(update_source_connector) mcp.tool()(delete_source_connector)