Skip to main content
Glama
Softeria

Microsoft 365 MCP Server

by Softeria

create-mail-attachment-upload-session

create-mail-attachment-upload-session
Destructive

Set up a resumable upload session for attaching large files (3MB-150MB) to Outlook messages or events, providing an upload URL for sequential range-based PUTs.

Instructions

Create an upload session that allows an app to iteratively upload ranges of a file, so as to attach the file to the specified Outlook item. The item can be a message or event. Use this approach to attach a file if the file size is between 3 MB and 150 MB. To attach a file that's smaller than 3 MB, do a POST operation on the attachments navigation property of the Outlook item; see how to do this for a message or for an event. As part of the response, this action returns an upload URL that you can use in subsequent sequential PUT queries. Request headers for each PUT operation let you specify the exact range of bytes to be uploaded. This allows transfer to be resumed, in case the network connection is dropped during upload. The following are the steps to attach a file to an Outlook item using an upload session: See attach large files to Outlook messages or events for an example.

šŸ’” TIP: For attachments 3MB to 150MB. Graph rejects smaller files with ErrorAttachmentSizeShouldNotBeLessThanMinimumSize, so under 3MB use add-mail-attachment instead. Body: { AttachmentItem: { attachmentType: 'file', name: 'report.pdf', size: 5000000 } }. Returns a pre-authenticated uploadUrl; the caller PUTs the bytes there itself in ranges up to 4MB. This server does not perform the PUT.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes
confirmNoFor destructive operations when the confirm gate is enabled (MS365_MCP_REQUIRE_CONFIRM=true; off by default). Set to true only after the user has explicitly approved this action. When the gate is on, calls without confirm: true return { error: "confirmation_required" } without touching user data.
messageIdYesValue for the 'messageId' path segment. Pass it under the name 'messageId', not as 'id'. Use the 'id' field of the message object as returned by Microsoft Graph.
includeHeadersNoInclude response headers (including ETag) in the response metadata
excludeResponseNoExclude the full response body and only return success or failure indication

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv0.134.4
    • changedInput schema / properties / messageId / description
      Previous value: -"Path parameter: messageId"New value: +"Value for the 'messageId' path segment. Pass it under the name 'messageId', not as 'id'. Use the 'id' field of the message object as returned by Microsoft Graph."
  2. Changed1 schema field changedv0.131.2
    • changedInput schema / additionalProperties
      Previous value: -falseNew value: +true
  3. Changed1 schema field changedv0.131.1
    • addedInput schema / properties / confirm
      Added value: +{
      +  "description": "For destructive operations when the confirm gate is enabled (MS365_MCP_REQUIRE_CONFIRM=true; off by default). Set to true only after the user has explicitly approved this action. When the gate is on, calls without confirm: true return { error: \"confirmation_required\" } without touching user data.",
      +  "type": "boolean"
      +}
  4. Changed6 schema fields changedv0.125.0
    • addedInput schema / properties / body / properties / AttachmentItem / properties / attachmentType
      Added value: +{
      +  "enum": [
      +    "file",
      +    "item",
      +    "reference"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / body / properties / AttachmentItem / properties / contentId
      Added value: +{
      +  "description": "The CID or Content-Id of the attachment for referencing for the in-line attachments using the <img src='cid:contentId'> tag in HTML messages. Optional.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / body / properties / AttachmentItem / properties / contentType
      Added value: +{
      +  "description": "The nature of the data in the attachment. Optional.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / body / properties / AttachmentItem / properties / isInline
      Added value: +{
      +  "description": "true if the attachment is an inline attachment; otherwise, false. Optional.",
      +  "type": [
      +    "boolean",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / body / properties / AttachmentItem / properties / name
      Added value: +{
      +  "description": "The display name of the attachment. This can be a descriptive string and doesn't have to be the actual file name. Required.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / body / properties / AttachmentItem / properties / size
      Added value: +{
      +  "description": "The length of the attachment in bytes. Required.",
      +  "type": [
      +    "number",
      +    "null"
      +  ]
      +}
  5. Addedv0.114.0
  6. Removedv0.112.2
  7. Addedv0.110.0
  8. Removedv0.108.0
  9. Addedv0.96.0

TDQS

A4/5.0
Behavior4/5

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

The description discloses that the tool returns an upload URL for subsequent PUT operations, clarifying that it does not upload the file itself. This adds behavioral context beyond the annotations (which only mark destructiveHint), though it does not elaborate on confirmation requirements or side effects.

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

Conciseness2/5

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

The description is verbose and repetitive, restating the same size threshold and upload flow multiple times, including a redundant TIP section. This hurts clarity and readability, making it less concise than ideal.

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

Completeness3/5

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

The description covers the core flow (create session, get URL, then PUT) but omits mention of the confirm parameter's role and confirmation requirements, which is relevant given the destructiveHint annotation and the schema. It is sufficient for basic use but lacks completeness for a complex multi-step operation.

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 detailed descriptions for the body, messageId, and confirm parameters, with 80% coverage. The description does not add new parameter-specific semantics; it only reiterates file size limits that relate to the overall usage rather than individual parameters.

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 tool creates an upload session for attaching a file to an Outlook item (message or event). It specifies the target resource and the unique action (creating a session), and distinguishes it from the alternative for smaller files (add-mail-attachment).

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 explicitly gives usage criteria: files between 3 MB and 150 MB should use this tool, while smaller files should use the POST operation on attachments. This provides clear when-to-use vs. when-not-to-use guidance, including a named alternative.

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/Softeria/ms-365-mcp-server'

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