OneDrive Automation via Rube MCP
Automate OneDrive operations including file upload/download, search, folder management, sharing links, permissions management, and drive browsing through Composio's OneDrive toolkit.
Prerequisites
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active OneDrive connection via with toolkit
- Always call first to get current tool schemas
Setup
Get Rube MCP: Add
as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
- Verify Rube MCP is available by confirming responds
- Call with toolkit
- If connection is not ACTIVE, follow the returned auth link to complete Microsoft OAuth
- Confirm connection status shows ACTIVE before running any workflows
Core Workflows
1. Search and Browse Files
When to use: User wants to find files or browse folder contents in OneDrive
Tool sequence:
- - Verify drive access and get drive details [Prerequisite]
- - Keyword search across filenames, metadata, and content [Required]
ONE_DRIVE_ONEDRIVE_LIST_ITEMS
- List all items in the root of a drive [Optional]
- - Get detailed metadata for a specific item, expand children [Optional]
ONE_DRIVE_ONEDRIVE_FIND_FILE
- Find a specific file by exact name in a folder [Optional]
ONE_DRIVE_ONEDRIVE_FIND_FOLDER
- Find a specific folder by name [Optional]
- - List all accessible drives [Optional]
Key parameters:
- : Search query (plain keywords only, NOT KQL syntax)
- : (folder hierarchy) or (includes shared items)
- : Max items per page (default 200)
- : Pagination token from
- : Comma-separated fields to return (e.g., )
- : Sort order (e.g., , )
- : Item ID for
- : Array like or for
- : (default) or specific user ID/email
Pitfalls:
- does NOT support KQL operators (, , , ); these are treated as literal text
- Wildcard characters (, ) are NOT supported and are auto-removed; use file extension keywords instead (e.g., not )
ONE_DRIVE_ONEDRIVE_LIST_ITEMS
returns only root-level contents; use recursive with expand_relations: ["children"]
for deeper levels
- Large folders paginate; always follow / until exhausted
- Some drive ID formats may return "ObjectHandle is Invalid" errors due to Microsoft Graph API limitations
2. Upload and Download Files
When to use: User wants to upload files to OneDrive or download files from it
Tool sequence:
ONE_DRIVE_ONEDRIVE_FIND_FOLDER
- Locate the target folder [Prerequisite]
ONE_DRIVE_ONEDRIVE_UPLOAD_FILE
- Upload a file to a specified folder [Required for upload]
- - Download a file by item ID [Required for download]
- - Get file details before download [Optional]
Key parameters:
- : FileUploadable object with , , and for uploads
- : Destination path (e.g., ) or folder ID for uploads
- : File's unique identifier for downloads
- : Desired filename with extension for downloads
- : Specific drive ID (for SharePoint or OneDrive for Business)
- : (default) or specific user identifier
Pitfalls:
- Upload automatically renames on conflict (no overwrite option by default)
- Large files are automatically handled via chunking
- overrides when both are provided
- Item IDs vary by platform: OneDrive for Business uses prefix, OneDrive Personal uses format
- Item IDs are case-sensitive; use exactly as returned from API
3. Share Files and Manage Permissions
When to use: User wants to share files/folders or manage who has access
Tool sequence:
ONE_DRIVE_ONEDRIVE_FIND_FILE
or ONE_DRIVE_ONEDRIVE_FIND_FOLDER
- Locate the item [Prerequisite]
ONE_DRIVE_GET_ITEM_PERMISSIONS
- Check current permissions [Prerequisite]
ONE_DRIVE_INVITE_USER_TO_DRIVE_ITEM
- Grant access to specific users [Required]
- - Create a shareable link [Optional]
ONE_DRIVE_UPDATE_DRIVE_ITEM_METADATA
- Update item metadata [Optional]
Key parameters:
- : The file or folder to share
- : Array of objects with or
- : Array with or
- : to send notification email, for silent permission grant
- : to require authentication to access
- : Custom message for invitation (max 2000 characters)
- : ISO 8601 date for permission expiry
retain_inherited_permissions
: (default) to keep existing inherited permissions
Pitfalls:
- Using wrong with
INVITE_USER_TO_DRIVE_ITEM
changes permissions on unintended items; always verify first
- Write or higher roles are impactful; get explicit user confirmation before granting
- returns inherited and owner entries; do not assume response only reflects recent changes
- cannot be expanded via ; use the separate permissions endpoint
- At least one of or must be
4. Manage Folders (Create, Move, Delete, Copy)
When to use: User wants to create, move, rename, delete, or copy files and folders
Tool sequence:
ONE_DRIVE_ONEDRIVE_FIND_FOLDER
- Locate source and destination folders [Prerequisite]
ONE_DRIVE_ONEDRIVE_CREATE_FOLDER
- Create a new folder [Required for create]
- - Move a file or folder to a new location [Required for move]
- - Copy a file or folder (async operation) [Required for copy]
- - Move item to recycle bin [Required for delete]
ONE_DRIVE_UPDATE_DRIVE_ITEM_METADATA
- Rename or update item properties [Optional]
Key parameters:
- : Folder name for creation or new name for rename/copy
- : Path (e.g., ) or folder ID for creation
- : Item to move
- : Object with (destination folder ID) for moves:
- : Item to copy or delete
- : Object with and optional for copy destination
@microsoft.graph.conflictBehavior
: , , or for copies
- : ETag for optimistic concurrency on deletes
Pitfalls:
- does NOT support cross-drive moves; use for cross-drive transfers
- for moves requires folder ID (not folder name); resolve with first
- is asynchronous; response provides a URL to monitor progress
- moves to recycle bin, not permanent deletion
- Folder creation auto-renames on conflict (e.g., "New Folder" becomes "New Folder 1")
- Provide either or (or both) for
5. Track Changes and Drive Information
When to use: User wants to monitor changes or get drive/quota information
Tool sequence:
- - Get drive properties and metadata [Required]
- - Check storage quota (total, used, remaining) [Optional]
ONE_DRIVE_LIST_SITE_DRIVE_ITEMS_DELTA
- Track changes in SharePoint site drives [Optional]
ONE_DRIVE_GET_ITEM_VERSIONS
- Get version history of a file [Optional]
Key parameters:
- : Drive identifier (or for personal drive)
- : SharePoint site identifier for delta tracking
- : Delta token ( for current state, URL for next page, or timestamp)
- : File ID for version history
Pitfalls:
- Delta queries are only available for SharePoint site drives via
ONE_DRIVE_LIST_SITE_DRIVE_ITEMS_DELTA
- Token returns current delta token without items (useful as starting point)
- Deep or large drives can take several minutes to crawl; use batching and resume logic
Common Patterns
ID Resolution
- User: Use for authenticated user or specific user email/GUID
- Item ID from find: Use
ONE_DRIVE_ONEDRIVE_FIND_FILE
or ONE_DRIVE_ONEDRIVE_FIND_FOLDER
to get item IDs
- Item ID from search: Extract from results
- Drive ID: Use or to discover drives
- Folder path to ID: Use
ONE_DRIVE_ONEDRIVE_FIND_FOLDER
with path, then extract ID from response
ID formats vary by platform:
- OneDrive for Business/SharePoint:
01NKDM7HMOJTVYMDOSXFDK2QJDXCDI3WUK
- OneDrive Personal:
Pagination
OneDrive uses token-based pagination:
- Follow or until no more pages
- Set for page size (varies by endpoint)
ONE_DRIVE_ONEDRIVE_LIST_ITEMS
auto-handles pagination internally
- Aggressive parallel requests can trigger HTTP 429; honor headers
Path vs ID
Most OneDrive tools accept either paths or IDs:
- Paths: Start with (e.g., )
- IDs: Use unique item identifiers from API responses
- Item paths for permissions: Use format
Known Pitfalls
ID Formats
- Item IDs are case-sensitive and platform-specific
- Never use web URLs, sharing links, or manually constructed identifiers as item IDs
- Always use IDs exactly as returned from Microsoft Graph API
Rate Limits
- Aggressive parallel calls can trigger HTTP 429 Too Many Requests
- Honor headers and implement throttling
- Deep drive crawls should use batching with delays
Search Limitations
- No KQL support; use plain keywords only
- No wildcard characters; use extension keywords (e.g., not )
- No path-based filtering in search; use folder listing instead
- wildcard-only queries return HTTP 400 invalidRequest
Parameter Quirks
- overrides when both are provided
- cannot be expanded via ; use dedicated permissions endpoint
- Move operations require folder IDs in , not folder names
- Copy operations are asynchronous; response provides monitoring URL
Quick Reference
| Task | Tool Slug | Key Params |
|---|
| Search files | | , , |
| List root items | ONE_DRIVE_ONEDRIVE_LIST_ITEMS
| , , |
| Get item details | | , |
| Find file by name | ONE_DRIVE_ONEDRIVE_FIND_FILE
| , |
| Find folder by name | ONE_DRIVE_ONEDRIVE_FIND_FOLDER
| , |
| Upload file | ONE_DRIVE_ONEDRIVE_UPLOAD_FILE
| , |
| Download file | | , |
| Create folder | ONE_DRIVE_ONEDRIVE_CREATE_FOLDER
| , |
| Move item | | , |
| Copy item | | , , |
| Delete item | | |
| Share with users | ONE_DRIVE_INVITE_USER_TO_DRIVE_ITEM
| , , |
| Create share link | | , link type |
| Get permissions | ONE_DRIVE_GET_ITEM_PERMISSIONS
| |
| Update metadata | ONE_DRIVE_UPDATE_DRIVE_ITEM_METADATA
| , fields |
| Get drive info | | |
| List drives | | user/group/site scope |
| Get quota | | (none) |
| Track changes | ONE_DRIVE_LIST_SITE_DRIVE_ITEMS_DELTA
| , |
| Version history | ONE_DRIVE_GET_ITEM_VERSIONS
| |