Skip to main content
Glama
Softeria

Microsoft 365 MCP Server

by Softeria

download-bytes-to-file

Read-only

Write authenticated Microsoft Graph byte content to a local file on the server, preserving mail attachments, meeting recordings, and profile photos. Returns file path and metadata; does not overwrite existing files.

Instructions

Write authenticated Microsoft Graph byte content to a local file on the server, returning { path, contentType, bytesWritten } instead of base64. The only out-of-band way to save mail attachments and meeting recordings, whose bytes are exposed solely through authenticated endpoints. Also handles profile photos and Teams hosted content. Writes to an absolute outputPath and never overwrites an existing file. stdio mode, or HTTP with --http-local-file-tools. For OneDrive or SharePoint file content, get-download-url is preferred — it returns a pre-authenticated URL for fully out-of-band download without the server fetching the bytes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesRelative Microsoft Graph path starting with "/". Common paths: /drives/{drive-id}/items/{driveItem-id}/content (drive file content); /me/messages/{message-id}/attachments/{attachment-id}/$value (mail attachment, list-mail-attachments returns the IDs); /me/photo/$value or /users/{user-id}/photo/$value (profile photo); /chats/{chat-id}/messages/{chatMessage-id}/hostedContents/{chatMessageHostedContent-id}/$value (Teams chat hosted content, list-chat-message-hosted-contents returns the IDs); /teams/{team-id}/channels/{channel-id}/messages/{chatMessage-id}/hostedContents/{chatMessageHostedContent-id}/$value (Teams channel hosted content). For meeting recordings, use get-meeting-recording-content where available; Microsoft Graph returns authenticated recording bytes, not a pre-authenticated download URL.
outputPathYesAbsolute path on the server's filesystem where the bytes are written, e.g. /Users/me/downloads/invoice.pdf. Must be absolute; relative paths are rejected. The parent directory must already exist, and an existing file is never overwritten (the call errors if outputPath already exists).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.134.4

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, and the description adds valuable behavioral details beyond that: it returns { path, contentType, bytesWritten } instead of base64, never overwrites existing files, and mentions the stdio/HTTP modes. It does not contradict the annotations.

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 dense but well-organized, front-loading the core purpose and then providing routing guidance and specific constraints. Every sentence contributes value, and the structure is clear despite the length.

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

Completeness5/5

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

The description covers all major use cases (mail attachments, meeting recordings, profile photos, Teams hosted content), explicitly explains the return value, and directs the agent to alternatives for other scenarios. Given the lack of an output schema, it sufficiently explains the output format, making it complete for an agent to decide when to use it.

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

Parameters3/5

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

The schema already provides 100% coverage with detailed descriptions for both parameters. The description adds minor context (e.g., a note about meeting recordings and the output format), but this does not significantly extend the parameter semantics beyond what the schema already documents, so the baseline of 3 applies.

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

Purpose5/5

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

The description clearly states the verb ('Write'), the resource ('authenticated Microsoft Graph byte content'), and the destination ('local file on the server'), and distinguishes itself from siblings by noting it is the only out-of-band way for mail attachments and meeting recordings, and explicitly compares to get-download-url for OneDrive/SharePoint.

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

Usage Guidelines5/5

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

It explicitly states when to use this tool ('The only out-of-band way to save mail attachments and meeting recordings') and when not to ('For OneDrive or SharePoint file content, get-download-url is preferred'), plus it mentions alternative tools like get-meeting-recording-content. This leaves no ambiguity for an agent.

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

Deploy Server

Other Tools