KosmoKrator

storage

Microsoft OneDrive CLI for AI Agents

Use the Microsoft OneDrive CLI from KosmoKrator to call Microsoft OneDrive tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

6 functions 5 read 1 write Bearer token auth

Microsoft OneDrive CLI Setup

Microsoft OneDrive can be configured headlessly with `kosmokrator integrations:configure one_drive`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure one_drive --set access_token="$ONE_DRIVE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor one_drive --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token ONE_DRIVE_ACCESS_TOKEN Secret secret yes Access Token
url ONE_DRIVE_URL URL url no Graph API URL

Call Microsoft OneDrive Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call one_drive.onedrive_list_files '{
  "top": 1,
  "skip_token": "example_skip_token"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:one_drive onedrive_list_files '{
  "top": 1,
  "skip_token": "example_skip_token"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs one_drive --json
kosmo integrations:docs one_drive.onedrive_list_files --json
kosmo integrations:schema one_drive.onedrive_list_files --json
kosmo integrations:search "Microsoft OneDrive" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Microsoft OneDrive.

one_drive.onedrive_list_files

Read read

List files and folders in the root of the user's OneDrive. Returns item names, IDs, sizes, and metadata. Use the item ID with onedrive_get_file or onedrive_download_file for details or content.

Parameters
top, skip_token

Generic CLI call

kosmo integrations:call one_drive.onedrive_list_files '{"top":1,"skip_token":"example_skip_token"}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_list_files '{"top":1,"skip_token":"example_skip_token"}' --json

one_drive.onedrive_get_file

Read read

Get detailed metadata for a specific file or folder in OneDrive by its item ID. Returns name, size, dates, MIME type, and download URL.

Parameters
id

Generic CLI call

kosmo integrations:call one_drive.onedrive_get_file '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_get_file '{"id":"example_id"}' --json

one_drive.onedrive_upload_file

Write write

Upload a file to OneDrive. Specify the destination path and file content. Creates the file if it does not exist, or replaces it if it does. Supports files up to 4 MB via the simple upload API.

Parameters
path, content, content_type

Generic CLI call

kosmo integrations:call one_drive.onedrive_upload_file '{"path":"example_path","content":"example_content","content_type":"example_content_type"}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_upload_file '{"path":"example_path","content":"example_content","content_type":"example_content_type"}' --json

one_drive.onedrive_download_file

Read read

Download a file's content from OneDrive by its drive item ID. Returns the raw file content. Use onedrive_list_files or onedrive_get_file to find the item ID.

Parameters
id

Generic CLI call

kosmo integrations:call one_drive.onedrive_download_file '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_download_file '{"id":"example_id"}' --json

one_drive.onedrive_list_shared

Read read

List files and folders that have been shared with the current user. Returns item names, IDs, sizes, and metadata for shared content.

Parameters
top, skip_token

Generic CLI call

kosmo integrations:call one_drive.onedrive_list_shared '{"top":1,"skip_token":"example_skip_token"}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_list_shared '{"top":1,"skip_token":"example_skip_token"}' --json

one_drive.onedrive_get_current_user

Read read

Get the profile of the currently authenticated Microsoft user. Returns display name, email, job title, and other profile details.

Parameters
none

Generic CLI call

kosmo integrations:call one_drive.onedrive_get_current_user '{}' --json

Provider shortcut

kosmo integrations:one_drive onedrive_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

one_drive.onedrive_list_files

List files and folders in the root of the user's OneDrive. Returns item names, IDs, sizes, and metadata. Use the item ID with onedrive_get_file or onedrive_download_file for details or content.

Operation
Read read
Schema command
kosmo integrations:schema one_drive.onedrive_list_files --json
ParameterTypeRequiredDescription
top integer no Maximum number of items to return (default: 100, max: 999).
skip_token string no Pagination token from a previous response to fetch the next page of results.

one_drive.onedrive_get_file

Get detailed metadata for a specific file or folder in OneDrive by its item ID. Returns name, size, dates, MIME type, and download URL.

Operation
Read read
Schema command
kosmo integrations:schema one_drive.onedrive_get_file --json
ParameterTypeRequiredDescription
id string yes The unique identifier of the drive item (obtained from onedrive_list_files or onedrive_list_shared).

one_drive.onedrive_upload_file

Upload a file to OneDrive. Specify the destination path and file content. Creates the file if it does not exist, or replaces it if it does. Supports files up to 4 MB via the simple upload API.

Operation
Write write
Schema command
kosmo integrations:schema one_drive.onedrive_upload_file --json
ParameterTypeRequiredDescription
path string yes The destination path in OneDrive, relative to the root (e.g., "Documents/report.txt" or "photos/image.png").
content string yes The content of the file to upload.
content_type string no The MIME type of the file (e.g., "text/plain", "application/json", "image/png"). Defaults to "application/octet-stream".

one_drive.onedrive_download_file

Download a file's content from OneDrive by its drive item ID. Returns the raw file content. Use onedrive_list_files or onedrive_get_file to find the item ID.

Operation
Read read
Schema command
kosmo integrations:schema one_drive.onedrive_download_file --json
ParameterTypeRequiredDescription
id string yes The unique identifier of the drive item to download.

one_drive.onedrive_list_shared

List files and folders that have been shared with the current user. Returns item names, IDs, sizes, and metadata for shared content.

Operation
Read read
Schema command
kosmo integrations:schema one_drive.onedrive_list_shared --json
ParameterTypeRequiredDescription
top integer no Maximum number of items to return (default: 100, max: 999).
skip_token string no Pagination token from a previous response to fetch the next page of results.

one_drive.onedrive_get_current_user

Get the profile of the currently authenticated Microsoft user. Returns display name, email, job title, and other profile details.

Operation
Read read
Schema command
kosmo integrations:schema one_drive.onedrive_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.