Skip to main content
Glama

download-bytes-to-file

Read-only

Save authenticated Microsoft Graph byte content (mail attachments, meeting recordings, profile photos, Teams hosted content) to a local file with a specified absolute path, returning file details.

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 only: not available over HTTP. 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).
Behavior5/5

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

Annotations provide readOnlyHint and openWorldHint, but the description adds substantial behavioral context: it returns a specific object shape ({path, contentType, bytesWritten}), writes to absolute paths, never overwrites existing files, and is stdio-only. It also discloses that bytes are obtained through authenticated endpoints, clarifying the tool's out-of-band nature. No contradictions with annotations.

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

Conciseness4/5

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

The description is well-structured and front-loaded with the core purpose, followed by usage context and alternatives. It is somewhat lengthy (around 120 words) but each sentence carries critical information, including constraints (stdio-only, no overwrite) and sibling routing. The structure is logical: definition, use cases, limitations, and alternatives. It is not unduly verbose but could be tightened by removing a few redundant phrases (e.g., repeating 'authenticated').

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?

For a tool with two simple parameters but a wide range of supported target types (mail attachments, meeting recordings, profile photos, Teams hosted content), the description is remarkably complete. It lists common target paths, states the return format, warns about overwrite behavior, and specifies the stdio mode limitation. It also provides a clear alternative for OneDrive/SharePoint content, covering key decision points an agent needs.

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

Parameters4/5

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

Schema coverage is 100% with both parameters already documented in detail (including common paths for target and absolute-path requirement for outputPath). The description goes beyond schema by explaining the return format and why the tool exists (authenticated bytes), but it does not add new parameter-level semantics beyond reinforcing the schema. Since the schema fully covers parameter meaning, a baseline of 3 is appropriate, and the extra context about use cases earns a 4.

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 states a specific verb ('Write'), a specific resource ('authenticated Microsoft Graph byte content'), and a concrete action ('to a local file on the server'). It explicitly differentiates from sibling tools by noting it returns 'instead of base64' and names the preferred alternative for OneDrive/SharePoint (get-download-url). This makes the tool's purpose unmistakable.

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?

The description gives explicit when-to-use guidance (the only out-of-band way to save mail attachments and meeting recordings) and when-not-to-use (for OneDrive/SharePoint, get-download-url is preferred). It also notes the stdio-only constraint and that the tool never overwrites files, offering clear operational boundaries and routing to an alternative tool.

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

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/A-Impact-Pavel/ms365-mcp'

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