download_hosted_content
Retrieve an inline image or hosted content from a Microsoft Teams chat or channel message using its message and hosted content IDs, with options to view it directly or save it to a file.
Instructions
Download one inline hosted-content item (usually an image).
Specify the message location with exactly one of:
chat_id (for a chat message), or
team_id AND channel_id (for a channel message).
Get message_id and hosted_content_id from a message's hosted_content_refs (returned by list_chat_messages / list_channel_messages / list_message_replies).
Args: message_id: Graph id of the message the content is attached to. hosted_content_id: Graph hosted-content id (from hosted_content_refs). chat_id: Chat id, if the message is in a chat. team_id: Team id, if the message is in a channel. channel_id: Channel id, if the message is in a channel. save_path: Write the bytes to this file path (or into this existing directory) instead of returning content. Returns {"path", "content_type", "size_bytes"} with no content payload. include_raw: Include the raw payload under "raw" (ignored when the result is an image block or a saved file).
Returns: - Image content (PNG/JPEG/GIF/WebP, no save_path): metadata plus the image itself as a native MCP image block, viewable directly. - With save_path: {"path": str, "content_type": str | None, "size_bytes": int}. - Otherwise: {"content_type": str | None, "size_bytes": int, "content_base64": str | None}. content_type is sniffed from the bytes (Graph does not return it on the $value endpoint); it may be None for unrecognized formats.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | No | ||
| team_id | No | ||
| save_path | No | ||
| channel_id | No | ||
| message_id | Yes | ||
| include_raw | No | ||
| hosted_content_id | Yes |