Skip to main content
Glama

create_file

Transfer local files to OneDrive using specified paths and account details. Simplify file management through integration with Microsoft Graph API.

Instructions

Upload a local file to OneDrive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
local_file_pathYes
onedrive_pathYes

Implementation Reference

  • The main handler function for the 'create_file' tool. It reads the content of a local file and uploads it to the specified OneDrive path using the Microsoft Graph API via the graph.upload_large_file helper.
    @mcp.tool
    def create_file(
        onedrive_path: str, local_file_path: str, account_id: str
    ) -> dict[str, Any]:
        """Upload a local file to OneDrive"""
        path = pl.Path(local_file_path).expanduser().resolve()
        data = path.read_bytes()
        result = graph.upload_large_file(
            f"/me/drive/root:/{onedrive_path}:", data, account_id
        )
        if not result:
            raise ValueError(f"Failed to create file at path: {onedrive_path}")
        return result
  • Supporting helper function that performs the actual file upload to Microsoft Graph OneDrive. Handles both small files (direct PUT) and large files (via createUploadSession and chunked upload). Called directly by the create_file handler.
    def upload_large_file(
        path: str,
        data: bytes,
        account_id: str | None = None,
        item_properties: dict[str, Any] | None = None,
    ) -> dict[str, Any]:
        """Upload a large file using upload sessions"""
        file_size = len(data)
    
        if file_size <= UPLOAD_CHUNK_SIZE:
            result = request("PUT", f"{path}/content", account_id, data=data)
            if not result:
                raise ValueError("Failed to upload file")
            return result
    
        session = create_upload_session(path, account_id, item_properties)
        upload_url = session["uploadUrl"]
    
        headers = {"Authorization": f"Bearer {get_token(account_id)}"}
        return _do_chunked_upload(upload_url, data, headers)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Upload') which implies a write operation, but doesn't disclose critical traits like required permissions, file size limits, rate limits, error handling, or what happens on success (e.g., returns file ID). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized for a basic upload operation and front-loaded with the key action. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a mutation tool with 3 parameters), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., side effects, error cases), parameter usage, and expected outcomes. For a file creation tool in a cloud storage context, more context is needed to ensure safe and correct usage by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate by explaining parameters. It mentions 'local file' and 'OneDrive' which loosely map to 'local_file_path' and 'onedrive_path', but doesn't clarify parameter meanings (e.g., format of paths, what 'account_id' refers to). With 3 undocumented parameters, the description adds minimal semantic value beyond what's inferred from the tool name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Upload') and the resource ('a local file to OneDrive'), making the purpose immediately understandable. It distinguishes from siblings like 'delete_file' and 'update_file' by specifying creation/upload rather than modification or deletion. However, it doesn't explicitly differentiate from 'get_file' or 'list_files' in terms of operation type beyond the verb 'upload'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication), when not to use it (e.g., for updating existing files), or refer to sibling tools like 'update_file' for modifications or 'delete_file' for removal. Usage is implied by the verb 'upload' but lacks explicit context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/elyxlz/microsoft-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server