What can you do with it?

OneDrive enables you to manage your cloud files and folders programmatically. You can list files and folders in any directory, search for specific files across your entire drive, upload new files or create folders, download files for viewing or processing, move and copy files between locations, share files with others through links or invitations, and access special folders like Desktop or Documents. This integration is perfect for file backup automation, document management workflows, content synchronization, and building applications that interact with cloud storage.

How to use it?

Basic Command Structure

/your-OneDrive-connection [action] [required-parameters] [optional-parameters]

Parameters

Required:
  • action - The operation to perform with OneDrive
  • pc-connection-id - Your PinkConnect OneDrive connection ID

Tools

List Items

List files and folders in a directory Parameters:
  • folder-path (optional) - Path to the folder (default: root)
Example:
/your-OneDrive-connection
action: list-items
pc-connection-id: your-connection-id
folder-path: /Documents/Projects
Response:
{
  "value": [
    {
      "id": "item-123",
      "name": "Q1 Report.docx",
      "size": 524288,
      "file": {
        "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
      },
      "lastModifiedDateTime": "2024-03-15T10:30:00Z",
      "webUrl": "https://onedrive.live.com/..."
    },
    {
      "id": "folder-456",
      "name": "Images",
      "folder": {
        "childCount": 15
      }
    }
  ]
}

Search Items

Search for files and folders by name Parameters:
  • search-query (required) - Search term for file or folder names
Example:
/your-OneDrive-connection
action: search-items
pc-connection-id: your-connection-id
search-query: budget spreadsheet
Response:
{
  "value": [
    {
      "id": "item-789",
      "name": "2024 Budget Spreadsheet.xlsx",
      "size": 1048576,
      "file": {
        "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
      },
      "parentReference": {
        "path": "/drive/root:/Finance"
      }
    }
  ]
}

Upload File

Upload a new file to OneDrive Parameters:
  • file-path (required) - Destination path including filename
  • content (required) - File content to upload
Example:
/your-OneDrive-connection
action: upload-file
pc-connection-id: your-connection-id
file-path: /Documents/report.pdf
content: [binary content]
Response:
{
  "id": "new-item-123",
  "name": "report.pdf",
  "size": 2097152,
  "file": {
    "mimeType": "application/pdf"
  },
  "createdDateTime": "2024-03-20T14:00:00Z",
  "webUrl": "https://onedrive.live.com/..."
}

Download File

Download a file from OneDrive Parameters:
  • item-id (required) - The ID of the file to download
Example:
/your-OneDrive-connection
action: download-file
pc-connection-id: your-connection-id
item-id: item-123
Response:
{
  "filename": "Q1 Report.docx",
  "content": "[binary content]",
  "type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  "size": 524288
}

Create Folder

Create a new folder in OneDrive Parameters:
  • parent-path (required) - Parent folder path
  • folder-name (required) - Name for the new folder
Example:
/your-OneDrive-connection
action: create-folder
pc-connection-id: your-connection-id
parent-path: /Documents
folder-name: 2024 Projects
Response:
{
  "id": "new-folder-789",
  "name": "2024 Projects",
  "folder": {
    "childCount": 0
  },
  "createdDateTime": "2024-03-20T15:00:00Z",
  "webUrl": "https://onedrive.live.com/..."
}

Move Item

Move a file or folder to a new location Parameters:
  • item-id (required) - The ID of the item to move
  • destination-folder-id (required) - The ID of the destination folder
Example:
/your-OneDrive-connection
action: move-item
pc-connection-id: your-connection-id
item-id: item-123
destination-folder-id: folder-456
Response:
{
  "id": "item-123",
  "name": "Q1 Report.docx",
  "parentReference": {
    "id": "folder-456",
    "path": "/drive/root:/Documents/Archive"
  }
}
Generate a shareable link for a file Parameters:
  • item-id (required) - The ID of the file to share
  • link-type (optional) - Type of link: view or edit (default: view)
  • scope (optional) - Link scope: anonymous or organization (default: anonymous)
Example:
/your-OneDrive-connection
action: create-share-link
pc-connection-id: your-connection-id
item-id: item-123
link-type: view
scope: anonymous
Response:
{
  "id": "share-link-456",
  "link": {
    "type": "view",
    "scope": "anonymous",
    "webUrl": "https://1drv.ms/w/s/..."
  },
  "hasPassword": false
}

Get Recent Files

Retrieve recently accessed files Parameters: None required Example:
/your-OneDrive-connection
action: get-recent-files
pc-connection-id: your-connection-id
Response:
{
  "value": [
    {
      "id": "item-recent-1",
      "name": "Meeting Notes.docx",
      "lastAccessedDateTime": "2024-03-20T10:00:00Z",
      "file": {
        "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
      }
    }
  ]
}

Get Shared Files

List files shared with you Parameters: None required Example:
/your-OneDrive-connection
action: get-shared-files
pc-connection-id: your-connection-id
Response:
{
  "value": [
    {
      "id": "shared-item-1",
      "name": "Team Budget.xlsx",
      "sharedBy": {
        "user": {
          "displayName": "John Doe",
          "email": "john@company.com"
        }
      },
      "sharedDateTime": "2024-03-15T08:00:00Z"
    }
  ]
}

Notes

OneDrive uses MCP (Model Context Protocol) tools for most operations. A PinkConnect connection ID is required for all operations. Files have a .file property with mimeType, while folders have a .folder property with childCount. Special folders like Desktop, Documents, and Photos can be accessed through specific endpoints. For Excel files, the content is already decoded and ready to save as .xlsx - CSV conversion requires saving the file first.