KosmoKrator

data

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.

Microsoft OneDrive CLI Setup

Microsoft OneDrive can be configured headlessly with `kosmokrator integrations:configure one-drive`.

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

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

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

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

Discovery

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

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

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.

Read read
Parameters
top, skip_token
Generic call
kosmo integrations:call one-drive.onedrive_list_files '{"top":1,"skip_token":"example_skip_token"}' --json
Shortcut
kosmo integrations:one-drive onedrive_list_files '{"top":1,"skip_token":"example_skip_token"}' --json

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.

Read read
Parameters
id
Generic call
kosmo integrations:call one-drive.onedrive_get_file '{"id":"example_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_get_file '{"id":"example_id"}' --json

one-drive.onedrive_get_drive

Get metadata for the signed-in user's default OneDrive, including drive ID, owner, quota, and drive type.

Read read
Parameters
none
Generic call
kosmo integrations:call one-drive.onedrive_get_drive '{}' --json
Shortcut
kosmo integrations:one-drive onedrive_get_drive '{}' --json

one-drive.onedrive_list_children

List files and folders under the root folder or under a specific OneDrive parent item.

Read read
Parameters
parent_id, top, skip_token
Generic call
kosmo integrations:call one-drive.onedrive_list_children '{"parent_id":"example_parent_id","top":1,"skip_token":"example_skip_token"}' --json
Shortcut
kosmo integrations:one-drive onedrive_list_children '{"parent_id":"example_parent_id","top":1,"skip_token":"example_skip_token"}' --json

one-drive.onedrive_create_folder

Create a folder in OneDrive using the Microsoft Graph DriveItem children endpoint.

Write write
Parameters
name, parent_id, conflict_behavior
Generic call
kosmo integrations:call one-drive.onedrive_create_folder '{"name":"example_name","parent_id":"example_parent_id","conflict_behavior":"example_conflict_behavior"}' --json
Shortcut
kosmo integrations:one-drive onedrive_create_folder '{"name":"example_name","parent_id":"example_parent_id","conflict_behavior":"example_conflict_behavior"}' --json

one-drive.onedrive_update_item

Update OneDrive file or folder metadata. Use name to rename, parent_reference to move, or payload for official Graph fields.

Write write
Parameters
id, name, parent_reference, payload
Generic call
kosmo integrations:call one-drive.onedrive_update_item '{"id":"example_id","name":"example_name","parent_reference":"example_parent_reference","payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_update_item '{"id":"example_id","name":"example_name","parent_reference":"example_parent_reference","payload":"example_payload"}' --json

one-drive.onedrive_delete_item

Delete a OneDrive file or folder by drive item ID.

Write write
Parameters
id
Generic call
kosmo integrations:call one-drive.onedrive_delete_item '{"id":"example_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_delete_item '{"id":"example_id"}' --json

one-drive.onedrive_copy_item

Copy a OneDrive file or folder asynchronously. Optionally provide a new name and parentReference.

Write write
Parameters
id, name, parent_reference, include_all_version_history, payload
Generic call
kosmo integrations:call one-drive.onedrive_copy_item '{"id":"example_id","name":"example_name","parent_reference":"example_parent_reference","include_all_version_history":true,"payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_copy_item '{"id":"example_id","name":"example_name","parent_reference":"example_parent_reference","include_all_version_history":true,"payload":"example_payload"}' --json

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.

Write write
Parameters
path, content, content_type
Generic call
kosmo integrations:call one-drive.onedrive_upload_file '{"path":"example_path","content":"example_content","content_type":"example_content_type"}' --json
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

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.

Read read
Parameters
id
Generic call
kosmo integrations:call one-drive.onedrive_download_file '{"id":"example_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_download_file '{"id":"example_id"}' --json

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.

Read read
Parameters
top, skip_token
Generic call
kosmo integrations:call one-drive.onedrive_list_shared '{"top":1,"skip_token":"example_skip_token"}' --json
Shortcut
kosmo integrations:one-drive onedrive_list_shared '{"top":1,"skip_token":"example_skip_token"}' --json

one-drive.onedrive_search

Search files and folders in the signed-in user's OneDrive.

Read read
Parameters
query
Generic call
kosmo integrations:call one-drive.onedrive_search '{"query":"example_query"}' --json
Shortcut
kosmo integrations:one-drive onedrive_search '{"query":"example_query"}' --json

one-drive.onedrive_delta

List changes in the signed-in user's OneDrive. Continue with @odata.nextLink or @odata.deltaLink values returned by Graph.

Read read
Parameters
params
Generic call
kosmo integrations:call one-drive.onedrive_delta '{"params":"example_params"}' --json
Shortcut
kosmo integrations:one-drive onedrive_delta '{"params":"example_params"}' --json

one-drive.onedrive_list_thumbnails

List thumbnail sets for a OneDrive file or folder item.

Read read
Parameters
id
Generic call
kosmo integrations:call one-drive.onedrive_list_thumbnails '{"id":"example_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_list_thumbnails '{"id":"example_id"}' --json

one-drive.onedrive_create_sharing_link

Create or return a sharing link for a OneDrive file or folder.

Write write
Parameters
id, type, scope, expiration_date_time, retain_inherited_permissions, payload
Generic call
kosmo integrations:call one-drive.onedrive_create_sharing_link '{"id":"example_id","type":"example_type","scope":"example_scope","expiration_date_time":"example_expiration_date_time","retain_inherited_permissions":true,"payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_create_sharing_link '{"id":"example_id","type":"example_type","scope":"example_scope","expiration_date_time":"example_expiration_date_time","retain_inherited_permissions":true,"payload":"example_payload"}' --json

one-drive.onedrive_list_permissions

List sharing permissions for a OneDrive file or folder.

Read read
Parameters
id
Generic call
kosmo integrations:call one-drive.onedrive_list_permissions '{"id":"example_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_list_permissions '{"id":"example_id"}' --json

one-drive.onedrive_delete_permission

Delete a sharing permission from a OneDrive file or folder.

Write write
Parameters
item_id, permission_id
Generic call
kosmo integrations:call one-drive.onedrive_delete_permission '{"item_id":"example_item_id","permission_id":"example_permission_id"}' --json
Shortcut
kosmo integrations:one-drive onedrive_delete_permission '{"item_id":"example_item_id","permission_id":"example_permission_id"}' --json

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.

Read read
Parameters
none
Generic call
kosmo integrations:call one-drive.onedrive_get_current_user '{}' --json
Shortcut
kosmo integrations:one-drive onedrive_get_current_user '{}' --json

one-drive.onedrive_api_get

Call a relative Microsoft Graph GET path such as "/me/drive". Absolute URLs are rejected.

Read read
Parameters
path, params
Generic call
kosmo integrations:call one-drive.onedrive_api_get '{"path":"example_path","params":"example_params"}' --json
Shortcut
kosmo integrations:one-drive onedrive_api_get '{"path":"example_path","params":"example_params"}' --json

one-drive.onedrive_api_post

Call a relative Microsoft Graph POST path with a JSON body. Absolute URLs are rejected.

Write write
Parameters
path, payload
Generic call
kosmo integrations:call one-drive.onedrive_api_post '{"path":"example_path","payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_api_post '{"path":"example_path","payload":"example_payload"}' --json

one-drive.onedrive_api_patch

Call a relative Microsoft Graph PATCH path with a JSON body. Absolute URLs are rejected.

Write write
Parameters
path, payload
Generic call
kosmo integrations:call one-drive.onedrive_api_patch '{"path":"example_path","payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_api_patch '{"path":"example_path","payload":"example_payload"}' --json

one-drive.onedrive_api_delete

Call a relative Microsoft Graph DELETE path. Absolute URLs are rejected.

Write write
Parameters
path, payload
Generic call
kosmo integrations:call one-drive.onedrive_api_delete '{"path":"example_path","payload":"example_payload"}' --json
Shortcut
kosmo integrations:one-drive onedrive_api_delete '{"path":"example_path","payload":"example_payload"}' --json

Function Schemas

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

one-drive.onedrive_list_files 2 parameters
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 1 parameters
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_get_drive 0 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_get_drive --json
ParameterTypeRequiredDescription
No parameters.
one-drive.onedrive_list_children 3 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_list_children --json
ParameterTypeRequiredDescription
parent_id string no Optional parent folder item ID. Omit to list root children.
top integer no Maximum number of items to return (default: 100, max: 999).
skip_token string no Pagination token from a previous response.
one-drive.onedrive_create_folder 3 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_create_folder --json
ParameterTypeRequiredDescription
name string yes Folder name.
parent_id string no Optional parent folder item ID. Omit to create in root.
conflict_behavior string no Conflict behavior. Defaults to rename.
one-drive.onedrive_update_item 4 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_update_item --json
ParameterTypeRequiredDescription
id string yes Drive item ID.
name string no New item name.
parent_reference object no Graph parentReference object for moving an item.
payload object no Additional Graph DriveItem update fields.
one-drive.onedrive_delete_item 1 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_delete_item --json
ParameterTypeRequiredDescription
id string yes Drive item ID to delete.
one-drive.onedrive_copy_item 5 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_copy_item --json
ParameterTypeRequiredDescription
id string yes Drive item ID to copy.
name string no Optional new name for the copy.
parent_reference object no Optional Graph parentReference object for the destination folder.
include_all_version_history boolean no Whether to include full version history when supported.
payload object no Additional official Graph copy request fields.
one-drive.onedrive_upload_file 3 parameters
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 1 parameters
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 2 parameters
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_delta 1 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_delta --json
ParameterTypeRequiredDescription
params object no Optional delta query parameters. For exact nextLink URLs, use onedrive_api_get with the relative path from the link.
one-drive.onedrive_list_thumbnails 1 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_list_thumbnails --json
ParameterTypeRequiredDescription
id string yes Drive item ID.
one-drive.onedrive_list_permissions 1 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_list_permissions --json
ParameterTypeRequiredDescription
id string yes Drive item ID.
one-drive.onedrive_delete_permission 2 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_delete_permission --json
ParameterTypeRequiredDescription
item_id string yes Drive item ID.
permission_id string yes Permission ID to delete.
one-drive.onedrive_get_current_user 0 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_get_current_user --json
ParameterTypeRequiredDescription
No parameters.
one-drive.onedrive_api_get 2 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_api_get --json
ParameterTypeRequiredDescription
path string yes Relative Graph path, with or without leading slash.
params object no Query parameters.
one-drive.onedrive_api_post 2 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_api_post --json
ParameterTypeRequiredDescription
path string yes Relative Graph path, with or without leading slash.
payload object no JSON request body.
one-drive.onedrive_api_patch 2 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_api_patch --json
ParameterTypeRequiredDescription
path string yes Relative Graph path, with or without leading slash.
payload object no JSON request body.
one-drive.onedrive_api_delete 2 parameters
Schema command
kosmo integrations:schema one-drive.onedrive_api_delete --json
ParameterTypeRequiredDescription
path string yes Relative Graph path, with or without leading slash.
payload object no Optional JSON request body.

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.